diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/ThePrincessTakesFlightTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/ThePrincessTakesFlightTest.java index 5fe5879fa96..8ff3950a316 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/ThePrincessTakesFlightTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/ThePrincessTakesFlightTest.java @@ -79,4 +79,73 @@ public class ThePrincessTakesFlightTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Memnite", 1); assertGraveyardCount(playerA, flight, 1); } + + @Test + public void test_TokenCopy() { + addCard(Zone.HAND, playerA, flight, 1); + addCard(Zone.HAND, playerA, "Swords to Plowshares", 1); + addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1); + addCard(Zone.BATTLEFIELD, playerA, "Ondu Spiritdancer", 1); + addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, flight); + setChoice(playerA, "I - "); + addTarget(playerA, "Memnite"); + setChoice(playerA, true); + addTarget(playerA, "Grizzly Bears"); + + checkExileCount("after I, exiled Memnite", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Memnite", 1); + checkExileCount("after I, exiled Grizzly Bears", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Grizzly Bears", 1); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Swords to Plowshares", "Ondu Spiritdancer"); + + // turn 3 + setChoice(playerA, "II - "); + // No targets available + + // turn 5 + setChoice(playerA, "III - "); + setStrictChooseMode(true); + setStopAt(5, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertExileCount(playerA, "Grizzly Bears", 0); + assertExileCount(playerB, "Memnite", 0); + assertPermanentCount(playerA, "Grizzly Bears", 1); + assertPermanentCount(playerB, "Memnite", 1); + } + @Test + public void test_SpellCopy() { + addCard(Zone.HAND, playerA, flight, 1); + addCard(Zone.HAND, playerA, "Swords to Plowshares", 1); + addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1); + addCard(Zone.BATTLEFIELD, playerA, "The Sixth Doctor", 1); + addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, flight); + addTarget(playerA, "Memnite"); + addTarget(playerA, "Grizzly Bears"); + + checkExileCount("after I, exiled Memnite", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Memnite", 1); + checkExileCount("after I, exiled Grizzly Bears", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Grizzly Bears", 1); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Swords to Plowshares", "The Sixth Doctor"); + + // turn 3 + setChoice(playerA, "II - "); + // No targets available + + // turn 5 + setChoice(playerA, "III - "); + setStrictChooseMode(true); + setStopAt(5, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertExileCount(playerA, "Grizzly Bears", 0); + assertExileCount(playerB, "Memnite", 0); + assertPermanentCount(playerA, "Grizzly Bears", 1); + assertPermanentCount(playerB, "Memnite", 1); + } } diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index dd566fe4834..8b16d1a2078 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -33,6 +33,7 @@ import mage.game.events.BatchEvent; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentToken; import mage.game.stack.Spell; import mage.game.stack.StackAbility; import mage.players.Player; @@ -1707,13 +1708,15 @@ public abstract class AbilityImpl implements Ability { private int getCurrentSourceObjectZoneChangeCounter(Game game){ int zcc = game.getState().getZoneChangeCounter(getSourceId()); - if (game.getPermanentEntering(getSourceId()) != null){ + Permanent p = game.getPermanentEntering(getSourceId()); + if (p != null && !(p instanceof PermanentToken)){ // If the triggered ability triggered while the permanent is entering the battlefield // then add 1 zcc so that it triggers as if the permanent was already on the battlefield // So "Enters with counters" causes "Whenever counters are placed" to trigger with battlefield zcc // Particularly relevant for Sagas, which always involve both // Note that this does NOT apply to "As ~ ETB" effects, those still use the stack zcc zcc += 1; + // However, tokens don't change their zcc upon entering the battlefield, so don't add for them } return zcc; }