From 4e3961a819f7ce693046f221e78a72af9150e67a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 9 Jun 2018 14:51:07 -0400 Subject: [PATCH] Updated some targets and filters --- Mage.Sets/src/mage/cards/e/EnergyTap.java | 3 +-- .../src/mage/cards/r/RecurringNightmare.java | 20 +++++++++---------- Mage.Sets/src/mage/cards/s/SpikeRogue.java | 5 ++--- .../src/main/java/mage/filter/FilterCard.java | 2 +- .../src/main/java/mage/filter/FilterImpl.java | 2 +- .../java/mage/filter/FilterPermanent.java | 2 +- .../java/mage/filter/FilterStackObject.java | 4 ++-- .../java/mage/target/TargetPermanent.java | 6 +++--- .../TargetControlledCreaturePermanent.java | 10 +++++----- .../common/TargetControlledPermanent.java | 7 +++---- 10 files changed, 28 insertions(+), 33 deletions(-) diff --git a/Mage.Sets/src/mage/cards/e/EnergyTap.java b/Mage.Sets/src/mage/cards/e/EnergyTap.java index 0fd2502cc2..ef1aaadbf8 100644 --- a/Mage.Sets/src/mage/cards/e/EnergyTap.java +++ b/Mage.Sets/src/mage/cards/e/EnergyTap.java @@ -1,4 +1,3 @@ - package mage.cards.e; import java.util.UUID; @@ -23,7 +22,7 @@ import mage.target.common.TargetControlledCreaturePermanent; */ public final class EnergyTap extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you crontrol"); + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); static { filter.add(Predicates.not(new TappedPredicate())); diff --git a/Mage.Sets/src/mage/cards/r/RecurringNightmare.java b/Mage.Sets/src/mage/cards/r/RecurringNightmare.java index f7cbaa78ac..2c6b3a90b7 100644 --- a/Mage.Sets/src/mage/cards/r/RecurringNightmare.java +++ b/Mage.Sets/src/mage/cards/r/RecurringNightmare.java @@ -1,6 +1,6 @@ - package mage.cards.r; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.ActivateAsSorceryActivatedAbility; import mage.abilities.costs.common.ReturnToHandFromBattlefieldSourceCost; @@ -10,28 +10,26 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreatureCard; +import mage.filter.StaticFilters; import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetControlledPermanent; -import java.util.UUID; - /** * * @author jeffwadsworth */ public final class RecurringNightmare extends CardImpl { - private static final FilterCreatureCard filter = new FilterCreatureCard("creature card"); - private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("creature"); - public RecurringNightmare(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}"); // Sacrifice a creature, Return Recurring Nightmare to its owner's hand: Return target creature card from your graveyard to the battlefield. Activate this ability only any time you could cast a sorcery. - Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filter2))); - ability.addTarget(new TargetCardInYourGraveyard(filter)); + Ability ability = new ActivateAsSorceryActivatedAbility( + Zone.BATTLEFIELD, + new ReturnFromGraveyardToBattlefieldTargetEffect(), + new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_CREATURE)) + ); + ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE)); ability.addCost(new ReturnToHandFromBattlefieldSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SpikeRogue.java b/Mage.Sets/src/mage/cards/s/SpikeRogue.java index 18e9739ca7..e612ab71d4 100644 --- a/Mage.Sets/src/mage/cards/s/SpikeRogue.java +++ b/Mage.Sets/src/mage/cards/s/SpikeRogue.java @@ -1,4 +1,3 @@ - package mage.cards.s; import java.util.UUID; @@ -17,7 +16,7 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; @@ -44,7 +43,7 @@ public final class SpikeRogue extends CardImpl { // {2}, Remove a +1/+1 counter from a creature you control: Put a +1/+1 counter on Spike Rogue. Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)), new GenericManaCost(2)); - ability2.addCost(new RemoveCounterCost(new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true), CounterType.P1P1)); + ability2.addCost(new RemoveCounterCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_CREATURE, true), CounterType.P1P1)); this.addAbility(ability2); } diff --git a/Mage/src/main/java/mage/filter/FilterCard.java b/Mage/src/main/java/mage/filter/FilterCard.java index 7a873eab6f..d3da298bff 100644 --- a/Mage/src/main/java/mage/filter/FilterCard.java +++ b/Mage/src/main/java/mage/filter/FilterCard.java @@ -66,7 +66,7 @@ public class FilterCard extends FilterObject { return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(card, sourceId, playerId), game); } - public void add(ObjectPlayerPredicate predicate) { + public final void add(ObjectPlayerPredicate predicate) { if (isLockedFilter()) { throw new UnsupportedOperationException("You may not modify a locked filter"); } diff --git a/Mage/src/main/java/mage/filter/FilterImpl.java b/Mage/src/main/java/mage/filter/FilterImpl.java index 7ab6e9964f..1463611553 100644 --- a/Mage/src/main/java/mage/filter/FilterImpl.java +++ b/Mage/src/main/java/mage/filter/FilterImpl.java @@ -55,7 +55,7 @@ public abstract class FilterImpl implements Filter { } @Override - public void setMessage(String message) { + public final void setMessage(String message) { if (isLockedFilter()) { throw new UnsupportedOperationException("You may not modify a locked filter"); } diff --git a/Mage/src/main/java/mage/filter/FilterPermanent.java b/Mage/src/main/java/mage/filter/FilterPermanent.java index 963334c187..e5cf7537ab 100644 --- a/Mage/src/main/java/mage/filter/FilterPermanent.java +++ b/Mage/src/main/java/mage/filter/FilterPermanent.java @@ -61,7 +61,7 @@ public class FilterPermanent extends FilterObject implements FilterIn return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(permanent, sourceId, playerId), game); } - public void add(ObjectPlayerPredicate predicate) { + public final void add(ObjectPlayerPredicate predicate) { if (isLockedFilter()) { throw new UnsupportedOperationException("You may not modify a locked filter"); } diff --git a/Mage/src/main/java/mage/filter/FilterStackObject.java b/Mage/src/main/java/mage/filter/FilterStackObject.java index f7627c2f75..8a448dc909 100644 --- a/Mage/src/main/java/mage/filter/FilterStackObject.java +++ b/Mage/src/main/java/mage/filter/FilterStackObject.java @@ -20,7 +20,7 @@ public class FilterStackObject extends FilterObject { protected List>> extraPredicates = new ArrayList<>(); public FilterStackObject() { - super("spell or ability"); + this("spell or ability"); } public FilterStackObject(String name) { @@ -40,7 +40,7 @@ public class FilterStackObject extends FilterObject { return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(stackObject, sourceId, playerId), game); } - public void add(ObjectPlayerPredicate predicate) { + public final void add(ObjectPlayerPredicate predicate) { if (isLockedFilter()) { throw new UnsupportedOperationException("You may not modify a locked filter"); } diff --git a/Mage/src/main/java/mage/target/TargetPermanent.java b/Mage/src/main/java/mage/target/TargetPermanent.java index 310badaf7d..9114df0019 100644 --- a/Mage/src/main/java/mage/target/TargetPermanent.java +++ b/Mage/src/main/java/mage/target/TargetPermanent.java @@ -1,4 +1,3 @@ - package mage.target; import java.util.HashSet; @@ -8,6 +7,7 @@ import mage.MageObject; import mage.abilities.Ability; import mage.constants.Zone; import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; @@ -20,11 +20,11 @@ public class TargetPermanent extends TargetObject { protected FilterPermanent filter; public TargetPermanent() { - this(1, 1, new FilterPermanent(), false); + this(StaticFilters.FILTER_PERMANENT); } public TargetPermanent(FilterPermanent filter) { - this(1, 1, filter, false); + this(1, filter); } public TargetPermanent(int numTargets, FilterPermanent filter) { diff --git a/Mage/src/main/java/mage/target/common/TargetControlledCreaturePermanent.java b/Mage/src/main/java/mage/target/common/TargetControlledCreaturePermanent.java index 595880577b..935d811d0a 100644 --- a/Mage/src/main/java/mage/target/common/TargetControlledCreaturePermanent.java +++ b/Mage/src/main/java/mage/target/common/TargetControlledCreaturePermanent.java @@ -1,6 +1,6 @@ - package mage.target.common; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; /** @@ -10,19 +10,19 @@ import mage.filter.common.FilterControlledCreaturePermanent; public class TargetControlledCreaturePermanent extends TargetControlledPermanent { public TargetControlledCreaturePermanent() { - this(1, 1, new FilterControlledCreaturePermanent(), false); + this(1); } public TargetControlledCreaturePermanent(int numTargets) { - this(numTargets, numTargets, new FilterControlledCreaturePermanent(), false); + this(numTargets, numTargets); } public TargetControlledCreaturePermanent(int minNumTargets, int maxNumTargets) { - this(minNumTargets, maxNumTargets, new FilterControlledCreaturePermanent(), false); + this(minNumTargets, maxNumTargets, StaticFilters.FILTER_CONTROLLED_CREATURE, false); } public TargetControlledCreaturePermanent(FilterControlledCreaturePermanent filter) { - super(1, 1, filter, false); + this(1, 1, filter, false); } public TargetControlledCreaturePermanent(int minNumTargets, int maxNumTargets, FilterControlledCreaturePermanent filter, boolean notTarget) { diff --git a/Mage/src/main/java/mage/target/common/TargetControlledPermanent.java b/Mage/src/main/java/mage/target/common/TargetControlledPermanent.java index ce3eb7a039..cbc3e687ab 100644 --- a/Mage/src/main/java/mage/target/common/TargetControlledPermanent.java +++ b/Mage/src/main/java/mage/target/common/TargetControlledPermanent.java @@ -1,7 +1,6 @@ - - package mage.target.common; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledPermanent; import mage.target.TargetPermanent; @@ -12,11 +11,11 @@ import mage.target.TargetPermanent; public class TargetControlledPermanent extends TargetPermanent { public TargetControlledPermanent() { - this(1, 1, new FilterControlledPermanent(), false); + this(1, 1, StaticFilters.FILTER_CONTROLLED_PERMANENT, false); } public TargetControlledPermanent(int numTargets) { - this(numTargets, numTargets, new FilterControlledPermanent(), false); + this(numTargets, numTargets, StaticFilters.FILTER_CONTROLLED_PERMANENT, false); } public TargetControlledPermanent(FilterControlledPermanent filter) {