Fix bugs around AI opponents.

This commit is contained in:
Greyson Parrelli
2026-07-24 12:52:10 -04:00
parent add2218978
commit e25a85e394
4 changed files with 95 additions and 3 deletions
+17
View File
@@ -156,6 +156,23 @@ func TestManateeSelfRockFatalStillAddsApples(t *testing.T) {
}
}
// A player whose only in-play pet faints to its own play effect (Manatee's
// self-rock) still wins if it has pets left in its deck and the opponent has
// none. The battle loop breaks the instant the opponent runs out — before the
// survivor's next pet is revealed — so the winner must be decided by who can
// still field a pet, not by who happens to have one in play at that instant.
func TestSelfFaintWithReserveStillWins(t *testing.T) {
g, _, _ := testGame(t)
g.RollDie = func() int { return 2 } // 2 rocks = 4 damage, fatal to the 3-power Manatee
res := forceBattle(t, g,
[]Card{g.goldenPet(t, "Manatee"), g.pet("Reserve", 5)},
[]Card{g.newApple()}, // opponent has only food — no pet, ever
)
if res.WinnerSeat != 0 {
t.Fatalf("seat 0 should win with a reserve pet vs an all-food deck, got winner %d", res.WinnerSeat)
}
}
// Poison Dart Frog, once set aside, throws rocks each time a Bee is played.
func TestPoisonDartFrogBeeRocks(t *testing.T) {
g, _, _ := testGame(t)