Moved predicate to framework.

This commit is contained in:
LevelX2 2018-08-15 10:47:31 +02:00
parent 4cce091dc2
commit 9545ab055d
2 changed files with 37 additions and 26 deletions

View file

@ -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;
/**
*
@ -29,7 +25,6 @@ public final class SecretsOfTheDead extends CardImpl {
public SecretsOfTheDead(UUID ownerId, CardSetInfo setInfo) {
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<StackObject> {
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 + ')';
}
}

View file

@ -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<StackObject> {
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 + ')';
}
}