Files
sor/Client
cf771f8531 Fix: counter-attack animation fires even when defender absorbs damage with defense
Previously the counterattack chain was only triggered when both units appeared
in damaged_iids (HP decreased).  If the defender's defense stat absorbs the
attacker's hit entirely, their HP doesn't change, so they were never in
damaged_iids — the counterattack animation was silently skipped.

Fix: record _last_attack_target_iid in send_attack() and use it in
_play_damage_animations as the primary defender source.  The tracked target is
consumed (cleared) on first use so it never bleeds into later state updates.
The old fallback (any other damaged unit) is kept for cases where no tracked
target is available.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-16 13:58:36 -04:00
..