forked from External/mage
43 lines
No EOL
1.2 KiB
Java
43 lines
No EOL
1.2 KiB
Java
/*
|
|
* 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.abilities.condition.common;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.condition.Condition;
|
|
import mage.constants.CardType;
|
|
import mage.filter.FilterCard;
|
|
import mage.filter.predicate.Predicates;
|
|
import mage.filter.predicate.mageobject.CardTypePredicate;
|
|
import mage.game.Game;
|
|
import mage.players.Player;
|
|
|
|
/**
|
|
*
|
|
* @author LevelX2
|
|
*/
|
|
|
|
public enum SpellMasteryCondition implements Condition {
|
|
|
|
instance;
|
|
private static final FilterCard filter = new FilterCard();
|
|
|
|
static {
|
|
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
|
|
}
|
|
|
|
@Override
|
|
public boolean apply(Game game, Ability source) {
|
|
Player player = game.getPlayer(source.getControllerId());
|
|
return player != null && player.getGraveyard().count(filter, game) >= 2;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "there are two or more instant and/or sorcery cards in your graveyard";
|
|
}
|
|
|
|
|
|
} |