mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 12:31:59 -08:00
refactored many other predicates to singleton enums
This commit is contained in:
parent
dc409c9a9e
commit
8629977f14
595 changed files with 657 additions and 660 deletions
|
|
@ -34,7 +34,7 @@ public class PopulateEffect extends OneShotEffect {
|
|||
private static final FilterPermanent filter = new FilterPermanent("token for populate");
|
||||
|
||||
static {
|
||||
filter.add(new TokenPredicate());
|
||||
filter.add(TokenPredicate.instance);
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class UntapLandsEffect extends OneShotEffect {
|
|||
private static final FilterLandPermanent filter = new FilterLandPermanent("untapped lands");
|
||||
|
||||
static {
|
||||
filter.add(new TappedPredicate());
|
||||
filter.add(TappedPredicate.instance);
|
||||
}
|
||||
private final int amount;
|
||||
private final boolean upTo;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class ConspireAbility extends StaticAbility implements OptionalAdditional
|
|||
protected static final String CONSPIRE_ACTIVATION_KEY = "ConspireActivation";
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new TappedPredicate()));
|
||||
filter.add(Predicates.not(TappedPredicate.instance));
|
||||
filter.add(new SharesColorWithSourcePredicate());
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class ConvokeAbility extends SimpleStaticAbility implements AlternateMana
|
|||
private static final FilterCreaturePermanent filterUntapped = new FilterCreaturePermanent();
|
||||
|
||||
static {
|
||||
filterUntapped.add(Predicates.not(new TappedPredicate()));
|
||||
filterUntapped.add(Predicates.not(TappedPredicate.instance));
|
||||
}
|
||||
|
||||
public ConvokeAbility() {
|
||||
|
|
@ -96,7 +96,7 @@ public class ConvokeAbility extends SimpleStaticAbility implements AlternateMana
|
|||
specialAction.setSourceId(source.getSourceId());
|
||||
// create filter for possible creatures to tap
|
||||
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||
filter.add(Predicates.not(new TappedPredicate()));
|
||||
filter.add(Predicates.not(TappedPredicate.instance));
|
||||
if (unpaid.getMana().getGeneric() == 0) {
|
||||
List<ColorPredicate> colorPredicates = new ArrayList<>();
|
||||
if (unpaid.getMana().getBlack() > 0) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class CrewCost extends CostImpl {
|
|||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new TappedPredicate()));
|
||||
filter.add(Predicates.not(TappedPredicate.instance));
|
||||
}
|
||||
|
||||
private final int value;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class ImproviseAbility extends SimpleStaticAbility implements AlternateMa
|
|||
private static final FilterArtifactPermanent filterUntapped = new FilterArtifactPermanent();
|
||||
|
||||
static {
|
||||
filterUntapped.add(Predicates.not(new TappedPredicate()));
|
||||
filterUntapped.add(Predicates.not(TappedPredicate.instance));
|
||||
}
|
||||
|
||||
public ImproviseAbility() {
|
||||
|
|
@ -64,7 +64,7 @@ public class ImproviseAbility extends SimpleStaticAbility implements AlternateMa
|
|||
specialAction.setSourceId(source.getSourceId());
|
||||
// create filter for possible artifacts to tap
|
||||
FilterControlledArtifactPermanent filter = new FilterControlledArtifactPermanent();
|
||||
filter.add(Predicates.not(new TappedPredicate()));
|
||||
filter.add(Predicates.not(TappedPredicate.instance));
|
||||
Target target = new TargetControlledPermanent(1, unpaid.getMana().getGeneric(), filter, true);
|
||||
target.setTargetName("artifact to Improvise");
|
||||
specialAction.addTarget(target);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class MentorAbility extends AttacksTriggeredAbility {
|
|||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking creature with lesser power");
|
||||
|
||||
static {
|
||||
filter.add(new AttackingPredicate());
|
||||
filter.add(AttackingPredicate.instance);
|
||||
filter.add(MentorAbilityPredicate.instance);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class NinjutsuAbility extends ActivatedAbilityImpl {
|
|||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("unblocked attacker you control");
|
||||
|
||||
static {
|
||||
filter.add(new UnblockedPredicate());
|
||||
filter.add(UnblockedPredicate.instance);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ public final class StaticFilters {
|
|||
public static final FilterSpell FILTER_SPELL_A_MULTICOLORED = new FilterSpell("a multicolored spell");
|
||||
|
||||
static {
|
||||
FILTER_SPELL_A_MULTICOLORED.add(new MulticoloredPredicate());
|
||||
FILTER_SPELL_A_MULTICOLORED.add(MulticoloredPredicate.instance);
|
||||
FILTER_SPELL_A_MULTICOLORED.setLockedFilter(true);
|
||||
}
|
||||
|
||||
|
|
@ -500,14 +500,14 @@ public final class StaticFilters {
|
|||
public static final FilterCreaturePermanent FILTER_CREATURE_TOKENS = new FilterCreaturePermanent("creature tokens");
|
||||
|
||||
static {
|
||||
FILTER_CREATURE_TOKENS.add(new TokenPredicate());
|
||||
FILTER_CREATURE_TOKENS.add(TokenPredicate.instance);
|
||||
FILTER_CREATURE_TOKENS.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterCreaturePermanent FILTER_ATTACKING_CREATURES = new FilterCreaturePermanent("attacking creatures");
|
||||
|
||||
static {
|
||||
FILTER_ATTACKING_CREATURES.add(new AttackingPredicate());
|
||||
FILTER_ATTACKING_CREATURES.add(AttackingPredicate.instance);
|
||||
FILTER_ATTACKING_CREATURES.setLockedFilter(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class FilterAttackingCreature extends FilterCreaturePermanent {
|
|||
|
||||
public FilterAttackingCreature(String name) {
|
||||
super(name);
|
||||
this.add(new AttackingPredicate());
|
||||
this.add(AttackingPredicate.instance);
|
||||
}
|
||||
|
||||
public FilterAttackingCreature(final FilterAttackingCreature filter) {
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ public class FilterAttackingOrBlockingCreature extends FilterCreaturePermanent {
|
|||
public FilterAttackingOrBlockingCreature(String name) {
|
||||
super(name);
|
||||
this.add(Predicates.or(
|
||||
new AttackingPredicate(),
|
||||
new BlockingPredicate()));
|
||||
AttackingPredicate.instance,
|
||||
BlockingPredicate.instance));
|
||||
}
|
||||
|
||||
public FilterAttackingOrBlockingCreature(final FilterAttackingOrBlockingCreature filter) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class FilterBlockingCreature extends FilterCreaturePermanent {
|
|||
|
||||
public FilterBlockingCreature(String name) {
|
||||
super(name);
|
||||
this.add(new BlockingPredicate());
|
||||
this.add(BlockingPredicate.instance);
|
||||
}
|
||||
|
||||
public FilterBlockingCreature(final FilterBlockingCreature filter) {
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ public class FilterCreatureForAttack extends FilterCreaturePermanent {
|
|||
|
||||
public FilterCreatureForAttack(String name) {
|
||||
super(name);
|
||||
this.add(Predicates.not(new AttackingPredicate()));
|
||||
this.add(Predicates.not(new BlockingPredicate()));
|
||||
this.add(Predicates.not(new TappedPredicate()));
|
||||
this.add(Predicates.not(AttackingPredicate.instance));
|
||||
this.add(Predicates.not(BlockingPredicate.instance));
|
||||
this.add(Predicates.not(TappedPredicate.instance));
|
||||
this.add(Predicates.not(new AbilityPredicate(DefenderAbility.class)));
|
||||
this.add(new CanTapPredicate());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class FilterCreatureForCombat extends FilterCreatureForCombatBase {
|
|||
|
||||
public FilterCreatureForCombat(String name) {
|
||||
super(name);
|
||||
this.add(Predicates.not(new TappedPredicate()));
|
||||
this.add(Predicates.not(TappedPredicate.instance));
|
||||
}
|
||||
|
||||
public FilterCreatureForCombat(final FilterCreatureForCombat filter) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class FilterCreatureForCombatBase extends FilterCreaturePermanent {
|
|||
|
||||
public FilterCreatureForCombatBase(String name) {
|
||||
super(name);
|
||||
this.add(Predicates.not(new AttackingPredicate()));
|
||||
this.add(Predicates.not(AttackingPredicate.instance));
|
||||
this.add(new PhasedInPredicate());
|
||||
this.add(new CanBlockPredicate());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class FilterHistoricCard extends FilterCard {
|
|||
|
||||
public FilterHistoricCard(String name) {
|
||||
super(name);
|
||||
this.add(new HistoricPredicate());
|
||||
this.add(HistoricPredicate.instance);
|
||||
}
|
||||
|
||||
public FilterHistoricCard(final FilterHistoricCard filter) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class FilterHistoricSpell extends FilterSpell {
|
|||
|
||||
public FilterHistoricSpell(String name) {
|
||||
super(name);
|
||||
this.add(new HistoricPredicate());
|
||||
this.add(HistoricPredicate.instance);
|
||||
}
|
||||
|
||||
public FilterHistoricSpell(final FilterHistoricSpell filter) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class FilterUntappedCreature extends FilterCreaturePermanent {
|
|||
|
||||
public FilterUntappedCreature(String name) {
|
||||
super(name);
|
||||
this.add(Predicates.not(new TappedPredicate()));
|
||||
this.add(Predicates.not(TappedPredicate.instance));
|
||||
}
|
||||
|
||||
public FilterUntappedCreature(final FilterUntappedCreature filter) {
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ import mage.filter.predicate.Predicate;
|
|||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class HistoricPredicate implements Predicate<MageObject> {
|
||||
public enum HistoricPredicate implements Predicate<MageObject> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(MageObject input, Game game) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import mage.filter.predicate.Predicate;
|
|||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class MonocoloredPredicate implements Predicate<MageObject> {
|
||||
public enum MonocoloredPredicate implements Predicate<MageObject> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(MageObject input, Game game) {
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ import mage.filter.predicate.Predicate;
|
|||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class MulticoloredPredicate implements Predicate<MageObject> {
|
||||
public enum MulticoloredPredicate implements Predicate<MageObject> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(MageObject input, Game game) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import mage.filter.predicate.Predicate;
|
|||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class FaceDownPredicate implements Predicate<Card> {
|
||||
public enum FaceDownPredicate implements Predicate<Card> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Card input, Game game) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class AttackingPredicate implements Predicate<Permanent> {
|
||||
public enum AttackingPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class BlockedPredicate implements Predicate<Permanent> {
|
||||
public enum BlockedPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class BlockingPredicate implements Predicate<Permanent> {
|
||||
public enum BlockingPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CommanderPredicate implements Predicate<Permanent> {
|
||||
public enum CommanderPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,15 @@
|
|||
|
||||
package mage.filter.predicate.permanent;
|
||||
|
||||
import mage.counters.Counter;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CounterAnyPredicate implements Predicate<Permanent> {
|
||||
|
||||
public CounterAnyPredicate() {
|
||||
}
|
||||
public enum CounterAnyPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class DefendingPlayerControlsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
public enum DefendingPlayerControlsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,18 @@
|
|||
|
||||
package mage.filter.predicate.permanent;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class EnchantedPredicate implements Predicate<Permanent> {
|
||||
public enum EnchantedPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
@ -26,6 +25,6 @@ public class EnchantedPredicate implements Predicate<Permanent> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Enchanted" ;
|
||||
return "Enchanted";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ import java.util.Objects;
|
|||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class EquippedPredicate implements Predicate<Permanent> {
|
||||
public enum EquippedPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class TappedPredicate implements Predicate<Permanent> {
|
||||
public enum TappedPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentToken;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class TokenPredicate implements Predicate<Permanent> {
|
||||
public enum TokenPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Saga
|
||||
*/
|
||||
public class TransformedPredicate implements Predicate<Permanent> {
|
||||
public enum TransformedPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
@ -18,6 +18,6 @@ public class TransformedPredicate implements Predicate<Permanent> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Transformed" ;
|
||||
return "Transformed";
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,8 @@ import mage.game.turn.Step;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class UnblockedPredicate implements Predicate<Permanent> {
|
||||
public enum UnblockedPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public final class AurraSingBaneOfJediEmblem extends Emblem {
|
|||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a nontoken creature you control");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new TokenPredicate()));
|
||||
filter.add(Predicates.not(TokenPredicate.instance));
|
||||
}
|
||||
|
||||
// Whenever a nontoken creature you control leaves the battlefied, discard a card.
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class AkoumPlane extends Plane {
|
|||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that isn't enchanted");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new EnchantedPredicate()));
|
||||
filter.add(Predicates.not(EnchantedPredicate.instance));
|
||||
filterCard.add(new CardTypePredicate(CardType.ENCHANTMENT));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue