Fix false draw case.

This commit is contained in:
Greyson Parrelli
2026-08-10 16:24:32 -04:00
parent 6ae4d41976
commit 84900415b2
3 changed files with 44 additions and 15 deletions
+22
View File
@@ -24,3 +24,25 @@ func TestCrocodileLastPetVolleyFiresWhenOwnerOut(t *testing.T) {
t.Fatalf("both sides should be out (draw), got winner %d", res.WinnerSeat)
}
}
// Regression: a pair that can't hurt each other (two 0-attack pets, here
// Spooked down to nothing) must both faint so the pets behind them settle the
// battle. Previously the stalemate ended the whole battle in a draw, even with
// most of both decks still to come.
func TestStalematedPairFaintsAndBattleContinues(t *testing.T) {
g, p1, _ := unicornGame(t)
p1.Mana = 2
res := forceBattle(t, g,
// Nightcrawler (1 power) Spooks Barghest twice; Barghest (1 power)
// Spooks it once. Neither can deal damage, but Pengobble is next up.
[]Card{g.unicornPet(t, "Nightcrawler"), g.unicornPet(t, "Pengobble")},
[]Card{g.unicornPet(t, "Barghest"), g.pet("Chaff", 1)},
)
clashes := eventsOfType(res, "clash")
if len(clashes) != 1 || !clashes[0].Died[0] || !clashes[0].Died[1] {
t.Fatalf("the stuck pair should both faint in one clash: %+v", clashes)
}
if res.WinnerSeat != 0 {
t.Fatalf("Pengobble should go on to win for seat 0, got winner %d", res.WinnerSeat)
}
}