diff --git a/Mage/src/main/java/mage/filter/FilterImpl.java b/Mage/src/main/java/mage/filter/FilterImpl.java index 5092338392..ce2a63df0a 100644 --- a/Mage/src/main/java/mage/filter/FilterImpl.java +++ b/Mage/src/main/java/mage/filter/FilterImpl.java @@ -43,6 +43,7 @@ public abstract class FilterImpl<E> implements Filter<E> { protected List<Predicate<Object>> predicates = new ArrayList<>(); protected String message; + protected boolean lockedFilter = false; // Helps to prevent to "accidently" modify the StaticFilters objects @Override public abstract FilterImpl<E> copy(); @@ -51,9 +52,10 @@ public abstract class FilterImpl<E> implements Filter<E> { this.message = name; } - public FilterImpl(FilterImpl<E> filter) { + public FilterImpl(final FilterImpl<E> filter) { this.message = filter.message; this.predicates = new ArrayList<>(filter.predicates); + this.lockedFilter = false;// After copying a filter it's allowed to modify } @Override @@ -66,6 +68,9 @@ public abstract class FilterImpl<E> implements Filter<E> { @Override public final Filter add(Predicate predicate) { + if (isLockedFilter()) { + throw new UnsupportedOperationException("You may not modify a locked filter"); + } predicates.add(predicate); return this; } @@ -77,6 +82,9 @@ public abstract class FilterImpl<E> implements Filter<E> { @Override public void setMessage(String message) { + if (isLockedFilter()) { + throw new UnsupportedOperationException("You may not modify a locked filter"); + } this.message = message; } @@ -84,4 +92,13 @@ public abstract class FilterImpl<E> implements Filter<E> { public String toString() { return message; } + + public boolean isLockedFilter() { + return lockedFilter; + } + + public void setLockedFilter(boolean lockedFilter) { + this.lockedFilter = lockedFilter; + } + } diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java index 7f6ba2b49d..74ad22280b 100644 --- a/Mage/src/main/java/mage/filter/StaticFilters.java +++ b/Mage/src/main/java/mage/filter/StaticFilters.java @@ -20,6 +20,11 @@ import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.TokenPredicate; /** + * A class that holds Filter objects that may not be modified without copying + * before. This prevents the creation of thousands of filter objects. + * + * Because the filters are used application wide they may not be modified. + * NEVER!!!!! But it's possible, so be careful! * * @author LevelX2 */ @@ -27,149 +32,334 @@ public final class StaticFilters { public static final FilterSpiritOrArcaneCard SPIRIT_OR_ARCANE_CARD = new FilterSpiritOrArcaneCard(); - public static final FilterEnchantmentPermanent FILTER_ENCHANTMENT_PERMANENT = new FilterEnchantmentPermanent(); - - public static final FilterArtifactCard FILTER_CARD_ARTIFACT = new FilterArtifactCard(); - public static final FilterCard FILTER_CARD_ARTIFACT_OR_CREATURE = new FilterCard("artifact or creature card"); - public static final FilterCreatureCard FILTER_CARD_CREATURE = new FilterCreatureCard(); - public static final FilterCreatureCard FILTER_CARD_CREATURE_YOUR_GRAVEYARD = new FilterCreatureCard("creature card from your graveyard"); - public static final FilterCard FILTER_CARD_LAND = new FilterLandCard(); - public static final FilterNonlandCard FILTER_CARD_NON_LAND = new FilterNonlandCard(); - public static final FilterNonlandCard FILTER_CARD_A_NON_LAND = new FilterNonlandCard("a nonland card"); - - public static final FilterPermanent FILTER_PERMANENT = new FilterPermanent(); - public static final FilterArtifactOrEnchantmentPermanent FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT = new FilterArtifactOrEnchantmentPermanent(); - public static final FilterCreaturePermanent FILTER_ARTIFACT_CREATURE_PERMANENT = new FilterArtifactCreaturePermanent(); - public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_OR_CREATURE = new FilterPermanent("artifact or creature"); - public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_CREATURE_OR_ENCHANTMENT = new FilterPermanent("artifact, creature, or enchantment"); - public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_CREATURE_ENCHANTMENT_OR_LAND = new FilterPermanent("artifact, creature, enchantment, or land"); - - public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT = new FilterControlledPermanent(); - public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT = new FilterControlledArtifactPermanent(); - public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE = new FilterControlledPermanent("artifact or creature you control"); - public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_LAND = new FilterControlledLandPermanent(); - - public static final FilterPermanent FILTER_OPPONENTS_PERMANENT = new FilterPermanent("permanent an opponent controls"); - public static final FilterPermanent FILTER_OPPONENTS_PERMANENT_CREATURE = new FilterCreaturePermanent("creature an opponent controls"); - public static final FilterPermanent FILTER_OPPONENTS_PERMANENT_ARTIFACT = new FilterPermanent("artifact an opponent controls"); - public static final FilterPermanent FILTER_OPPONENTS_PERMANENT_ARTIFACT_OR_CREATURE = new FilterPermanent("artifact or creature an opponent controls"); - - public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_CREATURE = new FilterControlledCreaturePermanent(); - public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_A_CREATURE = new FilterControlledCreaturePermanent("a creature you control"); - public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_ANOTHER_CREATURE = new FilterControlledCreaturePermanent("another creature"); - public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_NON_LAND = new FilterControlledPermanent("nonland permanent"); - public static final FilterLandPermanent FILTER_LAND = new FilterLandPermanent(); - public static final FilterLandPermanent FILTER_LANDS = new FilterLandPermanent("lands"); - public static final FilterBasicLandCard FILTER_BASIC_LAND_CARD = new FilterBasicLandCard(); - - public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE = new FilterCreaturePermanent(); - public static final FilterCreaturePermanent FILTER_PERMANENT_A_CREATURE = new FilterCreaturePermanent("a creature"); - public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_CONTROLLED = new FilterCreaturePermanent("creature you control"); - public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURES = new FilterCreaturePermanent("creatures"); - public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURES_CONTROLLED = new FilterCreaturePermanent("creatures you control"); - public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_GOBLINS = new FilterCreaturePermanent(SubType.GOBLIN, "Goblin creatures"); - public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_SLIVERS = new FilterCreaturePermanent(SubType.SLIVER, "all Sliver creatures"); - public static final FilterPlaneswalkerPermanent FILTER_PERMANENT_PLANESWALKER = new FilterPlaneswalkerPermanent(); - - public static final FilterPermanent FILTER_PERMANENT_NON_LAND = new FilterNonlandPermanent(); - - public static final FilterCreatureSpell FILTER_SPELL_A_CREATURE = new FilterCreatureSpell("a creature spell"); - public static final FilterCreatureSpell FILTER_SPELL_CREATURE = new FilterCreatureSpell("creature spell"); - public static final FilterSpell FILTER_SPELL_NON_CREATURE - = (FilterSpell) new FilterSpell("noncreature spell").add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); - - public static final FilterSpell FILTER_SPELL = new FilterSpell(); - public static final FilterSpell FILTER_A_SPELL = new FilterSpell("a spell"); - - public static final FilterSpell FILTER_INSTANT_OR_SORCERY_SPELL = new FilterSpell("instant or sorcery spell"); - public static final FilterSpell FILTER_INSTANT_OR_SORCERY_SPELLS = new FilterSpell("instant or sorcery spells"); - - public static final FilterPermanent FILTER_CREATURE_TOKENS = new FilterCreaturePermanent("creature tokens"); - - public static final FilterCreaturePermanent FILTER_ATTACKING_CREATURES = new FilterCreaturePermanent("attacking creatures"); - - public static final FilterPermanent FILTER_PERMANENT_AURA = new FilterPermanent(); - public static final FilterPermanent FILTER_PERMANENT_EQUIPMENT = new FilterPermanent(); - public static final FilterPermanent FILTER_PERMANENT_FORTIFICATION = new FilterPermanent(); - public static final FilterPermanent FILTER_PERMANENT_LEGENDARY = new FilterPermanent(); - static { - FILTER_PERMANENT_AURA.add(new CardTypePredicate(CardType.ENCHANTMENT)); - FILTER_PERMANENT_AURA.add(new SubtypePredicate(SubType.AURA)); - - FILTER_PERMANENT_EQUIPMENT.add(new CardTypePredicate(CardType.ARTIFACT)); - FILTER_PERMANENT_EQUIPMENT.add(new SubtypePredicate(SubType.EQUIPMENT)); - - FILTER_PERMANENT_FORTIFICATION.add(new CardTypePredicate(CardType.ARTIFACT)); - FILTER_PERMANENT_FORTIFICATION.add(new SubtypePredicate(SubType.FORTIFICATION)); - - FILTER_PERMANENT_LEGENDARY.add(new SupertypePredicate(SuperType.LEGENDARY)); + SPIRIT_OR_ARCANE_CARD.setLockedFilter(true); } + public static final FilterEnchantmentPermanent FILTER_ENCHANTMENT_PERMANENT = new FilterEnchantmentPermanent(); + static { - FILTER_CONTROLLED_PERMANENT_NON_LAND.add( - Predicates.not(new CardTypePredicate(CardType.LAND)) - ); + FILTER_ENCHANTMENT_PERMANENT.setLockedFilter(true); + } - FILTER_CREATURE_TOKENS.add(new TokenPredicate()); + public static final FilterArtifactCard FILTER_CARD_ARTIFACT = new FilterArtifactCard(); - FILTER_ATTACKING_CREATURES.add(new AttackingPredicate()); + static { + FILTER_CARD_ARTIFACT.setLockedFilter(true); + } - FILTER_PERMANENT_CREATURE_CONTROLLED.add(new ControllerPredicate(TargetController.YOU)); - FILTER_PERMANENT_CREATURES_CONTROLLED.add(new ControllerPredicate(TargetController.YOU)); + public static final FilterCreatureCard FILTER_CARD_CREATURE = new FilterCreatureCard(); + static { + FILTER_CARD_CREATURE.setLockedFilter(true); + } + public static final FilterCreatureCard FILTER_CARD_CREATURE_YOUR_GRAVEYARD = new FilterCreatureCard("creature card from your graveyard"); + + static { + FILTER_CARD_CREATURE_YOUR_GRAVEYARD.setLockedFilter(true); + } + public static final FilterCard FILTER_CARD_LAND = new FilterLandCard(); + + static { + FILTER_CARD_LAND.setLockedFilter(true); + } + public static final FilterNonlandCard FILTER_CARD_NON_LAND = new FilterNonlandCard(); + + static { + FILTER_CARD_NON_LAND.setLockedFilter(true); + } + public static final FilterNonlandCard FILTER_CARD_A_NON_LAND = new FilterNonlandCard("a nonland card"); + + static { + FILTER_CARD_A_NON_LAND.setLockedFilter(true); + } + + public static final FilterPermanent FILTER_PERMANENT = new FilterPermanent(); + + static { + FILTER_PERMANENT.setLockedFilter(true); + } + public static final FilterArtifactOrEnchantmentPermanent FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT = new FilterArtifactOrEnchantmentPermanent(); + + static { + FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT.setLockedFilter(true); + } + public static final FilterCreaturePermanent FILTER_ARTIFACT_CREATURE_PERMANENT = new FilterArtifactCreaturePermanent(); + + static { + FILTER_ARTIFACT_CREATURE_PERMANENT.setLockedFilter(true); + } + public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_OR_CREATURE = new FilterPermanent("artifact or creature"); + + static { FILTER_PERMANENT_ARTIFACT_OR_CREATURE.add(Predicates.or( new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE) )); + FILTER_PERMANENT_ARTIFACT_OR_CREATURE.setLockedFilter(true); + } + public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_CREATURE_OR_ENCHANTMENT = new FilterPermanent("artifact, creature, or enchantment"); + + static { FILTER_PERMANENT_ARTIFACT_CREATURE_OR_ENCHANTMENT.add(Predicates.or( new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.ENCHANTMENT) )); + FILTER_PERMANENT_ARTIFACT_CREATURE_OR_ENCHANTMENT.setLockedFilter(true); + } + public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_CREATURE_ENCHANTMENT_OR_LAND = new FilterPermanent("artifact, creature, enchantment, or land"); + + static { FILTER_PERMANENT_ARTIFACT_CREATURE_ENCHANTMENT_OR_LAND.add(Predicates.or( new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.ENCHANTMENT), new CardTypePredicate(CardType.LAND) )); + FILTER_PERMANENT_ARTIFACT_CREATURE_ENCHANTMENT_OR_LAND.setLockedFilter(true); + } + + public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT = new FilterControlledPermanent(); + + static { + FILTER_CONTROLLED_PERMANENT.setLockedFilter(true); + } + public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT = new FilterControlledArtifactPermanent(); + + static { + FILTER_CONTROLLED_PERMANENT_ARTIFACT.setLockedFilter(true); + } + public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE = new FilterControlledPermanent("artifact or creature you control"); + + static { FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE.add(Predicates.or( new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE) )); + FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE.setLockedFilter(true); + } + public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_LAND = new FilterControlledLandPermanent(); + static { + FILTER_CONTROLLED_PERMANENT_LAND.setLockedFilter(true); + } + + public static final FilterPermanent FILTER_OPPONENTS_PERMANENT = new FilterPermanent("permanent an opponent controls"); + + static { FILTER_OPPONENTS_PERMANENT.add(new ControllerPredicate(TargetController.OPPONENT)); + FILTER_OPPONENTS_PERMANENT.setLockedFilter(true); + } + public static final FilterPermanent FILTER_OPPONENTS_PERMANENT_CREATURE = new FilterCreaturePermanent("creature an opponent controls"); + static { + FILTER_OPPONENTS_PERMANENT_CREATURE.setLockedFilter(true); FILTER_OPPONENTS_PERMANENT_CREATURE.add(new ControllerPredicate(TargetController.OPPONENT)); + } + public static final FilterPermanent FILTER_OPPONENTS_PERMANENT_ARTIFACT = new FilterPermanent("artifact an opponent controls"); + static { FILTER_OPPONENTS_PERMANENT_ARTIFACT.add(new ControllerPredicate(TargetController.OPPONENT)); FILTER_OPPONENTS_PERMANENT_ARTIFACT.add(new CardTypePredicate(CardType.ARTIFACT)); + FILTER_OPPONENTS_PERMANENT_ARTIFACT.setLockedFilter(true); + } + public static final FilterPermanent FILTER_OPPONENTS_PERMANENT_ARTIFACT_OR_CREATURE = new FilterPermanent("artifact or creature an opponent controls"); + static { FILTER_OPPONENTS_PERMANENT_ARTIFACT_OR_CREATURE.add(new ControllerPredicate(TargetController.OPPONENT)); FILTER_OPPONENTS_PERMANENT_ARTIFACT_OR_CREATURE.add(Predicates.or( new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE) )); + FILTER_OPPONENTS_PERMANENT_ARTIFACT_OR_CREATURE.setLockedFilter(true); + } + public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_CREATURE = new FilterControlledCreaturePermanent(); + + static { + FILTER_CONTROLLED_CREATURE.setLockedFilter(true); + } + public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_A_CREATURE = new FilterControlledCreaturePermanent("a creature you control"); + + static { + FILTER_CONTROLLED_A_CREATURE.setLockedFilter(true); + } + public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_ANOTHER_CREATURE = new FilterControlledCreaturePermanent("another creature"); + + static { FILTER_CONTROLLED_ANOTHER_CREATURE.add(new AnotherPredicate()); + FILTER_CONTROLLED_ANOTHER_CREATURE.setLockedFilter(true); + } + public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_NON_LAND = new FilterControlledPermanent("nonland permanent"); - FILTER_CARD_ARTIFACT_OR_CREATURE.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.CREATURE) - )); + static { + FILTER_CONTROLLED_PERMANENT_NON_LAND.add( + Predicates.not(new CardTypePredicate(CardType.LAND)) + ); + FILTER_CONTROLLED_PERMANENT_NON_LAND.setLockedFilter(true); + } + public static final FilterLandPermanent FILTER_LAND = new FilterLandPermanent(); + static { + FILTER_LAND.setLockedFilter(true); + } + public static final FilterLandPermanent FILTER_LANDS = new FilterLandPermanent("lands"); + + static { + FILTER_LANDS.setLockedFilter(true); + } + public static final FilterBasicLandCard FILTER_BASIC_LAND_CARD = new FilterBasicLandCard(); + + static { + FILTER_BASIC_LAND_CARD.setLockedFilter(true); + } + + public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE = new FilterCreaturePermanent(); + + static { + FILTER_PERMANENT_CREATURE.setLockedFilter(true); + } + public static final FilterCreaturePermanent FILTER_PERMANENT_A_CREATURE = new FilterCreaturePermanent("a creature"); + + static { + FILTER_PERMANENT_A_CREATURE.setLockedFilter(true); + } + public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_CONTROLLED = new FilterCreaturePermanent("creature you control"); + + static { + FILTER_PERMANENT_CREATURE_CONTROLLED.add(new ControllerPredicate(TargetController.YOU)); + FILTER_PERMANENT_CREATURE_CONTROLLED.setLockedFilter(true); + } + public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURES = new FilterCreaturePermanent("creatures"); + + static { + FILTER_PERMANENT_CREATURES.setLockedFilter(true); + } + public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURES_CONTROLLED = new FilterCreaturePermanent("creatures you control"); + + static { + FILTER_PERMANENT_CREATURES_CONTROLLED.add(new ControllerPredicate(TargetController.YOU)); + FILTER_PERMANENT_CREATURES_CONTROLLED.setLockedFilter(true); + } + public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_GOBLINS = new FilterCreaturePermanent(SubType.GOBLIN, "Goblin creatures"); + + static { + FILTER_PERMANENT_CREATURE_GOBLINS.setLockedFilter(true); + } + public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_SLIVERS = new FilterCreaturePermanent(SubType.SLIVER, "all Sliver creatures"); + + static { + FILTER_PERMANENT_CREATURE_SLIVERS.setLockedFilter(true); + } + public static final FilterPlaneswalkerPermanent FILTER_PERMANENT_PLANESWALKER = new FilterPlaneswalkerPermanent(); + + static { + FILTER_PERMANENT_PLANESWALKER.setLockedFilter(true); + } + + public static final FilterPermanent FILTER_PERMANENT_NON_LAND = new FilterNonlandPermanent(); + + static { + FILTER_PERMANENT_NON_LAND.setLockedFilter(true); + } + + public static final FilterCreatureSpell FILTER_SPELL_A_CREATURE = new FilterCreatureSpell("a creature spell"); + + static { + FILTER_SPELL_A_CREATURE.setLockedFilter(true); + } + public static final FilterCreatureSpell FILTER_SPELL_CREATURE = new FilterCreatureSpell("creature spell"); + + static { + FILTER_SPELL_CREATURE.setLockedFilter(true); + } + public static final FilterSpell FILTER_SPELL_NON_CREATURE = (FilterSpell) new FilterSpell("noncreature spell").add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); + + static { + FILTER_SPELL_NON_CREATURE.setLockedFilter(true); + } + + public static final FilterSpell FILTER_SPELL = new FilterSpell(); + + static { + FILTER_SPELL.setLockedFilter(true); + } + public static final FilterSpell FILTER_A_SPELL = new FilterSpell("a spell"); + + static { + FILTER_A_SPELL.setLockedFilter(true); + } + + public static final FilterSpell FILTER_INSTANT_OR_SORCERY_SPELL = new FilterSpell("instant or sorcery spell"); + + static { FILTER_INSTANT_OR_SORCERY_SPELL.add(Predicates.or( new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY) )); + FILTER_INSTANT_OR_SORCERY_SPELL.setLockedFilter(true); + } + public static final FilterSpell FILTER_INSTANT_OR_SORCERY_SPELLS = new FilterSpell("instant or sorcery spells"); + + static { FILTER_INSTANT_OR_SORCERY_SPELLS.add(Predicates.or( new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY) )); + FILTER_INSTANT_OR_SORCERY_SPELLS.setLockedFilter(true); + } + public static final FilterPermanent FILTER_CREATURE_TOKENS = new FilterCreaturePermanent("creature tokens"); + + static { + FILTER_CREATURE_TOKENS.add(new TokenPredicate()); + FILTER_CREATURE_TOKENS.setLockedFilter(true); } - private StaticFilters() { + public static final FilterCreaturePermanent FILTER_ATTACKING_CREATURES = new FilterCreaturePermanent("attacking creatures"); + + static { + FILTER_ATTACKING_CREATURES.add(new AttackingPredicate()); + FILTER_ATTACKING_CREATURES.setLockedFilter(true); + } + + public static final FilterPermanent FILTER_PERMANENT_AURA = new FilterPermanent(); + + static { + FILTER_PERMANENT_AURA.add(new CardTypePredicate(CardType.ENCHANTMENT)); + FILTER_PERMANENT_AURA.add(new SubtypePredicate(SubType.AURA)); + FILTER_PERMANENT_AURA.setLockedFilter(true); + } + public static final FilterPermanent FILTER_PERMANENT_EQUIPMENT = new FilterPermanent(); + + static { + FILTER_PERMANENT_EQUIPMENT.add(new CardTypePredicate(CardType.ARTIFACT)); + FILTER_PERMANENT_EQUIPMENT.add(new SubtypePredicate(SubType.EQUIPMENT)); + FILTER_PERMANENT_EQUIPMENT.setLockedFilter(true); + } + public static final FilterPermanent FILTER_PERMANENT_FORTIFICATION = new FilterPermanent(); + + static { + FILTER_PERMANENT_FORTIFICATION.add(new CardTypePredicate(CardType.ARTIFACT)); + FILTER_PERMANENT_FORTIFICATION.add(new SubtypePredicate(SubType.FORTIFICATION)); + FILTER_PERMANENT_FORTIFICATION.setLockedFilter(true); + } + public static final FilterPermanent FILTER_PERMANENT_LEGENDARY = new FilterPermanent(); + + static { + FILTER_PERMANENT_LEGENDARY.add(new SupertypePredicate(SuperType.LEGENDARY)); + FILTER_PERMANENT_LEGENDARY.setLockedFilter(true); + } + + public static final FilterCard FILTER_CARD_ARTIFACT_OR_CREATURE = new FilterCard("artifact or creature card"); + + static { + FILTER_CARD_ARTIFACT_OR_CREATURE.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE) + )); + FILTER_CARD_ARTIFACT_OR_CREATURE.setLockedFilter(true); } }