mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
refactored TokenPredicate to contain its own inverse
This commit is contained in:
parent
cb5d873fea
commit
bdeb0dde66
180 changed files with 196 additions and 310 deletions
|
|
@ -33,7 +33,7 @@ public class PopulateEffect extends OneShotEffect {
|
|||
private static final FilterPermanent filter = new FilterCreaturePermanent("creature token for populate");
|
||||
|
||||
static {
|
||||
filter.add(TokenPredicate.instance);
|
||||
filter.add(TokenPredicate.TRUE);
|
||||
filter.add(TargetController.YOU.getControllerPredicate());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -689,14 +689,14 @@ public final class StaticFilters {
|
|||
public static final FilterCreaturePermanent FILTER_CREATURE_TOKEN = new FilterCreaturePermanent("creature token");
|
||||
|
||||
static {
|
||||
FILTER_CREATURE_TOKEN.add(TokenPredicate.instance);
|
||||
FILTER_CREATURE_TOKEN.add(TokenPredicate.TRUE);
|
||||
FILTER_CREATURE_TOKEN.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterCreaturePermanent FILTER_CREATURE_TOKENS = new FilterCreaturePermanent("creature tokens");
|
||||
|
||||
static {
|
||||
FILTER_CREATURE_TOKENS.add(TokenPredicate.instance);
|
||||
FILTER_CREATURE_TOKENS.add(TokenPredicate.TRUE);
|
||||
FILTER_CREATURE_TOKENS.setLockedFilter(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.filter.predicate.permanent;
|
||||
|
||||
import mage.filter.predicate.Predicate;
|
||||
|
|
@ -10,15 +9,21 @@ import mage.game.permanent.PermanentToken;
|
|||
* @author North
|
||||
*/
|
||||
public enum TokenPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
TRUE(true),
|
||||
FALSE(false);
|
||||
private final boolean value;
|
||||
|
||||
TokenPredicate(boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
return input instanceof PermanentToken;
|
||||
return value == input instanceof PermanentToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Token";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import mage.abilities.common.LeavesBattlefieldAllTriggeredAbility;
|
|||
import mage.abilities.effects.common.discard.DiscardControllerEffect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.game.command.Emblem;
|
||||
|
||||
|
|
@ -18,7 +17,7 @@ public final class AurraSingBaneOfJediEmblem extends Emblem {
|
|||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a nontoken creature you control");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(TokenPredicate.instance));
|
||||
filter.add(TokenPredicate.FALSE);
|
||||
}
|
||||
|
||||
// Whenever a nontoken creature you control leaves the battlefied, discard a card.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue