fixed interactions between effects which replace a token and effects which care about tokens after they've been made

This commit is contained in:
Evan Kranzler 2022-03-31 19:58:20 -04:00
parent 0540557455
commit 676c3a8bb4
2 changed files with 31 additions and 7 deletions

View file

@ -9,7 +9,6 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author luziferius
*/
public class DivineVisitationTest extends CardTestPlayerBase {
@ -78,4 +77,21 @@ public class DivineVisitationTest extends CardTestPlayerBase {
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);
}
}

View file

@ -238,6 +238,14 @@ public abstract class TokenImpl extends MageObjectImpl implements Token {
}
}
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 false;