From a21496ef5f544971dfd294ed8fa9bd98e7fc55f0 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 28 May 2018 14:08:13 -0400 Subject: [PATCH] Fixed Will Kenrith first ability duration and second ability not working --- Mage.Sets/src/mage/cards/w/WillKenrith.java | 13 +++++-------- .../common/cost/SpellsCostReductionAllEffect.java | 11 +++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Mage.Sets/src/mage/cards/w/WillKenrith.java b/Mage.Sets/src/mage/cards/w/WillKenrith.java index ce133b91d6b..bb40bd41edb 100644 --- a/Mage.Sets/src/mage/cards/w/WillKenrith.java +++ b/Mage.Sets/src/mage/cards/w/WillKenrith.java @@ -32,7 +32,6 @@ import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.CanBeYourCommanderAbility; import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; -import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardTargetEffect; @@ -51,7 +50,6 @@ import mage.constants.Outcome; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.command.emblems.WillKenrithEmblem; import mage.target.TargetPlayer; @@ -72,11 +70,11 @@ public class WillKenrith extends CardImpl { // +2: Until your next turn, up to two target creatures each have base power and toughness 0/3 and lose all abilities. Ability ability = new LoyaltyAbility( - new SetPowerToughnessTargetEffect(0, 3, Duration.EndOfTurn) - .setText("until end of turn, up to two target creatures each have base power and toughness 0/3"), + new SetPowerToughnessTargetEffect(0, 3, Duration.UntilYourNextTurn) + .setText("until your next turn, up to two target creatures each have base power and toughness 0/3"), 2 ); - ability.addEffect(new LoseAllAbilitiesTargetEffect(Duration.EndOfTurn) + ability.addEffect(new LoseAllAbilitiesTargetEffect(Duration.UntilYourNextTurn) .setText("and lose all abilities") ); ability.addTarget(new TargetCreaturePermanent(0, 2)); @@ -144,10 +142,9 @@ class WillKenrithCostReductionEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - FilterCard filter2 = filter.copy(); - filter2.add(new ControllerIdPredicate(source.getFirstTarget())); - ContinuousEffect effect = new SpellsCostReductionAllEffect(filter2, 2); + SpellsCostReductionAllEffect effect = new SpellsCostReductionAllEffect(filter, 2); effect.setDuration(Duration.UntilYourNextTurn); + effect.setControllerId(source.getFirstTarget()); game.addEffect(effect, source); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java index 3f079002389..dcd2bea04d2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java @@ -29,6 +29,7 @@ package mage.abilities.effects.common.cost; import java.util.LinkedHashSet; import java.util.Set; +import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.ActivatedAbility; @@ -54,6 +55,7 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { private int amount; private final boolean upTo; private boolean onlyControlled; + private UUID controllerId; public SpellsCostReductionAllEffect(int amount) { this(new FilterCard("Spells"), amount); @@ -74,6 +76,7 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { this.upTo = upTo; this.onlyControlled = onlyControlled; this.staticText = filter.getMessage() + " cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast"; + this.controllerId = null; } protected SpellsCostReductionAllEffect(final SpellsCostReductionAllEffect effect) { @@ -82,6 +85,7 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { this.amount = effect.amount; this.upTo = effect.upTo; this.onlyControlled = effect.onlyControlled; + this.controllerId = effect.controllerId; } @Override @@ -145,6 +149,9 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { if (onlyControlled && !abilityToModify.getControllerId().equals(source.getControllerId())) { return false; } + if (controllerId != null && !abilityToModify.getControllerId().equals(controllerId)) { + return false; + } if (abilityToModify instanceof SpellAbility) { Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId()); if (spell != null) { @@ -158,6 +165,10 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { return false; } + public void setControllerId(UUID controllerId) { + this.controllerId = controllerId; + } + @Override public SpellsCostReductionAllEffect copy() { return new SpellsCostReductionAllEffect(this);