Skip to content

fix: battle simulator combat - units not fighting and air units not m…#1419

Merged
braedonsaunders merged 1 commit intomainfrom
claude/fix-battle-simulator-combat-lkM4e
Feb 17, 2026
Merged

fix: battle simulator combat - units not fighting and air units not m…#1419
braedonsaunders merged 1 commit intomainfrom
claude/fix-battle-simulator-combat-lkM4e

Conversation

@braedonsaunders
Copy link
Owner

…oving

Three bugs caused the battle simulator to break:

  1. SpatialGrid returns entity INDICES but callers used World.getEntity() which validates generational IDs. After entity recycling (Clear All), generation > 0 means index != full ID, causing all spatial queries to silently return no results. Fixed all 28 call sites across 9 files to use getEntityByIndex() which correctly handles index-based lookups.

  2. BattleSimulatorPanel used ATTACK command type which only routes to CombatSystem (sets attackmove state but never requests pathfinding). Changed to ATTACK_MOVE which routes to MovementOrchestrator, handling both pathfinding and combat targeting.

  3. AITacticsManager.executeAttackingPhase returned early when no enemy buildings existed (battle simulator has no buildings). The unit-hunt code that targets enemy unit clusters was unreachable. Now checks for enemy units before the early return.

https://claude.ai/code/session_01BfPtHo2wTxYxsQX6beAFkZ

…oving

Three bugs caused the battle simulator to break:

1. SpatialGrid returns entity INDICES but callers used World.getEntity()
   which validates generational IDs. After entity recycling (Clear All),
   generation > 0 means index != full ID, causing all spatial queries to
   silently return no results. Fixed all 28 call sites across 9 files to
   use getEntityByIndex() which correctly handles index-based lookups.

2. BattleSimulatorPanel used ATTACK command type which only routes to
   CombatSystem (sets attackmove state but never requests pathfinding).
   Changed to ATTACK_MOVE which routes to MovementOrchestrator, handling
   both pathfinding and combat targeting.

3. AITacticsManager.executeAttackingPhase returned early when no enemy
   buildings existed (battle simulator has no buildings). The unit-hunt
   code that targets enemy unit clusters was unreachable. Now checks for
   enemy units before the early return.

https://claude.ai/code/session_01BfPtHo2wTxYxsQX6beAFkZ
@braedonsaunders braedonsaunders merged commit 6205a69 into main Feb 17, 2026
@braedonsaunders braedonsaunders deleted the claude/fix-battle-simulator-combat-lkM4e branch February 17, 2026 17:07
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.

2 participants