fix: battle simulator combat - units not fighting and air units not m…#1419
Merged
braedonsaunders merged 1 commit intomainfrom Feb 17, 2026
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…oving
Three bugs caused the battle simulator to break:
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.
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.
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