From 0ef003a4a700cf1ee4e217e7390a45ae1b133090 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Tue, 23 Apr 2019 17:58:34 +0400 Subject: [PATCH] Fixed Awakening of Vitu-Ghazi that it doesn't change the name of the land it is cast on --- .../mage/cards/a/AwakeningOfVituGhazi.java | 2 +- .../BecomesCreatureTargetEffect.java | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AwakeningOfVituGhazi.java b/Mage.Sets/src/mage/cards/a/AwakeningOfVituGhazi.java index 87ebb62be1..b7b2b87c67 100644 --- a/Mage.Sets/src/mage/cards/a/AwakeningOfVituGhazi.java +++ b/Mage.Sets/src/mage/cards/a/AwakeningOfVituGhazi.java @@ -28,7 +28,7 @@ public final class AwakeningOfVituGhazi extends CardImpl { // Put nine +1/+1 counters on target land you control. It becomes a legendary 0/0 Elemental creature with haste named Vitu-Ghazi. It's still a land. this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(9))); this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect( - new AwakeningOfVituGhaziToken(), false, true, Duration.Custom + new AwakeningOfVituGhaziToken(), false, true, Duration.Custom, true ).setText("It becomes a legendary 0/0 Elemental creature with haste named Vitu-Ghazi. It's still a land.")); this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND)); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java index b54244b30a..97d55d1aa0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java @@ -20,25 +20,34 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { protected Token token; protected boolean loseAllAbilities; protected boolean addStillALandText; + protected boolean loseName; + + + public BecomesCreatureTargetEffect(Token token, boolean loseAllAbilities, boolean stillALand, Duration duration) { + this(token, loseAllAbilities, stillALand, duration, false); + } /** * @param token * @param loseAllAbilities loses all subtypes and colors * @param stillALand add rule text, "it's still a land" + * @param loseName permanent lose name and get's it from token * @param duration */ - public BecomesCreatureTargetEffect(Token token, boolean loseAllAbilities, boolean stillALand, Duration duration) { + public BecomesCreatureTargetEffect(Token token, boolean loseAllAbilities, boolean stillALand, Duration duration, boolean loseName) { super(duration, Outcome.BecomeCreature); this.token = token; this.loseAllAbilities = loseAllAbilities; this.addStillALandText = stillALand; + this.loseName = loseName; } public BecomesCreatureTargetEffect(final BecomesCreatureTargetEffect effect) { super(effect); - token = effect.token.copy(); + this.token = effect.token.copy(); this.loseAllAbilities = effect.loseAllAbilities; this.addStillALandText = effect.addStillALandText; + this.loseName = effect.loseName; } @Override @@ -53,6 +62,13 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { switch (layer) { + case TextChangingEffects_3: + if (sublayer == SubLayer.NA) { + if (loseName) { + permanent.setName(token.getName()); + } + } + break; case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { if (loseAllAbilities) { @@ -125,7 +141,11 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { @Override public boolean hasLayer(Layer layer) { - return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4; + return layer == Layer.PTChangingEffects_7 + || layer == Layer.AbilityAddingRemovingEffects_6 + || layer == Layer.ColorChangingEffects_5 + || layer == Layer.TypeChangingEffects_4 + || layer == Layer.TextChangingEffects_3; } @Override