← Ülevaadedocs\ai_context\AUTO_RETARGET_20261125.md

Auto-retarget when the selected enemy dies (2026-11-25, Claude)

Janari asked: when the selected enemy dies, select another enemy that is fighting the player so skills keep working; if nobody is fighting, select nothing.

Behaviour

Tests

Scripts/Build/GameChecks/game_check_play.gd retarget_checks() (part of run_game_checks.ps1): hit keeps selection, death -> most recent attacker, death -> nearest aggroed, last death -> no target. The check silences ally alerts (ally_alert_radius = 0) because a hit/death normally aggroes nearby same-race allies, who then rightly become the next pick. Result 25.11: play 37/37 PASS. Full suite run with the editor open: stress_40 perf budget missed (73.9 FPS, worst 139 ms), most likely the concurrent editor; not caused by this change, rerun with editor closed.

Nothing was deleted; no archive needed (pure additions).