From f131fd0d129b3190dfdaaf3e90eb9e38e345721a Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Sun, 10 Jan 2021 15:30:18 -0600 Subject: [PATCH] [KHM] Tyvar Kell - Added check for zone change counters in emblem effect --- .../game/command/emblems/TyvarKellEmblem.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Mage/src/main/java/mage/game/command/emblems/TyvarKellEmblem.java b/Mage/src/main/java/mage/game/command/emblems/TyvarKellEmblem.java index 6d7e144176f..560a9483881 100644 --- a/Mage/src/main/java/mage/game/command/emblems/TyvarKellEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/TyvarKellEmblem.java @@ -15,7 +15,6 @@ import mage.game.permanent.Permanent; import mage.game.stack.Spell; import java.util.Iterator; -import java.util.UUID; /** * @@ -36,7 +35,7 @@ public final class TyvarKellEmblem extends Emblem { Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, new TyvarKellEmblemEffect( HasteAbility.getInstance(), Duration.EndOfTurn), filter, false, true ); - ability.addEffect(new DrawCardSourceControllerEffect(2).setText("and you draw two cards")); + ability.addEffect(new DrawCardSourceControllerEffect(2, "you").concatBy("and")); this.getAbilities().add(ability); } } @@ -80,16 +79,19 @@ class TyvarKellEmblemEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { if (this.affectedObjectsSet) { for (Iterator it = affectedObjectList.iterator(); it.hasNext(); ) { - UUID sourceId = it.next().getSourceId(); - Card card = game.getCard(sourceId); - Permanent perm = game.getPermanent(sourceId); + MageObjectReference mor = it.next(); + Card card = mor.getCard(game); + Permanent perm = game.getPermanent(mor.getSourceId()); + boolean applied = false; if (card != null && !card.hasAbility(ability, game)) { game.getState().addOtherAbility(card, ability); + applied = true; } - if (perm != null) { + if (perm != null && perm.getZoneChangeCounter(game) == mor.getZoneChangeCounter() + 1) { perm.addAbility(ability, source.getSourceId(), game); + applied = true; } - if (card == null && perm == null) { + if (!applied) { it.remove(); if (affectedObjectList.isEmpty()) { discard();