Skip to content

Maintenance/code smells - #28

Merged
SlyDevil merged 12 commits into
next_updatefrom
maintenance/code_smells
Sep 17, 2026
Merged

SlyDevil merged 12 commits into
next_updatefrom
maintenance/code_smells

Conversation

@RandyChihuahua

Copy link
Copy Markdown
Contributor

Various code smells, please note that I wasn't able to fix them all directly, as they require some context around either the battle engine or otherwise.

These are local Claude Code context docs, not meant to ship in the PR.
Removes them from git tracking (files remain on disk) and ignores
CLAUDE.md/INDEX.md going forward.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J2TLHGAcKimciZBzgcVMnN
Comment thread CSharpSourceCode/BattleMechanics/Artillery/FieldTrebuchet.cs Outdated
Comment thread CSharpSourceCode/BattleMechanics/Dismemberment/DismembermentMissionLogic.cs Outdated
Native audio management handles the soundId associated with each SoundEvent.
Comment thread CSharpSourceCode/BattleMechanics/TriggeredEffect/TriggeredEffect.cs Outdated
Comment thread CSharpSourceCode/BattleMechanics/CinematicCameraMissionView.cs Outdated
Comment thread CSharpSourceCode/CampaignMechanics/UniqueSpawns/UniqueSpawnPartyComponent.cs Outdated
// PROPOSED (CS0114, should add `new` or `override`): StatusEffectMissionLogic.cs calls this
// through the concrete `StatusEffectComponent` type (not polymorphically via
// `AgentComponent`), so `new` would match current behavior. Before adding `override` instead,
// worth checking whether the engine also auto-invokes AgentComponent.OnTick on every

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a clarifying remark for why we can't use the OnTick override that's available via AgentComponent and renamed the method to better differentiate between the seeming "Tick" calls.

public static bool ContainsSpellType(AbilityComponent component, int spellCount, AbilityEffectType excludedEffectType)
{
var wrongSpell = false;
//TODO: Why not use linq?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I once stumbled upon a comment from TW, I think, which recommended using indexed for loops instead of foreach loops f.e. because the former were more performant.

There wasn't much context on the circumstances in which they were more performant, but this may be an implementation of a similar thought process.

Idk if there's any performance benefit or cost to LINQ, but it would probably be slightly easier to read intention.

On the otherhand, I'm thoroughly confused as to why GetAbility(i) performs a modulo on the passed index as having circular indexing seems useless when the iterations are all limiting themselves to .Count.
There's derivative uses that don't check count, but they're pulling the useable AbilityTemplates from the hero's selected ability list in which case the index must necessarily exist within the bounds of the list.

Rabbit hole for another day when the ability templates get a rewrite.

@SlyDevil

SlyDevil commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

I've changed everything relevant and added clarifications where useful.

I'll let you handle the merge conflict. Afaict, it's to override the next_update EnchantmentHelper contents with the contents of this branch, but it's too late for the brain to be confident in that.

@SlyDevil

Copy link
Copy Markdown
Contributor

Branch is ready for merge.

Leaving some time for naber to respond about the party food, but from what I see it can be removed completely along with usages of it.
If the parties need food items, that default can be put in a constant or the argument passed elsewhere. I don't see a reason to need the integer saved to file when it's only used on party creation.

@SlyDevil
SlyDevil merged commit 03a5ad3 into next_update Sep 17, 2026
@RandyChihuahua
RandyChihuahua deleted the maintenance/code_smells branch September 17, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants