Fix a bunch of bugs.
This commit is contained in:
@@ -141,6 +141,38 @@ func TestBattleDamageMarkers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A Hurt effect still fires on a fatal hit: the Lizard drops a Bee on top of
|
||||
// its deck even when killed in one clash.
|
||||
func TestLizardBeeOnFatalHit(t *testing.T) {
|
||||
g, _, _ := testGame(t)
|
||||
res := forceBattle(t, g,
|
||||
[]Card{g.goldenPet(t, "Lizard")},
|
||||
[]Card{g.pet("Wall", 20)}, // one clash kills the 2-power Lizard
|
||||
)
|
||||
bees := 0
|
||||
for _, ev := range eventsOfType(res, "summon") {
|
||||
if ev.Card != nil && ev.Card.Name == "Bee" {
|
||||
bees++
|
||||
}
|
||||
}
|
||||
if bees == 0 {
|
||||
t.Fatal("Lizard should add a Bee even when killed in one hit")
|
||||
}
|
||||
}
|
||||
|
||||
// A Hurt effect marked SurviveOnly does NOT fire on a fatal hit: the Peacock's
|
||||
// "if this pet hasn't fainted" apple is skipped when the clash kills it.
|
||||
func TestPeacockNoEatOnFatalHit(t *testing.T) {
|
||||
g, _, _ := testGame(t)
|
||||
res := forceBattle(t, g,
|
||||
[]Card{g.realPet(t, "Peacock")},
|
||||
[]Card{g.pet("Wall", 20)}, // one clash kills the 2-power Peacock
|
||||
)
|
||||
if len(eventsOfType(res, "eat")) != 0 {
|
||||
t.Fatal("Peacock should not eat an apple when it faints")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBattleEqualPowerBothDie(t *testing.T) {
|
||||
g, _, _ := testGame(t)
|
||||
res := forceBattle(t, g,
|
||||
@@ -486,7 +518,8 @@ func TestDolphinThrowsThreeRocks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Camel pushes an apple onto its own stack whenever it's hurt and survives.
|
||||
// Camel pushes an apple onto its own stack whenever it's hurt — including the
|
||||
// hit that finishes it, since Hurt now fires on faint.
|
||||
func TestCamelHurtSummonsApple(t *testing.T) {
|
||||
g, _, _ := testGame(t)
|
||||
res := forceBattle(t, g,
|
||||
@@ -494,10 +527,16 @@ func TestCamelHurtSummonsApple(t *testing.T) {
|
||||
[]Card{g.pet("Chip", 1), g.pet("Chip2", 3)},
|
||||
)
|
||||
// Clash 1: camel takes 1 (survives) → apple onto A's stack. Clash 2 vs
|
||||
// Chip2: both die. A reveals apple + Ally (3 power) and wins.
|
||||
// Chip2: camel dies but its Hurt still fires → a second apple. A reveals
|
||||
// both apples onto Ally and wins.
|
||||
summons := eventsOfType(res, "summon")
|
||||
if len(summons) != 1 || summons[0].Seat != 0 || summons[0].Card.Food != FoodApple {
|
||||
t.Fatalf("camel should summon one apple onto its own stack: %+v", summons)
|
||||
if len(summons) != 2 {
|
||||
t.Fatalf("camel should summon an apple each time it's hurt (twice): %+v", summons)
|
||||
}
|
||||
for _, s := range summons {
|
||||
if s.Seat != 0 || s.Card.Food != FoodApple {
|
||||
t.Fatalf("camel apples should land on its own stack: %+v", s)
|
||||
}
|
||||
}
|
||||
if res.WinnerSeat != 0 {
|
||||
t.Fatalf("apple-buffed ally should win, got %d", res.WinnerSeat)
|
||||
|
||||
Reference in New Issue
Block a user