mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
- Added CounterCardPredicate. Used it for Rift Elemental and Fury Charm.
This commit is contained in:
parent
892e1fba92
commit
3c0a3c41b0
3 changed files with 38 additions and 5 deletions
|
@ -35,7 +35,6 @@ import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.ActivatedAbility;
|
import mage.abilities.ActivatedAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.Cost;
|
|
||||||
import mage.abilities.costs.CostImpl;
|
import mage.abilities.costs.CostImpl;
|
||||||
import mage.abilities.costs.common.RemoveCounterCost;
|
import mage.abilities.costs.common.RemoveCounterCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
@ -55,8 +54,8 @@ import mage.counters.Counter;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.predicate.mageobject.AbilityPredicate;
|
import mage.filter.predicate.mageobject.AbilityPredicate;
|
||||||
|
import mage.filter.predicate.other.CounterCardPredicate;
|
||||||
import mage.filter.predicate.other.OwnerPredicate;
|
import mage.filter.predicate.other.OwnerPredicate;
|
||||||
import mage.filter.predicate.permanent.CounterPredicate;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
@ -71,7 +70,7 @@ public class RiftElemental extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterCard("suspended card you own");
|
private static final FilterCard filter = new FilterCard("suspended card you own");
|
||||||
static {
|
static {
|
||||||
filter.add(new CounterPredicate(CounterType.TIME));
|
filter.add(new CounterCardPredicate(CounterType.TIME));
|
||||||
filter.add(new AbilityPredicate(SuspendAbility.class));
|
filter.add(new AbilityPredicate(SuspendAbility.class));
|
||||||
filter.add(new OwnerPredicate(TargetController.YOU));
|
filter.add(new OwnerPredicate(TargetController.YOU));
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ import mage.constants.Rarity;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.predicate.mageobject.AbilityPredicate;
|
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.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
@ -65,7 +65,7 @@ public class FuryCharm extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterCard("suspended card");
|
private static final FilterCard filter = new FilterCard("suspended card");
|
||||||
static {
|
static {
|
||||||
filter.add(new CounterPredicate(CounterType.TIME));
|
filter.add(new CounterCardPredicate(CounterType.TIME));
|
||||||
filter.add(new AbilityPredicate(SuspendAbility.class));
|
filter.add(new AbilityPredicate(SuspendAbility.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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() + ')';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue