- Added CounterCardPredicate. Used it for Rift Elemental and Fury Charm.

This commit is contained in:
Jeff 2015-03-08 12:49:04 -05:00
parent 892e1fba92
commit 3c0a3c41b0
3 changed files with 38 additions and 5 deletions

View file

@ -35,7 +35,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.common.RemoveCounterCost;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -55,8 +54,8 @@ import mage.counters.Counter;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.other.CounterCardPredicate;
import mage.filter.predicate.other.OwnerPredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
@ -71,7 +70,7 @@ public class RiftElemental extends CardImpl {
private static final FilterCard filter = new FilterCard("suspended card you own");
static {
filter.add(new CounterPredicate(CounterType.TIME));
filter.add(new CounterCardPredicate(CounterType.TIME));
filter.add(new AbilityPredicate(SuspendAbility.class));
filter.add(new OwnerPredicate(TargetController.YOU));
}

View file

@ -49,7 +49,7 @@ import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.filter.predicate.other.CounterCardPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
@ -65,7 +65,7 @@ public class FuryCharm extends CardImpl {
private static final FilterCard filter = new FilterCard("suspended card");
static {
filter.add(new CounterPredicate(CounterType.TIME));
filter.add(new CounterCardPredicate(CounterType.TIME));
filter.add(new AbilityPredicate(SuspendAbility.class));
}

View file

@ -0,0 +1,34 @@
/*
* 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.cards.Card;
import mage.counters.CounterType;
import mage.filter.predicate.Predicate;
import mage.game.Game;
/**
*
* @author jeffwadsworth
*/
public class CounterCardPredicate implements Predicate<Card> {
private final CounterType counter;
public CounterCardPredicate(CounterType counter) {
this.counter = counter;
}
@Override
public boolean apply(Card input, Game game) {
return input.getCounters(game).containsKey(counter);
}
@Override
public String toString() {
return "CounterType(" + counter.getName() + ')';
}
}