refactor selecting cards from multiple zones (#11584)

* refactor selecting cards from multiple zones

fix MV <= controlled lands predicate

fix filter checks without source parameter

* fix test choice
This commit is contained in:
xenohedron 2023-12-31 14:25:25 -05:00 committed by GitHub
parent 8459babbcd
commit e6bd35eb77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 258 additions and 319 deletions

View file

@ -93,7 +93,6 @@ public class PutCardFromOneOfTwoZonesOntoBattlefieldEffectTest extends CardTestP
setStrictChooseMode(true);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2");
setChoice(playerA, "Yes"); // For player this choice is "Hand" but tests require "Yes"
setChoice(playerA, vorpal);
setStopAt(1, PhaseStep.END_TURN);
@ -113,7 +112,7 @@ public class PutCardFromOneOfTwoZonesOntoBattlefieldEffectTest extends CardTestP
public void testNissaCanPlay() {
addCard(Zone.BATTLEFIELD, playerA, nissa);
addCard(Zone.HAND, playerA, swift); // {4}{B}{R}
addCard(Zone.HAND, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.HAND, playerA, "Mountain");
setStrictChooseMode(true);
@ -121,7 +120,6 @@ public class PutCardFromOneOfTwoZonesOntoBattlefieldEffectTest extends CardTestP
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mountain");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-5");
setChoice(playerA, swift);
setChoice(playerA, "Yes"); // Say yes to Swift Warkite's ETB (no further choice needed since there are no possible options
setStopAt(1, PhaseStep.END_TURN);
@ -145,7 +143,6 @@ public class PutCardFromOneOfTwoZonesOntoBattlefieldEffectTest extends CardTestP
addCard(Zone.HAND, playerA, swift); // {4}{B}{R}
addCard(Zone.HAND, playerA, "Mountain");
setStrictChooseMode(true);
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mountain");
@ -174,7 +171,6 @@ public class PutCardFromOneOfTwoZonesOntoBattlefieldEffectTest extends CardTestP
setStrictChooseMode(true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, swift);
setChoice(playerA, "Yes"); // Yes to activating Swift Warkite's ETB
setChoice(playerA, sliver); // Pick the sliver for the ETB
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);

View file

@ -5,7 +5,6 @@ import mage.abilities.keyword.FlyingAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
@ -45,7 +44,7 @@ public class DanithaBenaliasHopeTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, danitha);
setChoice(playerA, true); // attempt to use ability
setChoice(playerA, TestPlayer.CHOICE_SKIP);
// choice skip not needed
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
@ -105,7 +104,7 @@ public class DanithaBenaliasHopeTest extends CardTestPlayerBase {
setChoice(playerA, true); // use ability
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, swords, danitha);
setChoice(playerA, TestPlayer.CHOICE_SKIP); // no longer can attach Aura
// no longer can attach Aura
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);

View file

@ -199,7 +199,7 @@ public class LiberatedLivestockTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, MURDER, LIBERATEDLIVESTOCK);
addTarget(playerA, KEENSENSE);
addTarget(playerA, ARACHNOFORM);
addTarget(playerA, TestPlayer.TARGET_SKIP);
// no possible targets thus no need to target skip
waitStackResolved(1, PhaseStep.END_TURN);
execute();