Skip to content

Fix AI freeze when declaring attackers with unpayable attack costs#9998

Merged
tool4ever merged 1 commit intoCard-Forge:masterfrom
vanja-ivancevic:fix-ai-attack-cost-freeze
Mar 6, 2026
Merged

Fix AI freeze when declaring attackers with unpayable attack costs#9998
tool4ever merged 1 commit intoCard-Forge:masterfrom
vanja-ivancevic:fix-ai-attack-cost-freeze

Conversation

@vanja-ivancevic
Copy link
Contributor

@vanja-ivancevic vanja-ivancevic commented Mar 6, 2026

  • AI would freeze in an infinite loop when declaring attackers that have attack tax costs (e.g. Propaganda) they cannot pay, forcing the player to concede
  • The bug required interdependent attackers like two Mogg Flunkies (which can only attack if another creature also attacks): the AI would declare both, PhaseHandler would remove one for not paying the tax, the remaining one alone would fail validation, and the loop would restart with the AI making the same decision
  • Reproduced by destroying the AI's lands at the beginning of combat while Propaganda was in play
  • Fix: check attack cost payability at declaration time in AiController, before the attackers reach PhaseHandler's payment loop. This aligns with CR 508.1d which says the decision to pay attack costs is made during attacker declaration, not as a separate step afterward

@vanja-ivancevic vanja-ivancevic force-pushed the fix-ai-attack-cost-freeze branch from 4382f35 to 5c089c5 Compare March 6, 2026 18:11
Copy link
Contributor

@tool4ever tool4ever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice find

@tool4ever tool4ever merged commit 5d48a4c into Card-Forge:master Mar 6, 2026
2 checks passed
@vanja-ivancevic vanja-ivancevic deleted the fix-ai-attack-cost-freeze branch March 7, 2026 00:33
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