From 9545ab055deb2b3f5157955f34f91b2e31ff2d19 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 15 Aug 2018 10:47:31 +0200 Subject: [PATCH] Moved predicate to framework. --- .../src/mage/cards/s/SecretsOfTheDead.java | 28 ++------------- .../predicate/other/SpellZonePredicate.java | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 Mage/src/main/java/mage/filter/predicate/other/SpellZonePredicate.java diff --git a/Mage.Sets/src/mage/cards/s/SecretsOfTheDead.java b/Mage.Sets/src/mage/cards/s/SecretsOfTheDead.java index 3571b8d60f..bea3c1c1eb 100644 --- a/Mage.Sets/src/mage/cards/s/SecretsOfTheDead.java +++ b/Mage.Sets/src/mage/cards/s/SecretsOfTheDead.java @@ -1,4 +1,3 @@ - package mage.cards.s; import java.util.UUID; @@ -9,10 +8,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; import mage.filter.FilterSpell; -import mage.filter.predicate.Predicate; -import mage.game.Game; -import mage.game.stack.Spell; -import mage.game.stack.StackObject; +import mage.filter.predicate.other.SpellZonePredicate; /** * @@ -27,8 +23,7 @@ public final class SecretsOfTheDead extends CardImpl { } public SecretsOfTheDead(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}"); - + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); // Whenever you cast a spell from your graveyard, draw a card. this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1), filter, false)); @@ -43,22 +38,3 @@ public final class SecretsOfTheDead extends CardImpl { return new SecretsOfTheDead(this); } } - -class SpellZonePredicate implements Predicate { - - private final Zone zone; - - public SpellZonePredicate(Zone zone) { - this.zone = zone; - } - - @Override - public boolean apply(StackObject input, Game game) { - return input instanceof Spell && ((Spell) input).getFromZone().match(zone); - } - - @Override - public String toString() { - return "SpellZone(" + zone + ')'; - } -} diff --git a/Mage/src/main/java/mage/filter/predicate/other/SpellZonePredicate.java b/Mage/src/main/java/mage/filter/predicate/other/SpellZonePredicate.java new file mode 100644 index 0000000000..b9b85b2672 --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/other/SpellZonePredicate.java @@ -0,0 +1,35 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.filter.predicate.other; + +import mage.constants.Zone; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; + +/** + * + * @author BetaSteward + */ +public class SpellZonePredicate implements Predicate { + + private final Zone zone; + + public SpellZonePredicate(Zone zone) { + this.zone = zone; + } + + @Override + public boolean apply(StackObject input, Game game) { + return input instanceof Spell && ((Spell) input).getFromZone().match(zone); + } + + @Override + public String toString() { + return "SpellZone(" + zone + ')'; + } +}