forked from External/mage
use Static filter rather than new filter, add test for this filter
This commit is contained in:
parent
9125df4ccf
commit
4a14940414
11 changed files with 52 additions and 34 deletions
|
|
@ -9,6 +9,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
|
@ -24,7 +25,7 @@ public final class GaeasCradle extends CardImpl {
|
|||
// {T}: Add {G} for each creature you control.
|
||||
DynamicManaAbility ability = new DynamicManaAbility(
|
||||
Mana.GreenMana(1),
|
||||
new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent("creature you control"))
|
||||
new PermanentsOnBattlefieldCount(StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED)
|
||||
);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
|
||||
public final class GavonyTownship extends CardImpl {
|
||||
|
|
@ -23,7 +24,7 @@ public final class GavonyTownship extends CardImpl {
|
|||
this.addAbility(new ColorlessManaAbility());
|
||||
|
||||
// {2}{G}{W}, {T}: Put a +1/+1 counter on each creature you control.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersAllEffect(CounterType.P1P1.createInstance(), new FilterControlledCreaturePermanent("creature you control")), new ManaCostsImpl("{2}{G}{W}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersAllEffect(CounterType.P1P1.createInstance(), StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED), new ManaCostsImpl("{2}{G}{W}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
|
||||
|
|
@ -21,12 +22,10 @@ public final class GruesomeFate extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}");
|
||||
|
||||
// Each opponent loses 1 life for each creature you control.
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
this.getSpellAbility().addEffect(new LoseLifeOpponentsEffect(new PermanentsOnBattlefieldCount(filter)));
|
||||
this.getSpellAbility().addEffect(new LoseLifeOpponentsEffect(new PermanentsOnBattlefieldCount(StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED)));
|
||||
}
|
||||
|
||||
public GruesomeFate(final GruesomeFate card) {
|
||||
private GruesomeFate(final GruesomeFate card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
||||
|
|
@ -20,11 +21,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*/
|
||||
public final class ItlimocCradleOfTheSun extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("creature you control");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
public ItlimocCradleOfTheSun(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||
|
|
@ -38,7 +35,7 @@ public final class ItlimocCradleOfTheSun extends CardImpl {
|
|||
this.addAbility(new GreenManaAbility());
|
||||
|
||||
// {T}: Add {G} for each creature you control.
|
||||
this.addAbility(new DynamicManaAbility(Mana.GreenMana(1), new PermanentsOnBattlefieldCount(filter)));
|
||||
this.addAbility(new DynamicManaAbility(Mana.GreenMana(1), new PermanentsOnBattlefieldCount(StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED)));
|
||||
}
|
||||
|
||||
public ItlimocCradleOfTheSun(final ItlimocCradleOfTheSun card) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
|
@ -25,28 +26,24 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public final class MizziumSkin extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
public MizziumSkin(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}");
|
||||
|
||||
|
||||
// Target creature you control gets +0/+1 and gains hexproof until end of turn.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED));
|
||||
this.getSpellAbility().addEffect(new BoostTargetEffect(0,1, Duration.EndOfTurn));
|
||||
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(HexproofAbility.getInstance(), Duration.EndOfTurn));
|
||||
|
||||
// Overload {1}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
|
||||
OverloadAbility ability = new OverloadAbility(this, new BoostAllEffect(0,1, Duration.EndOfTurn,filter,false), new ManaCostsImpl("{1}{U}"));
|
||||
ability.addEffect(new GainAbilityAllEffect(HexproofAbility.getInstance(), Duration.EndOfTurn, filter));
|
||||
OverloadAbility ability = new OverloadAbility(this, new BoostAllEffect(0,1, Duration.EndOfTurn,StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED,false), new ManaCostsImpl("{1}{U}"));
|
||||
ability.addEffect(new GainAbilityAllEffect(HexproofAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public MizziumSkin(final MizziumSkin card) {
|
||||
private MizziumSkin(final MizziumSkin card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
|
|
@ -26,11 +27,7 @@ import mage.util.functions.EmptyApplyToPermanent;
|
|||
*/
|
||||
public final class PolymorphousRush extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
public PolymorphousRush(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{U}");
|
||||
|
|
@ -39,7 +36,7 @@ public final class PolymorphousRush extends CardImpl {
|
|||
this.addAbility(new StriveAbility("{1}{U}"));
|
||||
|
||||
// Choose a creature on the battlefield. Any number of target creatures you control each become a copy of that creature until end of turn.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, false));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED, false));
|
||||
this.getSpellAbility().addEffect(new PolymorphousRushCopyEffect());
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import mage.constants.SubType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
|
|
@ -34,13 +35,13 @@ public final class Quillspike extends CardImpl {
|
|||
|
||||
// {BG}, Remove a -1/-1 counter from a creature you control: Quillspike gets +3/+3 until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(3, 3, Duration.EndOfTurn), new ManaCostsImpl("{B/G}"));
|
||||
TargetPermanent target = new TargetPermanent(1, 1, new FilterControlledCreaturePermanent("creature you control"), true);
|
||||
TargetPermanent target = new TargetPermanent(1, 1, StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED, true);
|
||||
ability.addCost(new RemoveCounterCost(target, CounterType.M1M1));
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
public Quillspike(final Quillspike card) {
|
||||
private Quillspike(final Quillspike card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public final class ShalaiVoiceOfPlenty extends CardImpl {
|
|||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new AddCountersAllEffect(
|
||||
CounterType.P1P1.createInstance(),
|
||||
new FilterControlledCreaturePermanent("creature you control")
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED
|
||||
),
|
||||
new ManaCostsImpl("{4}{G}{G}")
|
||||
));
|
||||
|
|
|
|||
|
|
@ -13,6 +13,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;
|
||||
|
||||
/**
|
||||
|
|
@ -26,7 +27,7 @@ public final class SlateOfAncestry extends CardImpl {
|
|||
|
||||
// {4}, {tap}, Discard your hand: Draw a card for each creature you control.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent("creature you control"))),
|
||||
new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED)),
|
||||
new GenericManaCost(4));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new DiscardHandCost());
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
|
||||
|
|
@ -22,11 +23,6 @@ import mage.filter.predicate.permanent.ControllerPredicate;
|
|||
*/
|
||||
public final class ZulaportCutthroat extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
public ZulaportCutthroat(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}");
|
||||
|
|
@ -35,7 +31,7 @@ public final class ZulaportCutthroat extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever Zulaport Cutthroat or another creature you control dies, each opponent loses 1 life and you gain 1 life.
|
||||
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new LoseLifeOpponentsEffect(1), false, filter);
|
||||
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new LoseLifeOpponentsEffect(1), false, StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED);
|
||||
Effect effect = new GainLifeEffect(1);
|
||||
effect.setText("and you gain 1 life");
|
||||
ability.addEffect(effect);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package org.mage.test.cards.mana;
|
||||
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
public class GaeasGradleTest extends CardTestPlayerBase {
|
||||
|
||||
private final String cradle = "Gaea's Cradle";
|
||||
private final String bears = "Grizzly Bears";
|
||||
private final String thopter = "Ornithopter";
|
||||
|
||||
@Test
|
||||
public void testGradle(){
|
||||
addCard(Zone.BATTLEFIELD, playerA, cradle);
|
||||
addCard(Zone.BATTLEFIELD, playerA, bears, 2);
|
||||
addCard(Zone.BATTLEFIELD, playerB, thopter);
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA,"{T}: ");
|
||||
|
||||
checkManaPool("gaeas cradle ",1, PhaseStep.PRECOMBAT_MAIN, playerA, "G", 2);
|
||||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue