more static filter cleanup

This commit is contained in:
xenohedron 2023-07-07 22:45:07 -04:00
parent 7e2f16120f
commit 03c45500b7
7 changed files with 12 additions and 59 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.a;
import java.util.UUID;
@ -12,7 +11,7 @@ import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
import mage.target.common.TargetCreaturePermanentAmount;
@ -22,11 +21,9 @@ import mage.target.common.TargetCreaturePermanentAmount;
*/
public final class AjaniMentorOfHeroes extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control");
private static final FilterCard filterCard = new FilterCard("an Aura, creature, or planeswalker card");
static {
filter.add(TargetController.YOU.getControllerPredicate());
filterCard.add(Predicates.or(
SubType.AURA.getPredicate(),
CardType.CREATURE.getPredicate(),
@ -42,7 +39,7 @@ public final class AjaniMentorOfHeroes extends CardImpl {
// +1: Distribute three +1/+1 counters among one, two, or three target creatures you control
Ability ability = new LoyaltyAbility(new DistributeCountersEffect(CounterType.P1P1, 3, false, "one, two, or three target creatures you control"), 1);
ability.addTarget(new TargetCreaturePermanentAmount(3, filter));
ability.addTarget(new TargetCreaturePermanentAmount(3, StaticFilters.FILTER_CONTROLLED_CREATURES));
this.addAbility(ability);
// +1: Look at the top four cards of your library. You may reveal an Aura, creature, or planeswalker card

View file

@ -1,4 +1,3 @@
package mage.cards.a;
import java.util.UUID;
@ -10,9 +9,8 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanentAmount;
/**
@ -21,12 +19,6 @@ import mage.target.common.TargetCreaturePermanentAmount;
*/
public final class ArmamentCorps extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
public ArmamentCorps(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}{B}{G}");
this.subtype.add(SubType.HUMAN);
@ -37,7 +29,7 @@ public final class ArmamentCorps extends CardImpl {
// When Armament Corps enters the battlefield, distribute two +1/+1 counters among one or two target creatures you control.
Ability ability = new EntersBattlefieldTriggeredAbility(new DistributeCountersEffect(CounterType.P1P1, 2, false, "one or two target creatures you control"), false);
ability.addTarget(new TargetCreaturePermanentAmount(2, filter));
ability.addTarget(new TargetCreaturePermanentAmount(2, StaticFilters.FILTER_CONTROLLED_CREATURES));
this.addAbility(ability);
}

View file

@ -10,8 +10,8 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.MageObjectReferencePredicate;
import mage.filter.predicate.mageobject.ToughnessPredicate;
@ -59,14 +59,8 @@ public final class ColfenorTheLastYew extends CardImpl {
class ColfenorTheLastYewTriggeredAbility extends DiesThisOrAnotherCreatureTriggeredAbility {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
ColfenorTheLastYewTriggeredAbility() {
super(new ReturnFromGraveyardToHandTargetEffect(), false, filter);
super(new ReturnFromGraveyardToHandTargetEffect(), false, StaticFilters.FILTER_CONTROLLED_CREATURE);
}
private ColfenorTheLastYewTriggeredAbility(final ColfenorTheLastYewTriggeredAbility ability) {
@ -101,4 +95,4 @@ class ColfenorTheLastYewTriggeredAbility extends DiesThisOrAnotherCreatureTrigge
return "Whenever {this} or another creature you control dies, return up to one other target creature card " +
"with lesser toughness from your graveyard to your hand.";
}
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.d;
import java.util.List;
@ -12,7 +11,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -22,19 +20,13 @@ import mage.game.permanent.Permanent;
*/
public final class DeathPitOffering extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
public DeathPitOffering(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
// When Death Pit Offering enters the battlefield, sacrifice all creatures you control.
this.addAbility(new EntersBattlefieldTriggeredAbility(new DeathPitOfferingEffect()));
// Creatures you control get +2/+2.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(2, 2, Duration.WhileOnBattlefield, filter, false)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(2, 2, Duration.WhileOnBattlefield, StaticFilters.FILTER_CONTROLLED_CREATURES, false)));
}
private DeathPitOffering(final DeathPitOffering card) {

View file

@ -1,4 +1,3 @@
package mage.cards.m;
import mage.MageInt;
@ -12,7 +11,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -50,12 +49,6 @@ public final class MephidrossVampire extends CardImpl {
class MephidrossVampireEffect extends ContinuousEffectImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
MephidrossVampireEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Each creature you control is a Vampire in addition to its other creature types and has \"Whenever this creature deals damage to a creature, put a +1/+1 counter on this creature.\"";
@ -80,7 +73,7 @@ class MephidrossVampireEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_CREATURES, source.getControllerId(), game)) {
switch (layer) {
case AbilityAddingRemovingEffects_6:
creature.addAbility(new DealsDamageToACreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, false, false), source.getSourceId(), game);

View file

@ -8,9 +8,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -24,12 +22,6 @@ import java.util.UUID;
*/
public final class RumblingAftershocks extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
public RumblingAftershocks(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}");

View file

@ -1,4 +1,3 @@
package mage.cards.v;
import java.util.UUID;
@ -11,9 +10,8 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanentAmount;
/**
@ -22,11 +20,6 @@ import mage.target.common.TargetCreaturePermanentAmount;
*/
public final class VerdurousGearhulk extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
public VerdurousGearhulk(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{3}{G}{G}");
@ -39,7 +32,7 @@ public final class VerdurousGearhulk extends CardImpl {
// When Verdurous Gearhulk enters the battlefield, distribute four +1/+1 counters among any number of target creatures you control.
Ability ability = new EntersBattlefieldTriggeredAbility(new DistributeCountersEffect(CounterType.P1P1, 4, false, "any number of target creatures you control"), false);
ability.addTarget(new TargetCreaturePermanentAmount(4, filter));
ability.addTarget(new TargetCreaturePermanentAmount(4, StaticFilters.FILTER_CONTROLLED_CREATURES));
this.addAbility(ability);
}