27 lines
1.1 KiB
Go
27 lines
1.1 KiB
Go
package game
|
|
|
|
import "testing"
|
|
|
|
// Regression (improvements.txt): a Crocodile set aside must still throw its
|
|
// last-pet volley when the enemy plays their final pet, even though the
|
|
// Crocodile's own side is already out of pets. Previously the "battle over"
|
|
// check fired first and swallowed the parting shot.
|
|
func TestCrocodileLastPetVolleyFiresWhenOwnerOut(t *testing.T) {
|
|
g, _, _ := testGame(t)
|
|
g.RollDie = func() int { return 2 } // 3 rocks -> 6 damage
|
|
res := forceBattle(t, g,
|
|
[]Card{g.pet("Killer", 4), g.pet("Last", 3)}, // seat 0 plays its last pet
|
|
[]Card{g.realPet(t, "Crocodile")}, // seat 1's Croc faints, sets aside
|
|
)
|
|
// Killer trades with Crocodile (set aside). Seat 0 then plays its last pet,
|
|
// and the Crocodile's 3 rocks (roll 6) pelt it dead — turning a win into a
|
|
// mutual knockout.
|
|
rocks := eventsOfType(res, "rock")
|
|
if len(rocks) != 1 || rocks[0].Seat != 1 || rocks[0].Roll != 6 || !rocks[0].TargetDied {
|
|
t.Fatalf("Crocodile should volley the last pet for 6: %+v", rocks)
|
|
}
|
|
if res.WinnerSeat != -1 {
|
|
t.Fatalf("both sides should be out (draw), got winner %d", res.WinnerSeat)
|
|
}
|
|
}
|