mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 23:12:10 -08:00
finally made DustOfMoments to work, CounterPredicate didn't see counters for Chronozoa (permanent). why the hell is PermanentImpl.getCounters() and CardImpl.getCounters(game) don't return the same value for the same card
This commit is contained in:
parent
45e269de77
commit
afe9c27aa5
3 changed files with 225 additions and 18 deletions
|
|
@ -0,0 +1,36 @@
|
|||
package mage.filter.predicate.permanent;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* Created by glerman on 3/7/15.
|
||||
*/
|
||||
public class CardCounterPredicate implements Predicate<Card>{
|
||||
|
||||
private final CounterType counter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param counter if null any counter selects the permanent
|
||||
*/
|
||||
public CardCounterPredicate(CounterType counter) {
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Card input, Game game) {
|
||||
if (counter == null) {
|
||||
return !input.getCounters(game).keySet().isEmpty();
|
||||
} else {
|
||||
return input.getCounters(game).containsKey(counter);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CounterType(" + counter.getName() + ')';
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue