From cfdae6ee9dcd1c067d14283a40dba9618a5e583c Mon Sep 17 00:00:00 2001 From: ssouders412 Date: Fri, 27 Dec 2019 10:34:27 -0500 Subject: [PATCH] Fixed Fae of Wishes//Granted, added Noncreature card filter Updated Drekavac and Entomber Exarch to use the new filter. --- Mage.Sets/src/mage/cards/d/Drekavac.java | 12 ++------ .../src/mage/cards/e/EntomberExarch.java | 11 +------ Mage.Sets/src/mage/cards/f/FaeOfWishes.java | 2 +- .../main/java/mage/filter/StaticFilters.java | 18 +++++++++++ .../filter/common/FilterNoncreatureCard.java | 30 +++++++++++++++++++ 5 files changed, 52 insertions(+), 21 deletions(-) create mode 100644 Mage/src/main/java/mage/filter/common/FilterNoncreatureCard.java diff --git a/Mage.Sets/src/mage/cards/d/Drekavac.java b/Mage.Sets/src/mage/cards/d/Drekavac.java index 042d0e25f1..2fc28ff177 100644 --- a/Mage.Sets/src/mage/cards/d/Drekavac.java +++ b/Mage.Sets/src/mage/cards/d/Drekavac.java @@ -10,9 +10,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.filter.FilterCard; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.StaticFilters; import mage.target.common.TargetCardInHand; /** @@ -22,12 +20,6 @@ import mage.target.common.TargetCardInHand; */ public final class Drekavac extends CardImpl { - private static final FilterCard filter = new FilterCard("noncreature card"); - - static { - filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); - } - public Drekavac(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}"); this.subtype.add(SubType.BEAST); @@ -35,7 +27,7 @@ public final class Drekavac extends CardImpl { this.toughness = new MageInt(3); // When Drekavac enters the battlefield, sacrifice it unless you discard a noncreature card. - this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new DiscardTargetCost(new TargetCardInHand(filter))))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new DiscardTargetCost(new TargetCardInHand(StaticFilters.FILTER_CARD_A_NON_CREATURE))))); } public Drekavac(final Drekavac card) { diff --git a/Mage.Sets/src/mage/cards/e/EntomberExarch.java b/Mage.Sets/src/mage/cards/e/EntomberExarch.java index 839aaf8fe7..f424b55ff6 100644 --- a/Mage.Sets/src/mage/cards/e/EntomberExarch.java +++ b/Mage.Sets/src/mage/cards/e/EntomberExarch.java @@ -14,10 +14,7 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; import mage.constants.Zone; -import mage.filter.FilterCard; import mage.filter.StaticFilters; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.players.Player; import mage.target.TargetCard; @@ -60,12 +57,6 @@ public final class EntomberExarch extends CardImpl { class EntomberExarchEffect extends OneShotEffect { - private static final FilterCard filter = new FilterCard("noncreature card"); - - static { - filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); - } - EntomberExarchEffect() { super(Outcome.Discard); staticText = "target opponent reveals their hand, you choose a noncreature card from it, then that player discards that card"; @@ -82,7 +73,7 @@ class EntomberExarchEffect extends OneShotEffect { player.revealCards("Entomber Exarch", player.getHand(), game); Player you = game.getPlayer(source.getControllerId()); if (you != null) { - TargetCard target = new TargetCard(Zone.HAND, filter); + TargetCard target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD_A_NON_CREATURE); if (you.choose(Outcome.Benefit, player.getHand(), target, game)) { Card card = player.getHand().get(target.getFirstTarget(), game); return player.discard(card, source, game); diff --git a/Mage.Sets/src/mage/cards/f/FaeOfWishes.java b/Mage.Sets/src/mage/cards/f/FaeOfWishes.java index 94ef462134..2c5ad0bdba 100644 --- a/Mage.Sets/src/mage/cards/f/FaeOfWishes.java +++ b/Mage.Sets/src/mage/cards/f/FaeOfWishes.java @@ -42,7 +42,7 @@ public final class FaeOfWishes extends AdventureCard { // Granted // You may choose a noncreature card you own from outside the game, reveal it, and put it into your hand. - this.getSpellCard().getSpellAbility().addEffect(new WishEffect(StaticFilters.FILTER_CARD_A_NON_LAND)); + this.getSpellCard().getSpellAbility().addEffect(new WishEffect(StaticFilters.FILTER_CARD_A_NON_CREATURE)); } private FaeOfWishes(final FaeOfWishes card) { diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java index 68097a1fa2..7ee3a2caa2 100644 --- a/Mage/src/main/java/mage/filter/StaticFilters.java +++ b/Mage/src/main/java/mage/filter/StaticFilters.java @@ -110,6 +110,24 @@ public final class StaticFilters { FILTER_CARD_FROM_YOUR_GRAVEYARD.setLockedFilter(true); } + public static final FilterNoncreatureCard FILTER_CARD_NON_CREATURE = new FilterNoncreatureCard(); + + static { + FILTER_CARD_NON_CREATURE.setLockedFilter(true); + } + + public static final FilterNoncreatureCard FILTER_CARD_A_NON_CREATURE = new FilterNoncreatureCard("a noncreature card"); + + static { + FILTER_CARD_A_NON_CREATURE.setLockedFilter(true); + } + + public static final FilterNoncreatureCard FILTER_CARDS_NON_CREATURE = new FilterNoncreatureCard("noncreature cards"); + + static { + FILTER_CARDS_NON_CREATURE.setLockedFilter(true); + } + public static final FilterLandCard FILTER_CARD_LAND = new FilterLandCard(); static { diff --git a/Mage/src/main/java/mage/filter/common/FilterNoncreatureCard.java b/Mage/src/main/java/mage/filter/common/FilterNoncreatureCard.java new file mode 100644 index 0000000000..c3c3766187 --- /dev/null +++ b/Mage/src/main/java/mage/filter/common/FilterNoncreatureCard.java @@ -0,0 +1,30 @@ +package mage.filter.common; + +import mage.constants.CardType; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; + +/** + * @author ssouders412 + */ +public class FilterNoncreatureCard extends FilterCard { + + public FilterNoncreatureCard() { + this("noncreature card"); + } + + public FilterNoncreatureCard(String name) { + super(name); + this.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); + } + + public FilterNoncreatureCard(final FilterNoncreatureCard filter) { + super(filter); + } + + @Override + public FilterNoncreatureCard copy() { + return new FilterNoncreatureCard(this); + } +}