mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Moved predicate to framework.
This commit is contained in:
parent
4cce091dc2
commit
9545ab055d
2 changed files with 37 additions and 26 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -9,10 +8,7 @@ import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterSpell;
|
import mage.filter.FilterSpell;
|
||||||
import mage.filter.predicate.Predicate;
|
import mage.filter.predicate.other.SpellZonePredicate;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.stack.Spell;
|
|
||||||
import mage.game.stack.StackObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -27,8 +23,7 @@ public final class SecretsOfTheDead extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SecretsOfTheDead(UUID ownerId, CardSetInfo setInfo) {
|
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.
|
// Whenever you cast a spell from your graveyard, draw a card.
|
||||||
this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1), filter, false));
|
this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1), filter, false));
|
||||||
|
@ -43,22 +38,3 @@ public final class SecretsOfTheDead extends CardImpl {
|
||||||
return new SecretsOfTheDead(this);
|
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 + ')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -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 + ')';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue