Break a 9-clash pet deadlock by fainting both combatants.

This commit is contained in:
Greyson Parrelli
2026-07-23 08:49:51 -04:00
parent c669ac1453
commit ec68689586
2 changed files with 58 additions and 0 deletions
+25
View File
@@ -736,3 +736,28 @@ func TestSkunkStripFaintsDebuffedPet(t *testing.T) {
t.Fatalf("skunk should win once the stripped pet faints, got %d", res.WinnerSeat)
}
}
// Two pets that block every hit could clash forever; the deadlock rule makes
// them both faint after 9 clashes so the battle can proceed.
func TestBattleDeadlockBreaksAfterNineClashes(t *testing.T) {
g, _, _ := testGame(t)
wall := func(name string) Card {
return Card{
ID: g.newCardID(), Kind: KindPet, Name: name, Tier: 1, Power: 3, Suit: SuitRed,
Effects: []Effect{{Trigger: TriggerPlay, Action: ActionShieldSelf, Count: 20}},
}
}
res := forceBattle(t, g, []Card{wall("Wall")}, []Card{wall("Fort")})
clashes := eventsOfType(res, "clash")
if len(clashes) != 9 {
t.Fatalf("deadlock should resolve after 9 clashes, got %d", len(clashes))
}
last := clashes[len(clashes)-1]
if !last.Died[0] || !last.Died[1] {
t.Fatalf("the 9th clash should faint both pets: %+v", last)
}
if res.WinnerSeat != -1 {
t.Fatalf("a deadlock is a draw, got winner=%d", res.WinnerSeat)
}
}