From 57efb1000336771a0a39a3f01fc3a7948ac9e5d5 Mon Sep 17 00:00:00 2001 From: drmDev Date: Thu, 23 Mar 2017 11:21:38 -0400 Subject: [PATCH] fixing tokens exiled at end of combat - not at end step --- Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java | 2 +- .../src/mage/cards/i/InvocationOfSaintTraft.java | 2 +- Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java | 2 +- .../abilities/effects/common/CreateTokenEffect.java | 12 ++++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java b/Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java index 956bea71f3..80759f534b 100644 --- a/Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java +++ b/Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java @@ -89,7 +89,7 @@ class GeistOfSaintTraftEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && effect.apply(game, source)) { - effect.exileTokensCreatedAtNextEndStep(game, source); + effect.exileTokensCreatedAtEndOfCombat(game, source); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/i/InvocationOfSaintTraft.java b/Mage.Sets/src/mage/cards/i/InvocationOfSaintTraft.java index e0c45d5e6e..17a6278ea3 100644 --- a/Mage.Sets/src/mage/cards/i/InvocationOfSaintTraft.java +++ b/Mage.Sets/src/mage/cards/i/InvocationOfSaintTraft.java @@ -97,7 +97,7 @@ class InvocationOfSaintTraftEffect extends OneShotEffect { CreateTokenEffect effect = new CreateTokenEffect(new AngelToken(), 1, true, true); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && (effect.apply(game, source))) { - effect.exileTokensCreatedAtNextEndStep(game, source); + effect.exileTokensCreatedAtEndOfCombat(game, source); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java b/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java index 9883c36222..d9ac3f53f1 100644 --- a/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java +++ b/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java @@ -94,7 +94,7 @@ class KariZevSkyshipRaiderEffect extends OneShotEffect { CreateTokenEffect effect = new CreateTokenEffect(new RagavanToken(), 1, true, true); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && effect.apply(game, source)) { - effect.exileTokensCreatedAtNextEndStep(game, source); + effect.exileTokensCreatedAtEndOfCombat(game, source); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java index 964fa5f99d..025cebb7ac 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; @@ -124,6 +125,17 @@ public class CreateTokenEffect extends OneShotEffect { } } + public void exileTokensCreatedAtEndOfCombat(Game game, Ability source) { + for (UUID tokenId : this.getLastAddedTokenIds()) { + Permanent tokenPermanent = game.getPermanent(tokenId); + if (tokenPermanent != null) { + ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD); + exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game)); + game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source); + } + } + } + private void setText() { StringBuilder sb = new StringBuilder("create "); if (amount.toString().equals("1")) {