diff --git a/Mage.Sets/src/mage/cards/r/Recantation.java b/Mage.Sets/src/mage/cards/r/Recantation.java index 55439bab5f..1bb9a36ce3 100644 --- a/Mage.Sets/src/mage/cards/r/Recantation.java +++ b/Mage.Sets/src/mage/cards/r/Recantation.java @@ -1,6 +1,6 @@ - package mage.cards.r; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; @@ -12,14 +12,12 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TargetAdjustment; import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.FilterPermanent; import mage.target.TargetPermanent; - -import java.util.UUID; +import mage.target.targetadjustment.VerseCounterAdjuster; /** * @@ -40,7 +38,7 @@ public final class Recantation extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{U}")); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetPermanent(0, 0, new FilterPermanent("up to X target permanents, where X is the number of verse counters on {this}."), false)); - ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); + ability.setTargetAdjuster(VerseCounterAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/r/RumblingCrescendo.java b/Mage.Sets/src/mage/cards/r/RumblingCrescendo.java index 452c455ef9..931f9b6538 100644 --- a/Mage.Sets/src/mage/cards/r/RumblingCrescendo.java +++ b/Mage.Sets/src/mage/cards/r/RumblingCrescendo.java @@ -1,4 +1,3 @@ - package mage.cards.r; import java.util.UUID; @@ -13,13 +12,13 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TargetAdjustment; import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.target.TargetPermanent; +import mage.target.targetadjustment.VerseCounterAdjuster; /** * @@ -46,7 +45,7 @@ public final class RumblingCrescendo extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{R}")); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetPermanent(0, 0, filter, false)); - ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); + ability.setTargetAdjuster(VerseCounterAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SerrasLiturgy.java b/Mage.Sets/src/mage/cards/s/SerrasLiturgy.java index 5a97f18c1b..201092a0c1 100644 --- a/Mage.Sets/src/mage/cards/s/SerrasLiturgy.java +++ b/Mage.Sets/src/mage/cards/s/SerrasLiturgy.java @@ -1,4 +1,3 @@ - package mage.cards.s; import java.util.UUID; @@ -13,7 +12,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TargetAdjustment; import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; @@ -21,6 +19,7 @@ import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.target.TargetPermanent; +import mage.target.targetadjustment.VerseCounterAdjuster; /** * @@ -50,7 +49,7 @@ public final class SerrasLiturgy extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{W}")); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetPermanent(0, 0, filter, false)); - ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); + ability.setTargetAdjuster(VerseCounterAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/v/VileRequiem.java b/Mage.Sets/src/mage/cards/v/VileRequiem.java index 7bc935cc24..e602b7b6b3 100644 --- a/Mage.Sets/src/mage/cards/v/VileRequiem.java +++ b/Mage.Sets/src/mage/cards/v/VileRequiem.java @@ -1,4 +1,3 @@ - package mage.cards.v; import java.util.UUID; @@ -14,7 +13,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TargetAdjustment; import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; @@ -23,6 +21,7 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ColorPredicate; import mage.target.TargetPermanent; +import mage.target.targetadjustment.VerseCounterAdjuster; /** * @@ -50,7 +49,7 @@ public final class VileRequiem extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{B}")); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetPermanent(0, 0, filter, false)); - ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); + ability.setTargetAdjuster(VerseCounterAdjuster.instance); this.addAbility(ability); } diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 29ad7b3513..be374afd61 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -371,15 +371,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { ability.getTargets().clear(); ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); break; - case VERSE_COUNTER_TARGETS: - Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); - if (sourcePermanent != null) { - xValue = sourcePermanent.getCounters(game).getCount(CounterType.VERSE); - permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false)); - } - break; case X_CMC_EQUAL_GY_CARD: xValue = ability.getManaCostsToPay().getX(); FilterCard filterCard = ((TargetCard) ability.getTargets().get(0)).getFilter().copy(); @@ -408,7 +399,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { ability.addTarget(oldTargetPermanent); break; case TREASURE_COUNTER_POWER: //Legacy's Allure only - sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); + Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); if (sourcePermanent != null) { xValue = sourcePermanent.getCounters(game).getCount(CounterType.TREASURE); FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on {this}"); diff --git a/Mage/src/main/java/mage/target/targetadjustment/VerseCounterAdjuster.java b/Mage/src/main/java/mage/target/targetadjustment/VerseCounterAdjuster.java new file mode 100644 index 0000000000..35d1457785 --- /dev/null +++ b/Mage/src/main/java/mage/target/targetadjustment/VerseCounterAdjuster.java @@ -0,0 +1,27 @@ +package mage.target.targetadjustment; + +import mage.abilities.Ability; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; + +/** + * + * @author TheElk801 + */ +public enum VerseCounterAdjuster implements TargetAdjuster { + instance; + + @Override + public void adjustTargets(Ability ability, Game game) { + Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); + if (sourcePermanent != null) { + int xValue = sourcePermanent.getCounters(game).getCount(CounterType.VERSE); + FilterPermanent permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); + ability.getTargets().clear(); + ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false)); + } + } +}