mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
fixed interactions between effects which replace a token and effects which care about tokens after they've been made
This commit is contained in:
parent
0540557455
commit
676c3a8bb4
2 changed files with 31 additions and 7 deletions
|
@ -9,7 +9,6 @@ import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author luziferius
|
* @author luziferius
|
||||||
*/
|
*/
|
||||||
public class DivineVisitationTest extends CardTestPlayerBase {
|
public class DivineVisitationTest extends CardTestPlayerBase {
|
||||||
|
@ -35,11 +34,11 @@ public class DivineVisitationTest extends CardTestPlayerBase {
|
||||||
setChoice(playerA, "Whenever an opponent draws a card", 2); // choose order of triggers
|
setChoice(playerA, "Whenever an opponent draws a card", 2); // choose order of triggers
|
||||||
setChoice(playerB, false, 3); // Decline to pay 2
|
setChoice(playerB, false, 3); // Decline to pay 2
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
setStrictChooseMode(true);
|
setStrictChooseMode(true);
|
||||||
execute();
|
execute();
|
||||||
assertAllCommandsUsed();
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
assertHandCount(playerB, 3);
|
assertHandCount(playerB, 3);
|
||||||
assertPermanentCount(playerA, "Treasure Token", 3);
|
assertPermanentCount(playerA, "Treasure Token", 3);
|
||||||
assertType("Treasure Token", CardType.ARTIFACT, SubType.TREASURE);
|
assertType("Treasure Token", CardType.ARTIFACT, SubType.TREASURE);
|
||||||
|
@ -62,7 +61,7 @@ public class DivineVisitationTest extends CardTestPlayerBase {
|
||||||
addCard(Zone.HAND, playerA, "Dragon Fodder");
|
addCard(Zone.HAND, playerA, "Dragon Fodder");
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dragon Fodder");
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dragon Fodder");
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
setStrictChooseMode(true);
|
setStrictChooseMode(true);
|
||||||
execute();
|
execute();
|
||||||
assertAllCommandsUsed();
|
assertAllCommandsUsed();
|
||||||
|
@ -74,8 +73,25 @@ public class DivineVisitationTest extends CardTestPlayerBase {
|
||||||
assertType("Angel Token", CardType.CREATURE, SubType.ANGEL);
|
assertType("Angel Token", CardType.CREATURE, SubType.ANGEL);
|
||||||
assertColor(playerA, "Angel Token", ObjectColor.WHITE, true);
|
assertColor(playerA, "Angel Token", ObjectColor.WHITE, true);
|
||||||
assertColor(playerA, "Angel Token", ObjectColor.RED, false);
|
assertColor(playerA, "Angel Token", ObjectColor.RED, false);
|
||||||
assertPowerToughness(playerA, "Angel Token", 4,4);
|
assertPowerToughness(playerA, "Angel Token", 4, 4);
|
||||||
assertNotSubtype("Angel Token", SubType.GOBLIN);
|
assertNotSubtype("Angel Token", SubType.GOBLIN);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Test
|
||||||
|
public void testSacrificeEOT() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Divine Visitation");
|
||||||
|
addCard(Zone.HAND, playerA, "Thatcher Revolt");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Thatcher Revolt");
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Human Token", 0);
|
||||||
|
assertPermanentCount(playerA, "Angel Token", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -238,6 +238,14 @@ public abstract class TokenImpl extends MageObjectImpl implements Token {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putOntoBattlefieldHelper(event, game, source, tapped, attacking, attackedPlayer, created);
|
putOntoBattlefieldHelper(event, game, source, tapped, attacking, attackedPlayer, created);
|
||||||
|
event.getTokens()
|
||||||
|
.keySet()
|
||||||
|
.stream()
|
||||||
|
.map(Token::getLastAddedTokenIds)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.distinct()
|
||||||
|
.filter(uuid -> !this.lastAddedTokenIds.contains(uuid))
|
||||||
|
.forEach(this.lastAddedTokenIds::add);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue