From f7c354afd3b6f19c8ec332d555db39d2cd910d87 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 21 Oct 2015 17:02:51 +0200 Subject: [PATCH] * Living Lore - Fixed that it did not get the +1/+1 counters as it entered the battlefield. --- .../mage/sets/dragonsoftarkir/LivingLore.java | 29 ++++++++++--------- .../src/mage/sets/tenthedition/Clone.java | 5 ---- .../SetPowerToughnessSourceEffect.java | 19 +++++------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/LivingLore.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/LivingLore.java index 627a332ce4b..354d93ddef3 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/LivingLore.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/LivingLore.java @@ -71,7 +71,7 @@ public class LivingLore extends CardImpl { this.addAbility(new EntersBattlefieldAbility(new LivingLoreExileEffect(), "exile an instant or sorcery card from your graveyard")); // Living Lore's power and toughness are each equal to the exiled card's converted mana cost. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LivingLoreSetPowerToughnessSourceEffect())); + this.addAbility(new SimpleStaticAbility(Zone.ALL, new LivingLoreSetPowerToughnessSourceEffect())); // Whenever Living Lore deals combat damage, you may sacrifice it. If you do, you may cast the exiled card without paying its mana cost. this.addAbility(new DealsCombatDamageTriggeredAbility(new LivingLoreSacrificeEffect(), true)); @@ -106,14 +106,14 @@ class LivingLoreExileEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - MageObject sourceObject = source.getSourceObject(game); - if (sourceObject != null && controller != null){ + Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId()); + if (sourcePermanent != null && controller != null) { TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(new FilterInstantOrSorceryCard("instant or sorcery card from your graveyard")); if (controller.chooseTarget(outcome, target, source, game)) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId()) + 1); Card card = controller.getGraveyard().get(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true); + controller.moveCardsToExile(card, source, game, true, exileId, sourcePermanent.getIdName()); } } return true; @@ -126,7 +126,7 @@ class LivingLoreExileEffect extends OneShotEffect { class LivingLoreSetPowerToughnessSourceEffect extends ContinuousEffectImpl { public LivingLoreSetPowerToughnessSourceEffect() { - super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature); + super(Duration.Custom, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature); staticText = "{this}'s power and toughness are each equal to the exiled card's converted mana cost"; } @@ -141,20 +141,23 @@ class LivingLoreSetPowerToughnessSourceEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { - MageObject mageObject = source.getSourceObject(game); Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && mageObject == null && new MageObjectReference(permanent, game).refersTo(mageObject, game)) { - discard(); - return false; + int zcc = game.getState().getZoneChangeCounter(source.getSourceId()); + if (permanent == null) { + permanent = game.getPermanentEntering(source.getSourceId()); + zcc++; } - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + if (permanent == null) { + return true; + } + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), zcc); if (exileId != null) { ExileZone exileZone = game.getExile().getExileZone(exileId); if (exileZone == null) { return false; } Card exiledCard = null; - for (Card card :exileZone.getCards(game)) { + for (Card card : exileZone.getCards(game)) { exiledCard = card; break; } @@ -197,7 +200,7 @@ class LivingLoreSacrificeEffect extends OneShotEffect { ExileZone exileZone = game.getExile().getExileZone(exileId); Card exiledCard = null; if (exileZone != null) { - for (Card card :exileZone.getCards(game)) { + for (Card card : exileZone.getCards(game)) { exiledCard = card; break; } diff --git a/Mage.Sets/src/mage/sets/tenthedition/Clone.java b/Mage.Sets/src/mage/sets/tenthedition/Clone.java index 6869479699a..6fa99a23821 100644 --- a/Mage.Sets/src/mage/sets/tenthedition/Clone.java +++ b/Mage.Sets/src/mage/sets/tenthedition/Clone.java @@ -50,11 +50,6 @@ public class Clone extends CardImpl { this.toughness = new MageInt(0); // You may have Clone enter the battlefield as a copy of any creature on the battlefield. -// ; -// Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect( -// new CopyPermanentEffect(), -// "You may have {this} enter the battlefield as a copy of any creature on the battlefield", -// true)); this.addAbility(new EntersBattlefieldAbility(new CopyPermanentEffect(), true)); } diff --git a/Mage/src/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java b/Mage/src/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java index d523a5cbd06..1c2e3dbc87a 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java @@ -36,7 +36,6 @@ import mage.constants.Layer; import mage.constants.Outcome; import mage.constants.SubLayer; import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -75,19 +74,17 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { - MageObject mageObject = game.getObject(source.getSourceId()); + MageObject mageObject = game.getPermanentEntering(source.getSourceId()); if (mageObject == null) { - game.getPermanentEntering(source.getSourceId()); + if (duration.equals(Duration.Custom) || isTemporary()) { + mageObject = game.getPermanent(source.getSourceId()); + } else { + mageObject = game.getObject(source.getSourceId()); + } } if (mageObject == null) { - if (duration.equals(Duration.Custom)) { - discard(); - } - return false; - } else if (isTemporary()) { // it's somehow w - if (!(mageObject instanceof Permanent)) { - return false; - } + discard(); + return true; } if (amount != null) { int value = amount.calculate(game, source, this);