refactored ColorlessPredicate to singleton enum

This commit is contained in:
Evan Kranzler 2019-01-12 16:15:19 -05:00
parent e6b99215e1
commit dc409c9a9e
38 changed files with 41 additions and 41 deletions

View file

@ -253,7 +253,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
predicates.add(new ColorPredicate(ObjectColor.WHITE));
}
if (this.tbColorless.isSelected()) {
predicates.add(new ColorlessPredicate());
predicates.add(ColorlessPredicate.instance);
}
filter.add(Predicates.or(predicates));

View file

@ -20,7 +20,7 @@ public final class AncientStirrings extends CardImpl {
private static final FilterCard filter = new FilterCard("a colorless card");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}

View file

@ -32,7 +32,7 @@ public final class BarrageTyrant extends CardImpl {
static {
filter.add(AnotherPredicate.instance);
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public BarrageTyrant(UUID ownerId, CardSetInfo setInfo) {

View file

@ -19,7 +19,7 @@ public final class CeremoniousRejection extends CardImpl {
private static final FilterSpell filter = new FilterSpell("colorless spell");
static{
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public CeremoniousRejection(UUID ownerId, CardSetInfo setInfo) {

View file

@ -38,7 +38,7 @@ public final class ConduitOfRuin extends CardImpl {
private static final FilterCreatureCard filterCost = new FilterCreatureCard("The first creature spell");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
filter.add(new ConvertedManaCostPredicate(ComparisonType.MORE_THAN, 6));
filterCost.add(new FirstCastCreatureSpellPredicate());
}

View file

@ -29,7 +29,7 @@ public final class DominatorDrone extends CardImpl {
static {
filter.add(AnotherPredicate.instance);
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public DominatorDrone(UUID ownerId, CardSetInfo setInfo) {

View file

@ -29,7 +29,7 @@ public final class DustStalker extends CardImpl {
static {
filter.add(AnotherPredicate.instance);
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public DustStalker(UUID ownerId, CardSetInfo setInfo) {

View file

@ -30,7 +30,7 @@ public final class EldraziAggressor extends CardImpl {
static {
filter.add(AnotherPredicate.instance);
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public EldraziAggressor(UUID ownerId, CardSetInfo setInfo) {

View file

@ -29,7 +29,7 @@ public final class EldraziMimic extends CardImpl {
static {
FILTER.add(AnotherPredicate.instance);
FILTER.add(new ColorlessPredicate());
FILTER.add(ColorlessPredicate.instance);
}
public EldraziMimic(UUID ownerId, CardSetInfo setInfo) {

View file

@ -28,7 +28,7 @@ public final class EmrakulTheAeonsTorn extends CardImpl {
private static final FilterSpell filter = new FilterSpell("colored spells");
static {
filter.add(Predicates.not(new ColorlessPredicate()));
filter.add(Predicates.not(ColorlessPredicate.instance));
}
public EmrakulTheAeonsTorn(UUID ownerId, CardSetInfo setInfo) {

View file

@ -31,8 +31,8 @@ public final class EyeOfUgin extends CardImpl {
private static final FilterCard filterSpells = new FilterCard("Colorless Eldrazi spells");
static {
filter.add(new ColorlessPredicate());
filterSpells.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
filterSpells.add(ColorlessPredicate.instance);
filterSpells.add(new SubtypePredicate(SubType.ELDRAZI));
}

View file

@ -28,7 +28,7 @@ public final class FlayerDrone extends CardImpl {
static {
filter.add(AnotherPredicate.instance);
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public FlayerDrone(UUID ownerId, CardSetInfo setInfo) {

View file

@ -28,7 +28,7 @@ public final class ForerunnerOfSlaughter extends CardImpl {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("colorless creature");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public ForerunnerOfSlaughter(UUID ownerId, CardSetInfo setInfo) {

View file

@ -29,7 +29,7 @@ public final class GoblinCratermaker extends CardImpl {
= new FilterNonlandPermanent("colorless nonland permanent");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public GoblinCratermaker(UUID ownerId, CardSetInfo setInfo) {

View file

@ -55,7 +55,7 @@ class GrizzledAnglerEffect extends OneShotEffect {
private static final FilterCreatureCard filter = new FilterCreatureCard("a colorless creature card in your graveyard");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public GrizzledAnglerEffect() {

View file

@ -27,7 +27,7 @@ public final class GruesomeSlaughter extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("colorless creatures you control");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public GruesomeSlaughter(UUID ownerId, CardSetInfo setInfo) {

View file

@ -23,7 +23,7 @@ public final class HeraldOfKozilek extends CardImpl {
private static final FilterCard filter = new FilterCard("Colorless spells");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public HeraldOfKozilek(UUID ownerId, CardSetInfo setInfo) {

View file

@ -23,7 +23,7 @@ public final class InfernalReckoning extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("colorless creature");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public InfernalReckoning(UUID ownerId, CardSetInfo setInfo) {

View file

@ -23,7 +23,7 @@ public final class KozileksSentinel extends CardImpl {
private static final FilterSpell filterSpell = new FilterSpell("a colorless spell");
static {
filterSpell.add(new ColorlessPredicate());
filterSpell.add(ColorlessPredicate.instance);
}
public KozileksSentinel(UUID ownerId, CardSetInfo setInfo) {

View file

@ -22,7 +22,7 @@ public final class MoltenNursery extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a colorless spell");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public MoltenNursery(UUID ownerId, CardSetInfo setInfo) {

View file

@ -27,7 +27,7 @@ public final class NettleDrone extends CardImpl {
private static final FilterSpell filterSpell = new FilterSpell("a colorless spell");
static {
filterSpell.add(new ColorlessPredicate());
filterSpell.add(ColorlessPredicate.instance);
}
public NettleDrone(UUID ownerId, CardSetInfo setInfo) {

View file

@ -20,7 +20,7 @@ public final class ReachOfShadows extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that's one or more colors");
static {
filter.add(Predicates.not(new ColorlessPredicate()));
filter.add(Predicates.not(ColorlessPredicate.instance));
}
public ReachOfShadows(UUID ownerId, CardSetInfo setInfo) {

View file

@ -29,7 +29,7 @@ public final class ReaverDrone extends CardImpl {
static {
filter.add(AnotherPredicate.instance);
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public ReaverDrone(UUID ownerId, CardSetInfo setInfo) {

View file

@ -25,7 +25,7 @@ public final class RuinationGuide extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("colorless creatures");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public RuinationGuide(UUID ownerId, CardSetInfo setInfo) {

View file

@ -27,7 +27,7 @@ public final class RuinsOfOranRief extends CardImpl {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("colorless creature that entered the battlefield this turn");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
filter.add(new EnteredThisTurnPredicate());
}

View file

@ -27,8 +27,8 @@ public final class SanctumOfUgin extends CardImpl {
private static final FilterSpell filterSpells = new FilterSpell("colorless spell with converted mana cost 7 or greater");
static {
filter.add(new ColorlessPredicate());
filterSpells.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
filterSpells.add(ColorlessPredicate.instance);
filterSpells.add(new ConvertedManaCostPredicate(ComparisonType.MORE_THAN, 6));
}

View file

@ -25,7 +25,7 @@ public final class ShrineOfTheForsakenGods extends CardImpl {
private static final FilterSpell filter = new FilterSpell("colorless spells");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public ShrineOfTheForsakenGods(UUID ownerId, CardSetInfo setInfo) {

View file

@ -29,7 +29,7 @@ public final class Skitterskin extends CardImpl {
static {
filter.add(AnotherPredicate.instance);
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public Skitterskin(UUID ownerId, CardSetInfo setInfo) {

View file

@ -24,7 +24,7 @@ public final class SkyScourer extends CardImpl {
private static final FilterSpell filterSpell = new FilterSpell("a colorless spell");
static {
filterSpell.add(new ColorlessPredicate());
filterSpell.add(ColorlessPredicate.instance);
}
public SkyScourer(UUID ownerId, CardSetInfo setInfo) {

View file

@ -23,7 +23,7 @@ public final class SwarmSurge extends CardImpl {
private static final FilterCreaturePermanent FILTER = new FilterCreaturePermanent("Colorless creatures you control");
static {
FILTER.add(new ColorlessPredicate());
FILTER.add(ColorlessPredicate.instance);
}
public SwarmSurge(UUID ownerId, CardSetInfo setInfo) {

View file

@ -25,7 +25,7 @@ public final class ThoughtHarvester extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a colorless spell");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public ThoughtHarvester(UUID ownerId, CardSetInfo setInfo) {

View file

@ -24,7 +24,7 @@ public final class TideDrifter extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("colorless creatures");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public TideDrifter(UUID ownerId, CardSetInfo setInfo) {

View file

@ -29,7 +29,7 @@ public final class TitansPresence extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("a colorless creature card from your hand");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public TitansPresence(UUID ownerId, CardSetInfo setInfo) {

View file

@ -25,7 +25,7 @@ public final class TombOfTheSpiritDragon extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("colorless creature you control");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public TombOfTheSpiritDragon(UUID ownerId, CardSetInfo setInfo) {

View file

@ -100,7 +100,7 @@ class UginTheSpiritDragonEffect2 extends OneShotEffect {
FilterPermanent filter = new FilterPermanent("permanent with converted mana cost X or less that's one or more colors");
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, cmc + 1));
filter.add(Predicates.not(new ColorlessPredicate()));
filter.add(Predicates.not(ColorlessPredicate.instance));
Set<Card> permanentsToExile = new HashSet<>();
permanentsToExile.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game));
controller.moveCards(permanentsToExile, Zone.EXILED, source, game);

View file

@ -22,7 +22,7 @@ public final class UginsConstruct extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("permanent that's one or more colors");
static {
filter.add(Predicates.not(new ColorlessPredicate()));
filter.add(Predicates.not(ColorlessPredicate.instance));
}
public UginsConstruct(UUID ownerId, CardSetInfo setInfo) {

View file

@ -28,7 +28,7 @@ public final class VileAggregate extends CardImpl {
private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("colorless creatures you control");
static {
filter.add(new ColorlessPredicate());
filter.add(ColorlessPredicate.instance);
}
public VileAggregate(UUID ownerId, CardSetInfo setInfo) {

View file

@ -6,10 +6,10 @@ import mage.filter.predicate.Predicate;
import mage.game.Game;
/**
*
* @author North
*/
public class ColorlessPredicate implements Predicate<MageObject> {
public enum ColorlessPredicate implements Predicate<MageObject> {
instance;
@Override
public boolean apply(MageObject input, Game game) {