diff --git a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java index 76cb80c183..3d9f281655 100644 --- a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java +++ b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java @@ -1,4 +1,3 @@ - package mage.cards.a; import java.util.UUID; @@ -14,12 +13,12 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.SuperType; -import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.StaticFilters; import mage.target.TargetPermanent; import mage.target.common.TargetCardInHand; +import mage.target.targetadjustment.XTargetsAdjuster; /** * @@ -40,7 +39,7 @@ public final class AlexiZephyrMage extends CardImpl { ability.addCost(new TapSourceCost()); ability.addCost(new DiscardTargetCost(new TargetCardInHand(2, new FilterCard("two cards")))); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_CREATURES)); - ability.setTargetAdjustment(TargetAdjustment.X_TARGETS); + ability.setTargetAdjuster(XTargetsAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java index 706014033a..38462201be 100644 --- a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java +++ b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java @@ -1,4 +1,3 @@ - package mage.cards.c; import java.util.UUID; @@ -11,10 +10,10 @@ import mage.abilities.effects.common.UntapTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.StaticFilters; import mage.target.TargetPermanent; +import mage.target.targetadjustment.XTargetsAdjuster; /** * @@ -31,7 +30,7 @@ public final class CandelabraOfTawnos extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); - ability.setTargetAdjustment(TargetAdjustment.X_TARGETS); + ability.setTargetAdjuster(XTargetsAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DeepwoodElder.java b/Mage.Sets/src/mage/cards/d/DeepwoodElder.java index 2262b266e3..0acd737bac 100644 --- a/Mage.Sets/src/mage/cards/d/DeepwoodElder.java +++ b/Mage.Sets/src/mage/cards/d/DeepwoodElder.java @@ -1,4 +1,3 @@ - package mage.cards.d; import java.util.UUID; @@ -17,12 +16,12 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; -import mage.constants.TargetAdjustment; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.Target; import mage.target.TargetPermanent; +import mage.target.targetadjustment.XTargetsAdjuster; import mage.target.targetpointer.FixedTarget; /** @@ -44,7 +43,7 @@ public final class DeepwoodElder extends CardImpl { ability.addCost(new TapSourceCost()); ability.addCost(new DiscardCardCost()); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); - ability.setTargetAdjustment(TargetAdjustment.X_TARGETS); + ability.setTargetAdjuster(XTargetsAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java index 5f190e369d..7907d01b9d 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java @@ -1,4 +1,3 @@ - package mage.cards.m; import java.util.UUID; @@ -13,10 +12,10 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.StaticFilters; import mage.target.TargetPermanent; +import mage.target.targetadjustment.XTargetsAdjuster; /** * @author duncant @@ -37,7 +36,7 @@ public final class MagusOfTheCandelabra extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); - ability.setTargetAdjustment(TargetAdjustment.X_TARGETS); + ability.setTargetAdjuster(XTargetsAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/m/MishrasHelix.java b/Mage.Sets/src/mage/cards/m/MishrasHelix.java index 3a9a6d23ee..7bad595163 100644 --- a/Mage.Sets/src/mage/cards/m/MishrasHelix.java +++ b/Mage.Sets/src/mage/cards/m/MishrasHelix.java @@ -1,4 +1,3 @@ - package mage.cards.m; import java.util.UUID; @@ -11,10 +10,10 @@ import mage.abilities.effects.common.TapTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.StaticFilters; import mage.target.TargetPermanent; +import mage.target.targetadjustment.XTargetsAdjuster; /** * @@ -30,7 +29,7 @@ public final class MishrasHelix extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); - ability.setTargetAdjustment(TargetAdjustment.X_TARGETS); + ability.setTargetAdjuster(XTargetsAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/r/RunedArch.java b/Mage.Sets/src/mage/cards/r/RunedArch.java index ea9d564202..0195c1977c 100644 --- a/Mage.Sets/src/mage/cards/r/RunedArch.java +++ b/Mage.Sets/src/mage/cards/r/RunedArch.java @@ -1,4 +1,3 @@ - package mage.cards.r; import java.util.UUID; @@ -14,11 +13,11 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.ComparisonType; import mage.constants.Duration; -import mage.constants.TargetAdjustment; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.PowerPredicate; import mage.target.TargetPermanent; +import mage.target.targetadjustment.XTargetsAdjuster; /** * @@ -48,7 +47,7 @@ public final class RunedArch extends CardImpl { ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetPermanent(filter)); - ability.setTargetAdjustment(TargetAdjustment.X_TARGETS); + ability.setTargetAdjuster(XTargetsAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SynodArtificer.java b/Mage.Sets/src/mage/cards/s/SynodArtificer.java index 030b8805dd..efa906cbaa 100644 --- a/Mage.Sets/src/mage/cards/s/SynodArtificer.java +++ b/Mage.Sets/src/mage/cards/s/SynodArtificer.java @@ -1,4 +1,3 @@ - package mage.cards.s; import java.util.UUID; @@ -14,12 +13,12 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.target.TargetPermanent; +import mage.target.targetadjustment.XTargetsAdjuster; /** * @@ -46,7 +45,7 @@ public final class SynodArtificer extends CardImpl { tapEffect.setText("Tap X target noncreature artifacts."); Ability tapAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, tapEffect, new ManaCostsImpl("{X}")); tapAbility.addCost(new TapSourceCost()); - tapAbility.setTargetAdjustment(TargetAdjustment.X_TARGETS); + tapAbility.setTargetAdjuster(XTargetsAdjuster.instance); tapAbility.addTarget(new TargetPermanent(filter)); this.addAbility(tapAbility); @@ -55,7 +54,7 @@ public final class SynodArtificer extends CardImpl { untapEffect.setText("Untap X target noncreature artifacts."); Ability untapAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, untapEffect, new ManaCostsImpl("{X}")); untapAbility.addCost(new TapSourceCost()); - untapAbility.setTargetAdjustment(TargetAdjustment.X_TARGETS); + untapAbility.setTargetAdjuster(XTargetsAdjuster.instance); untapAbility.addTarget(new TargetPermanent(filter)); this.addAbility(untapAbility); } diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 9ce52e7697..29ad7b3513 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -361,12 +361,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { switch (ability.getTargetAdjustment()) { case NONE: break; - case X_TARGETS: - xValue = ability.getManaCostsToPay().getX(); - permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(xValue, permanentFilter)); - break; case X_POWER_LEQ:// Minamo Sightbender only xValue = ability.getManaCostsToPay().getX(); oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0); diff --git a/Mage/src/main/java/mage/target/targetadjustment/XTargetsAdjuster.java b/Mage/src/main/java/mage/target/targetadjustment/XTargetsAdjuster.java new file mode 100644 index 0000000000..c95f3fbbe2 --- /dev/null +++ b/Mage/src/main/java/mage/target/targetadjustment/XTargetsAdjuster.java @@ -0,0 +1,22 @@ +package mage.target.targetadjustment; + +import mage.abilities.Ability; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.target.TargetPermanent; + +/** + * + * @author TheElk801 + */ +public enum XTargetsAdjuster implements TargetAdjuster { + instance; + + @Override + public void adjustTargets(Ability ability, Game game) { + int xValue = ability.getManaCostsToPay().getX(); + FilterPermanent permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); + ability.getTargets().clear(); + ability.addTarget(new TargetPermanent(xValue, permanentFilter)); + } +}