add static filter

This commit is contained in:
Ingmar Goudt 2019-02-28 20:34:01 +01:00
parent 02f5ea910d
commit 9125df4ccf
5 changed files with 14 additions and 19 deletions

View file

@ -16,6 +16,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
/**
@ -35,13 +36,13 @@ public final class AetherwindBasker extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// Whenever Aetherwind Basker enters the battlefield or attacks, you get {E} for each creature you control.
this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new GetEnergyCountersControllerEffect(new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent("creature you control"), null))));
this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new GetEnergyCountersControllerEffect(new PermanentsOnBattlefieldCount(StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED, null))));
// Pay {E}: Aetherwind Basker gets +1/+1 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), new PayEnergyCost(1)));
}
public AetherwindBasker(final AetherwindBasker card) {
private AetherwindBasker(final AetherwindBasker card) {
super(card);
}

View file

@ -14,6 +14,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
/**
@ -30,14 +31,14 @@ public final class BlightedSteppe extends CardImpl {
// {3}{W}, {T}, Sacrifice Blighted Steppe: You gain 2 life for each creature you control.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new GainLifeEffect(new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent("creature you control"), 2)),
new GainLifeEffect(new PermanentsOnBattlefieldCount(StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED, 2)),
new ManaCostsImpl<>("{3}{W}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}
public BlightedSteppe(final BlightedSteppe card) {
private BlightedSteppe(final BlightedSteppe card) {
super(card);
}

View file

@ -8,6 +8,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
@ -18,21 +19,16 @@ import mage.filter.predicate.permanent.ControllerPredicate;
*/
public final class HailStorm extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
public HailStorm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}{G}");
// Hail Storm deals 2 damage to each attacking creature and 1 damage to you and each creature you control.
this.getSpellAbility().addEffect(new DamageAllEffect(2, new FilterAttackingCreature()));
this.getSpellAbility().addEffect(new DamageControllerEffect(1).setText("and 1 damage to you "));
this.getSpellAbility().addEffect(new DamageAllEffect(1, filter).setText("and each creature you control."));
this.getSpellAbility().addEffect(new DamageAllEffect(1, StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED).setText("and each creature you control."));
}
public HailStorm(final HailStorm card) {
private HailStorm(final HailStorm card) {
super(card);
}

View file

@ -16,6 +16,7 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
@ -25,11 +26,6 @@ import mage.filter.predicate.permanent.ControllerPredicate;
*/
public final class LoxodonHierarch extends CardImpl {
private static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
public LoxodonHierarch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{W}");
@ -43,12 +39,12 @@ public final class LoxodonHierarch extends CardImpl {
Ability etbAbility = new EntersBattlefieldTriggeredAbility(new GainLifeEffect(4));
this.addAbility(etbAbility);
// {G}{W}, Sacrifice Loxodon Hierarch: Regenerate each creature you control.
Ability activated = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateAllEffect(filter), new ManaCostsImpl("{G}{W}"));
Ability activated = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateAllEffect(StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED), new ManaCostsImpl("{G}{W}"));
activated.addCost(new SacrificeSourceCost());
this.addAbility(activated);
}
public LoxodonHierarch(final LoxodonHierarch card) {
private LoxodonHierarch(final LoxodonHierarch card) {
super(card);
}

View file

@ -8,6 +8,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
/**
@ -21,7 +22,7 @@ public final class TitaniasBoon extends CardImpl {
// Put a +1/+1 counter on each creature you control.
this.getSpellAbility().addEffect(new AddCountersAllEffect(CounterType.P1P1.createInstance(), new FilterControlledCreaturePermanent("creature you control")));
this.getSpellAbility().addEffect(new AddCountersAllEffect(CounterType.P1P1.createInstance(), StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED));
}
public TitaniasBoon(final TitaniasBoon card) {