forked from External/mage
Fix and test token saga zcc tracking
This commit is contained in:
parent
4683e5c05a
commit
2552dcf633
2 changed files with 73 additions and 1 deletions
|
|
@ -79,4 +79,73 @@ public class ThePrincessTakesFlightTest extends CardTestPlayerBase {
|
||||||
assertPermanentCount(playerA, "Memnite", 1);
|
assertPermanentCount(playerA, "Memnite", 1);
|
||||||
assertGraveyardCount(playerA, flight, 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import mage.game.events.BatchEvent;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.game.permanent.PermanentToken;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.game.stack.StackAbility;
|
import mage.game.stack.StackAbility;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
@ -1707,13 +1708,15 @@ public abstract class AbilityImpl implements Ability {
|
||||||
|
|
||||||
private int getCurrentSourceObjectZoneChangeCounter(Game game){
|
private int getCurrentSourceObjectZoneChangeCounter(Game game){
|
||||||
int zcc = game.getState().getZoneChangeCounter(getSourceId());
|
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
|
// 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
|
// 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
|
// So "Enters with counters" causes "Whenever counters are placed" to trigger with battlefield zcc
|
||||||
// Particularly relevant for Sagas, which always involve both
|
// Particularly relevant for Sagas, which always involve both
|
||||||
// Note that this does NOT apply to "As ~ ETB" effects, those still use the stack zcc
|
// Note that this does NOT apply to "As ~ ETB" effects, those still use the stack zcc
|
||||||
zcc += 1;
|
zcc += 1;
|
||||||
|
// However, tokens don't change their zcc upon entering the battlefield, so don't add for them
|
||||||
}
|
}
|
||||||
return zcc;
|
return zcc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue