Files
commander-ai-lab/tests/sim
Claude CodeandClaude Opus 4.6 a88b371889 feat: centralized combat damage routing with commander tracking (#86)
Wire all combat damage through a single _apply_damage() method that
handles commander damage tracking (MTG rule 903.10a) and elimination
checks. Each attacker's damage is individually attributed so commander
creatures correctly accumulate toward the 21-damage lethal threshold.

Changes:
- Add Player.commander_damage_received dict on the base model so the
  engine can track commander damage without needing CommanderGameState
- Add GameEngine._apply_damage() static method: reduces life, tracks
  commander damage when source is a commander, checks both life-lethal
  and commander-damage-lethal elimination
- Refactor _resolve_combat() to route per-attacker player damage through
  _apply_damage() instead of bulk life subtraction
- Change CommanderPlayer.commander_damage_received from own field to
  property delegating to base Player, keeping both layers in sync
- Add 24 targeted regression tests covering: _apply_damage unit tests,
  combat integration (unblocked/blocked/trample/double-strike/lifelink/
  mixed attackers/cumulative kills), and GameState compat

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 23:03:12 +00:00
..