mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
* Fixed that enchant card in graveyard auras select target when entering the battlefield (allows the Animate Dead Worlgorger Dragon combo).
This commit is contained in:
parent
c285fc6c4d
commit
ffd0b0c685
5 changed files with 114 additions and 17 deletions
|
|
@ -51,4 +51,69 @@ public class WorlgorgerDragonTest extends CardTestPlayerBase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
1. Cast Animate Dead, targeting the Dragon
|
||||
2. Dragon comes into play, it's ability goes on the stack.
|
||||
3. The ability resolves, and all my other permanents leave play
|
||||
4. Since Animate Dead left play, Dragon goes to the graveyard
|
||||
5. Since the Dragon left play, the land and Animate Dead return to play. Animate Dead triggers, targeting the Dragon.
|
||||
6. In response to Animate Dead's ability going on the stack, tap the lands for mana.
|
||||
7. Animate Dead resolves, Dragon comes into play, everything else leaves play.
|
||||
8. Steps 4-7 repeat endlessly. Your mana pool fills.
|
||||
9. You can interrupt the sequence to play an instant.
|
||||
*/
|
||||
@Test
|
||||
public void testWithAnimateDead() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
|
||||
// When Worldgorger Dragon enters the battlefield, exile all other permanents you control.
|
||||
// When Worldgorger Dragon leaves the battlefield, return the exiled cards to the battlefield under their owners' control.
|
||||
addCard(Zone.GRAVEYARD, playerA, "Worldgorger Dragon", 1);
|
||||
addCard(Zone.HAND, playerA, "Animate Dead");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
// Instant {X}{R}{R}
|
||||
// Volcanic Geyser deals X damage to target creature or player.
|
||||
addCard(Zone.HAND, playerA, "Volcanic Geyser", 1);
|
||||
// When Staunch Defenders enters the battlefield, you gain 4 life.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Staunch Defenders", 1);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Animate Dead", "Worldgorger Dragon");
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volcanic Geyser", playerB, 22);
|
||||
setChoice(playerA, "X=20");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 0);
|
||||
|
||||
assertGraveyardCount(playerA, "Volcanic Geyser", 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ public class TestPlayer extends ComputerPlayer {
|
|||
String command = action.getAction();
|
||||
command = command.substring(command.indexOf("activate:") + 9);
|
||||
String[] groups = command.split("\\$");
|
||||
if (!checkSpellOnStackCondition(groups, game) || !checkSpellOnTopOfStackCondition(groups, game)) {
|
||||
if (groups.length > 2 && !checkExecuteCondition(groups, game)) {
|
||||
break;
|
||||
}
|
||||
for (Ability ability: this.getPlayable(game, true)) {
|
||||
|
|
@ -522,8 +522,8 @@ public class TestPlayer extends ComputerPlayer {
|
|||
return null;
|
||||
}
|
||||
|
||||
private boolean checkSpellOnStackCondition(String[] groups, Game game) {
|
||||
if (groups.length > 2 && groups[2].startsWith("spellOnStack=")) {
|
||||
private boolean checkExecuteCondition(String[] groups, Game game) {
|
||||
if (groups[2].startsWith("spellOnStack=")) {
|
||||
String spellOnStack = groups[2].substring(13);
|
||||
for (StackObject stackObject: game.getStack()) {
|
||||
if (stackObject.getStackAbility().toString().contains(spellOnStack)) {
|
||||
|
|
@ -531,7 +531,7 @@ public class TestPlayer extends ComputerPlayer {
|
|||
}
|
||||
}
|
||||
return false;
|
||||
} else if (groups.length > 2 && groups[2].startsWith("!spellOnStack=")) {
|
||||
} else if (groups[2].startsWith("!spellOnStack=")) {
|
||||
String spellNotOnStack = groups[2].substring(14);
|
||||
for (StackObject stackObject: game.getStack()) {
|
||||
if (stackObject.getStackAbility().toString().contains(spellNotOnStack)) {
|
||||
|
|
@ -539,12 +539,7 @@ public class TestPlayer extends ComputerPlayer {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkSpellOnTopOfStackCondition(String[] groups, Game game) {
|
||||
if (groups.length > 2 && groups[2].startsWith("spellOnTopOfStack=")) {
|
||||
} else if (groups[2].startsWith("spellOnTopOfStack=")) {
|
||||
String spellOnTopOFStack = groups[2].substring(18);
|
||||
if (game.getStack().size() > 0) {
|
||||
StackObject stackObject = game.getStack().getFirst();
|
||||
|
|
@ -553,15 +548,33 @@ public class TestPlayer extends ComputerPlayer {
|
|||
}
|
||||
}
|
||||
return false;
|
||||
} else if (groups[2].startsWith("manaInPool=")) {
|
||||
String manaInPool = groups[2].substring(11);
|
||||
int amountOfMana = Integer.parseUnsignedInt(manaInPool);
|
||||
return this.getManaPool().getMana().count() >= amountOfMana;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// private boolean checkSpellOnTopOfStackCondition(String[] groups, Game game) {
|
||||
// if (groups.length > 2 && groups[2].startsWith("spellOnTopOfStack=")) {
|
||||
// String spellOnTopOFStack = groups[2].substring(18);
|
||||
// if (game.getStack().size() > 0) {
|
||||
// StackObject stackObject = game.getStack().getFirst();
|
||||
// if (stackObject != null && stackObject.getStackAbility().toString().contains(spellOnTopOFStack)) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
private boolean addTargets(Ability ability, String[] groups, Game game) {
|
||||
boolean result = true;
|
||||
for (int i = 1; i < groups.length; i++) {
|
||||
String group = groups[i];
|
||||
if (group.startsWith("spellOnStack") || group.startsWith("spellOnTopOfStack") || group.startsWith("!spellOnStack") || group.startsWith("target=null") ) {
|
||||
if (group.startsWith("spellOnStack") || group.startsWith("spellOnTopOfStack") || group.startsWith("!spellOnStack") || group.startsWith("target=null") || group.startsWith("manaInPool=")) {
|
||||
break;
|
||||
}
|
||||
if (ability instanceof SpellAbility && ((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
|
||||
|
|
|
|||
|
|
@ -723,6 +723,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$targetPlayer=" + target.getName());
|
||||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, Player target, int manaInPool) {
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$targetPlayer=" + target.getName() + "$manaInPool=" + manaInPool);
|
||||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName) {
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$target=" + targetName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue