Fix Ward batch event bug

Fixes #13498

getTargetingStackObject wasn't processing all stackObjects in a batch event

added tests for some related cards that also use the method
- Agrus Kos, Eternal Soldier
- Pawpatch Recruit
- Ward Ability
This commit is contained in:
jmlundeen 2025-04-04 23:25:53 -05:00
parent 41d3464b5c
commit 8e1805c874
12 changed files with 141 additions and 10 deletions

View file

@ -30,4 +30,54 @@ public class WardTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Solitude", 1);
assertPermanentCount(playerB, "Waterfall Aerialist", 1);
}
@Test
public void wardPanharmonicon() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Panharmonicon");
addCard(Zone.BATTLEFIELD, playerA, "Young Red Dragon");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 7);
addCard(Zone.BATTLEFIELD, playerB, "Roaming Throne");
addCard(Zone.HAND, playerA, "Scourge of Valkas");
setChoice(playerB, "Dragon");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Scourge of Valkas");
setChoice(playerA, "Whenever {this} or another Dragon");
addTarget(playerA, "Roaming Throne");
addTarget(playerA, "Roaming Throne");
setChoice(playerB, "ward {2}");
setChoice(playerA, "Yes");
setChoice(playerA, "No");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerB, "Roaming Throne", 1);
assertDamageReceived(playerB, "Roaming Throne", 2);
}
@Test
public void wardPanharmoniconCounter() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Panharmonicon");
addCard(Zone.BATTLEFIELD, playerA, "Young Red Dragon");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerB, "Roaming Throne");
addCard(Zone.HAND, playerA, "Scourge of Valkas");
setChoice(playerB, "Dragon");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Scourge of Valkas");
setChoice(playerA, "Whenever {this} or another Dragon");
addTarget(playerA, "Roaming Throne");
addTarget(playerA, "Roaming Throne");
setChoice(playerB, "ward {2}");
setChoice(playerA, "No");
setChoice(playerA, "No");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerB, "Roaming Throne", 1);
assertDamageReceived(playerB, "Roaming Throne", 0);
}
}

View file

@ -0,0 +1,41 @@
package org.mage.test.cards.single.blb;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class PawpatchRecruitTest extends CardTestPlayerBase {
private static final String paw = "Pawpatch Recruit";
private static final String cub = "Bear Cub";
private static final String panharm = "Panharmonicon";
private static final String prowler = "Chrome Prowler";
@Test
public void testCopiedTriggerAbility() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerB, paw);
addCard(Zone.BATTLEFIELD, playerB, cub);
addCard(Zone.BATTLEFIELD, playerA, panharm);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.HAND, playerA, prowler);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, prowler);
setChoice(playerA, "When {this} enters");
addTarget(playerA, paw);
addTarget(playerA, cub);
setChoice(playerB, "Whenever a creature");
addTarget(playerB, paw);
addTarget(playerB, cub);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertTapped(paw, true);
assertTapped(cub, true);
assertCounterCount(playerB, paw, CounterType.P1P1, 1);
assertCounterCount(playerB, cub, CounterType.P1P1, 1);
}
}

View file

@ -67,4 +67,35 @@ public class AgrusKosEternalSoldierTest extends CardTestPlayerBase {
assertLife(playerB, 20);
}
@Test
public void testCopiedTriggerAbility() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerB, agrus);
addCard(Zone.BATTLEFIELD, playerB, turtle);
addCard(Zone.BATTLEFIELD, playerB, firewalker);
addCard(Zone.BATTLEFIELD, playerB, "Plateau", 4);
addCard(Zone.BATTLEFIELD, playerA, "Panharmonicon");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 7);
addCard(Zone.HAND, playerA, "Smoldering Werewolf");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Smoldering Werewolf");
setChoice(playerA, "When {this} enters, it deals");
addTarget(playerA, agrus);
addTarget(playerA, agrus);
setChoice(playerB, true); // gain life
setChoice(playerB, "Whenever {this} becomes");
setChoice(playerB, true); // pay to copy
setChoice(playerB, true); // pay to copy
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertDamageReceived(playerB, agrus, 2);
assertDamageReceived(playerB, turtle, 2);
assertDamageReceived(playerB, firewalker, 0);
assertLife(playerA, 20);
assertLife(playerB, 21);
}
}