update spellfilters to staticfilters

This commit is contained in:
igoudt 2017-07-10 15:45:19 +02:00
parent ba5c216146
commit b7159d7d2c
50 changed files with 173 additions and 389 deletions

View file

@ -38,9 +38,7 @@ import mage.abilities.keyword.HexproofAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
@ -83,11 +81,6 @@ public class BattlefieldThaumaturge extends CardImpl {
class BattlefieldThaumaturgeSpellsCostReductionEffect extends CostModificationEffectImpl {
private static final FilterSpell filter = new FilterSpell("instant and sorcery spell");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
}
public BattlefieldThaumaturgeSpellsCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
@ -118,7 +111,7 @@ class BattlefieldThaumaturgeSpellsCostReductionEffect extends CostModificationEf
if ((abilityToModify instanceof SpellAbility)
&& abilityToModify.getControllerId().equals(source.getControllerId())) {
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
return spell != null && BattlefieldThaumaturgeSpellsCostReductionEffect.filter.match(spell, game);
return spell != null && StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL.match(spell, game);
}
return false;
}

View file

@ -36,9 +36,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import java.util.UUID;
@ -47,14 +45,6 @@ import java.util.UUID;
*/
public class BlistercoilWeird extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public BlistercoilWeird(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{U/R}");
this.subtype.add("Weird");
@ -65,7 +55,7 @@ public class BlistercoilWeird extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you cast an instant or sorcery spell, Blistercoil Weird gets +1/+1 until end of turn. Untap it.
Ability ability = new SpellCastControllerTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), filter, false);
Ability ability = new SpellCastControllerTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL, false);
ability.addEffect(new UntapSourceEffect());
this.addAbility(ability);

View file

@ -42,7 +42,7 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -69,7 +69,7 @@ public class ChancellorOfTheAnnex extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever an opponent casts a spell, counter it unless that player pays {1}.
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(new GenericManaCost(1)), new FilterSpell(), false, SetTargetPointer.SPELL));
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(new GenericManaCost(1)), StaticFilters.FILTER_SPELL, false, SetTargetPointer.SPELL));
}
public ChancellorOfTheAnnex(final ChancellorOfTheAnnex card) {

View file

@ -38,12 +38,11 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.UUID;
@ -58,7 +57,7 @@ public class Counterbalance extends CardImpl {
// Whenever an opponent casts a spell, you may reveal the top card of your library. If you do, counter that spell if it has the same converted mana cost as the revealed card.
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new CounterbalanceEffect(), new FilterSpell(), true, SetTargetPointer.SPELL));
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new CounterbalanceEffect(), StaticFilters.FILTER_SPELL, true, SetTargetPointer.SPELL));
}
public Counterbalance(final Counterbalance card) {

View file

@ -34,7 +34,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.StackObject;
import mage.players.Player;
@ -53,7 +53,7 @@ public class Countermand extends CardImpl {
// Counter target spell. Its controller puts the top four cards of his or her library into his or her graveyard.
this.getSpellAbility().addTarget(new TargetSpell(new FilterSpell()));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_SPELL));
this.getSpellAbility().addEffect(new CountermandEffect());
}

View file

@ -36,9 +36,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
@ -49,14 +47,6 @@ import java.util.UUID;
*/
public class Cursecatcher extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public Cursecatcher(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{U}");
this.subtype.add("Merfolk");
@ -69,7 +59,7 @@ public class Cursecatcher extends CardImpl {
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new CounterUnlessPaysEffect(new GenericManaCost(1)),
new SacrificeSourceCost());
ability.addTarget(new TargetSpell(filter));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.addAbility(ability);
}

View file

@ -44,7 +44,7 @@ import mage.constants.CardType;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
@ -61,7 +61,7 @@ public class DecreeOfSilence extends CardImpl {
// Whenever an opponent casts a spell, counter that spell and put a depletion counter on Decree of Silence. If there are three or more depletion counters on Decree of Silence, sacrifice it.
Effect effect = new CounterTargetEffect();
effect.setText("counter that spell");
Ability ability = new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, effect, new FilterSpell(),
Ability ability = new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, effect, StaticFilters.FILTER_SPELL,
false, SetTargetPointer.SPELL);
effect = new AddCountersSourceEffect(CounterType.DEPLETION.createInstance());
effect.setText("and put a depletion counter on {this}.");

View file

@ -33,9 +33,7 @@ import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
@ -47,19 +45,11 @@ import java.util.UUID;
*/
public class Disrupt extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public Disrupt(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}");
// Counter target instant or sorcery spell unless its controller pays {1}.
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.getSpellAbility().addEffect(new CounterUnlessPaysEffect(new GenericManaCost(1)));
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));

View file

@ -32,7 +32,7 @@ import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
@ -53,7 +53,7 @@ public class DoubleNegative extends CardImpl {
Effect effect = new CounterTargetEffect();
effect.setText("Counter up to two target spells");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetSpell(0, 2, new FilterSpell()));
this.getSpellAbility().addTarget(new TargetSpell(0, 2, StaticFilters.FILTER_SPELL));
}
public DoubleNegative(final DoubleNegative card) {

View file

@ -35,9 +35,7 @@ import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
@ -48,14 +46,6 @@ import java.util.UUID;
*/
public class DualcasterMage extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public DualcasterMage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{R}");
this.subtype.add("Human");
@ -69,7 +59,7 @@ public class DualcasterMage extends CardImpl {
// When Dualcaster Mage enters the battlefield, copy target instant or sorcery spell. You may choose new targets for the copy.
Ability ability = new EntersBattlefieldTriggeredAbility(new CopyTargetSpellEffect(), false);
ability.addTarget(new TargetSpell(filter));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.addAbility(ability);
}

View file

@ -43,9 +43,7 @@ import mage.cards.LevelerCard;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.target.TargetSpell;
@ -58,14 +56,6 @@ import java.util.UUID;
*/
public class EchoMage extends LevelerCard {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public EchoMage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{U}");
this.subtype.add("Human");
@ -82,7 +72,7 @@ public class EchoMage extends LevelerCard {
// {U}{U}, {tap}: Copy target instant or sorcery spell. You may choose new targets for the copy.
Abilities<Ability> abilities1 = new AbilitiesImpl<>();
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CopyTargetSpellEffect(), new ManaCostsImpl("{U}{U}"));
ability.addTarget(new TargetSpell(filter));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
ability.addCost(new TapSourceCost());
abilities1.add(ability);
// LEVEL 4+
@ -90,7 +80,7 @@ public class EchoMage extends LevelerCard {
// {U}{U}, {tap}: Copy target instant or sorcery spell twice. You may choose new targets for the copies.
Abilities<Ability> abilities2 = new AbilitiesImpl<>();
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new EchoMageEffect(), new ManaCostsImpl("{U}{U}"));
ability.addTarget(new TargetSpell(filter));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
ability.addCost(new TapSourceCost());
abilities2.add(ability);

View file

@ -27,7 +27,6 @@
*/
package mage.cards.f;
import mage.constants.ComparisonType;
import mage.abilities.Mode;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
@ -35,10 +34,9 @@ import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.constants.ComparisonType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.target.TargetSpell;
import mage.target.common.TargetCardInYourGraveyard;
@ -53,11 +51,9 @@ import java.util.UUID;
public class FerocityOfTheUnderworld extends CardImpl {
private static final FilterNonlandPermanent filterMode1 = new FilterNonlandPermanent("nonland permanent with converted mana cost 3 or less");
private static final FilterSpell filterMode2 = new FilterSpell("instant or sorcery spell");
static {
filterMode1.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 4));
filterMode2.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
}
public FerocityOfTheUnderworld(UUID ownerId, CardSetInfo setInfo) {
@ -70,7 +66,7 @@ public class FerocityOfTheUnderworld extends CardImpl {
// Copy target instant or sorcery spell. You may choose new targets for the copy.
Mode mode = new Mode();
mode.getEffects().add(new CopyTargetSpellEffect());
mode.getTargets().add(new TargetSpell(filterMode2));
mode.getTargets().add(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.getSpellAbility().addMode(mode);
// Return target card from your graveyard to your hand.

View file

@ -33,9 +33,7 @@ import mage.abilities.keyword.StormAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
@ -46,18 +44,12 @@ import java.util.UUID;
*/
public class Flusterstorm extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
}
public Flusterstorm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}");
// Counter target instant or sorcery spell unless its controller pays {1}.
this.getSpellAbility().addEffect(new CounterUnlessPaysEffect(new ManaCostsImpl("{1}")));
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
// Storm
this.addAbility(new StormAbility());
}

View file

@ -35,9 +35,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import java.util.UUID;
@ -47,13 +45,6 @@ import java.util.UUID;
*/
public class Fluxcharger extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public Fluxcharger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{R}");
this.subtype.add("Weird");
@ -64,7 +55,7 @@ public class Fluxcharger extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast an instant or sorcery spell, you may switch Fluxcharger's power and toughness until end of turn.
this.addAbility(new SpellCastControllerTriggeredAbility(new SwitchPowerToughnessSourceEffect(Duration.EndOfTurn), filter, true));
this.addAbility(new SpellCastControllerTriggeredAbility(new SwitchPowerToughnessSourceEffect(Duration.EndOfTurn), StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL, true));
}

View file

@ -34,7 +34,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import java.util.UUID;
@ -50,7 +50,7 @@ public class ForcedFruition extends CardImpl {
// Whenever an opponent casts a spell, that player draws seven cards.
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new DrawCardTargetEffect(7),
new FilterSpell(), false, SetTargetPointer.PLAYER));
StaticFilters.FILTER_SPELL, false, SetTargetPointer.PLAYER));
}
public ForcedFruition(final ForcedFruition card) {

View file

@ -34,8 +34,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -66,11 +65,6 @@ public class GlimpseOfNature extends CardImpl {
class GlimpseOfNatureTriggeredAbility extends DelayedTriggeredAbility {
private static final FilterSpell filter = new FilterSpell();
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
public GlimpseOfNatureTriggeredAbility() {
super(new DrawCardSourceControllerEffect(1), Duration.EndOfTurn, false);
}
@ -88,7 +82,7 @@ class GlimpseOfNatureTriggeredAbility extends DelayedTriggeredAbility {
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && filter.match(spell, game)) {
if (spell != null && StaticFilters.FILTER_SPELL_A_CREATURE.match(spell, game)) {
return true;
}
}

View file

@ -29,6 +29,8 @@ package mage.cards.i;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastAllTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -36,13 +38,11 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import java.util.UUID;
@ -57,7 +57,7 @@ public class IceCave extends CardImpl {
// Whenever a player casts a spell, any other player may pay that spell's mana cost. If a player does, counter the spell. (Mana cost includes color.)
this.addAbility(new SpellCastAllTriggeredAbility(Zone.BATTLEFIELD, new IceCaveEffect(), new FilterSpell(), false, SetTargetPointer.SPELL));
this.addAbility(new SpellCastAllTriggeredAbility(Zone.BATTLEFIELD, new IceCaveEffect(), StaticFilters.FILTER_SPELL, false, SetTargetPointer.SPELL));
}
public IceCave(final IceCave card) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.i;
import java.util.UUID;
import mage.abilities.Mode;
import mage.abilities.effects.common.ChooseNewTargetsTargetEffect;
import mage.abilities.effects.common.CopyTargetSpellEffect;
@ -35,25 +34,17 @@ import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public class InsidiousWill extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public InsidiousWill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{U}{U}");
@ -74,7 +65,7 @@ public class InsidiousWill extends CardImpl {
// Copy target instant or sorcery spell. You may choose new targets for the copy.
mode = new Mode();
mode.getEffects().add(new CopyTargetSpellEffect());
mode.getTargets().add(new TargetSpell(filter));
mode.getTargets().add(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.getSpellAbility().getModes().addMode(mode);
}

View file

@ -27,9 +27,6 @@
*/
package mage.cards.j;
import java.util.UUID;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
@ -38,26 +35,19 @@ import mage.abilities.effects.common.CounterUnlessPaysEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class JudgesFamiliar extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public JudgesFamiliar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W/U}");
this.subtype.add("Bird");
@ -73,7 +63,7 @@ public class JudgesFamiliar extends CardImpl {
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new CounterUnlessPaysEffect(new GenericManaCost(1)),
new SacrificeSourceCost());
ability.addTarget(new TargetSpell(filter));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.addAbility(ability);
}

View file

@ -35,7 +35,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
@ -61,7 +61,7 @@ public class KaervekTheMerciless extends CardImpl {
this.toughness = new MageInt(4);
// Whenever an opponent casts a spell, Kaervek the Merciless deals damage to target creature or player equal to that spell's converted mana cost.
Ability ability = new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new KaervekTheMercilessEffect(), new FilterSpell(), false, SetTargetPointer.SPELL);
Ability ability = new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new KaervekTheMercilessEffect(), StaticFilters.FILTER_SPELL, false, SetTargetPointer.SPELL);
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability);

View file

@ -27,7 +27,6 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastAllTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -37,7 +36,7 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
@ -45,6 +44,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author LoneFox
@ -56,7 +57,7 @@ public class ManaBreach extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}");
// Whenever a player casts a spell, that player returns a land he or she controls to its owner's hand.
this.addAbility(new SpellCastAllTriggeredAbility(new ManaBreachEffect(), new FilterSpell(), false, SetTargetPointer.PLAYER));
this.addAbility(new SpellCastAllTriggeredAbility(new ManaBreachEffect(), StaticFilters.FILTER_SPELL, false, SetTargetPointer.PLAYER));
}
public ManaBreach(final ManaBreach card) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -39,9 +38,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
@ -49,20 +46,14 @@ import mage.players.Player;
import mage.target.Target;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class MeletisCharlatan extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public MeletisCharlatan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}");
this.subtype.add("Human");
@ -74,7 +65,7 @@ public class MeletisCharlatan extends CardImpl {
// {2}{U}, {T}: The controller of target instant or sorcery spell copies it. That player may choose new targets for the copy.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MeletisCharlatanCopyTargetSpellEffect(), new ManaCostsImpl("{2}{U}"));
ability.addCost(new TapSourceCost());
Target target = new TargetSpell(filter);
Target target = new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL);
ability.addTarget(target);
this.addAbility(ability);
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
@ -36,9 +35,9 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
@ -46,14 +45,6 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
*/
public class MercurialGeists extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public MercurialGeists(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{R}");
this.subtype.add("Spirit");
@ -64,7 +55,7 @@ public class MercurialGeists extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast an instant or sorcery spell, Mercurial Geists gets +3/+0 until end of turn.
this.addAbility(new SpellCastControllerTriggeredAbility(new BoostSourceEffect(3, 0, Duration.EndOfTurn), filter, false));
this.addAbility(new SpellCastControllerTriggeredAbility(new BoostSourceEffect(3, 0, Duration.EndOfTurn), StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL, false));
}
public MercurialGeists(final MercurialGeists card) {

View file

@ -31,15 +31,11 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SpellAbilityType;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
@ -59,7 +55,7 @@ public class MinamosMeddling extends CardImpl {
// Counter target spell. That spell's controller reveals his or her hand, then discards each card with the same name as a card spliced onto that spell.
this.getSpellAbility().addTarget(new TargetSpell(new FilterSpell()));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_SPELL));
this.getSpellAbility().addEffect(new MinamosMeddlingCounterTargetEffect());
}

View file

@ -27,8 +27,6 @@
*/
package mage.cards.m;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
@ -40,7 +38,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
@ -48,6 +46,9 @@ import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.SpellsCastWatcher;
import java.util.List;
import java.util.UUID;
/**
*
* @author fireshoes
@ -75,7 +76,7 @@ public class MindsDilation extends CardImpl {
class MindsDilationTriggeredAbility extends SpellCastOpponentTriggeredAbility {
public MindsDilationTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, new FilterSpell(), optional);
super(Zone.BATTLEFIELD, effect, StaticFilters.FILTER_SPELL, optional);
}
public MindsDilationTriggeredAbility(SpellCastOpponentTriggeredAbility ability) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -42,24 +41,16 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public class MischievousQuanar extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public MischievousQuanar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}");
@ -79,7 +70,7 @@ public class MischievousQuanar extends CardImpl {
Effect effect2 = new CopyTargetSpellEffect();
effect2.setText("copy target instant or sorcery spell. You may choose new targets for that copy");
Ability ability = new TurnedFaceUpSourceTriggeredAbility(effect2);
ability.addTarget(new TargetSpell(filter));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.addAbility(ability);
}

View file

@ -27,40 +27,31 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author cbt33, LevelX2 (Quash)
*/
public class MoltenInfluence extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY));
}
public MoltenInfluence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
// Counter target instant or sorcery spell unless its controller has Molten Influence deal 4 damage to him or her.
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.getSpellAbility().addEffect(new MoltenInfluenceEffect());
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.n;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
@ -39,27 +38,22 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public class NiblisOfFrost extends CardImpl {
private static final FilterSpell filterSpell = new FilterSpell("instant or sorcery spell");
private static final FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("creature an opponent controls");
static {
filterCreature.add(new ControllerPredicate(TargetController.OPPONENT));
filterSpell.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public NiblisOfFrost(UUID ownerId, CardSetInfo setInfo) {
@ -75,7 +69,7 @@ public class NiblisOfFrost extends CardImpl {
this.addAbility(new ProwessAbility());
// Whenever you cast an instant or sorcery spell, tap target creature an opponent controls. That creature doesn't untap during its controller's next untap step.
Ability ability = new SpellCastControllerTriggeredAbility(new TapTargetEffect(), filterSpell, false);
Ability ability = new SpellCastControllerTriggeredAbility(new TapTargetEffect(), StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL, false);
ability.addTarget(new TargetCreaturePermanent(filterCreature));
ability.addEffect(new DontUntapInControllersNextUntapStepTargetEffect("That creature"));
this.addAbility(ability);

View file

@ -27,7 +27,6 @@
*/
package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyTargetSpellEffect;
@ -37,32 +36,24 @@ import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SpellAbilityType;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.TargetSpell;
import java.util.UUID;
public class OddsEnds extends SplitCard {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public OddsEnds(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}{R}", "{3}{R}{W}", SpellAbilityType.SPLIT);
// Odds
// Flip a coin. If it comes up heads, counter target instant or sorcery spell. If it comes up tails, copy that spell and you may choose new targets for the copy.
getLeftHalfCard().getSpellAbility().addEffect(new OddsEffect());
getLeftHalfCard().getSpellAbility().addTarget(new TargetSpell(filter));
getLeftHalfCard().getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
// Ends
// Target player sacrifices two attacking creatures.

View file

@ -35,6 +35,7 @@ import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
@ -79,7 +80,7 @@ public class Outwit extends CardImpl {
protected FilterSpell filter;
public CustomTargetSpell() {
this(1, 1, new FilterSpell());
this(1, 1, StaticFilters.FILTER_SPELL);
}
public CustomTargetSpell(FilterSpell filter) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.p;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.costs.Cost;
@ -39,11 +38,13 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
@ -54,7 +55,7 @@ public class PainfulQuandary extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{B}{B}");
// Whenever an opponent casts a spell, that player loses 5 life unless he or she discards a card.
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new PainfulQuandryEffect(), new FilterSpell(), false, SetTargetPointer.PLAYER));
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new PainfulQuandryEffect(), StaticFilters.FILTER_SPELL, false, SetTargetPointer.PLAYER));
}
public PainfulQuandary(final PainfulQuandary card) {

View file

@ -44,7 +44,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
@ -71,7 +71,7 @@ public class PardicDragon extends CardImpl {
this.addAbility(new SuspendAbility(2, new ManaCostsImpl("{R}{R}"), this, true));
// Whenever an opponent casts a spell, if Pardic Dragon is suspended, that player may put a time counter on Pardic Dragon.
this.addAbility(new ConditionalTriggeredAbility(
new SpellCastOpponentTriggeredAbility(Zone.EXILED, new PardicDragonEffect(), new FilterSpell(), false, SetTargetPointer.PLAYER),
new SpellCastOpponentTriggeredAbility(Zone.EXILED, new PardicDragonEffect(), StaticFilters.FILTER_SPELL, false, SetTargetPointer.PLAYER),
SuspendedCondition.instance,
"Whenever an opponent casts a spell, if {this} is suspended, that player may put a time counter on {this}."
));

View file

@ -27,7 +27,6 @@
*/
package mage.cards.p;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.keyword.ScryEffect;
@ -35,9 +34,9 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
@ -45,13 +44,6 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
*/
public class PrescientChimera extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public PrescientChimera(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}");
this.subtype.add("Chimera");
@ -62,7 +54,7 @@ public class PrescientChimera extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast an instant or sorcery spell, scry 1.
this.addAbility(new SpellCastControllerTriggeredAbility(new ScryEffect(1), filter, false));
this.addAbility(new SpellCastControllerTriggeredAbility(new ScryEffect(1), StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL, false));
}
public PrescientChimera(final PrescientChimera card) {

View file

@ -27,20 +27,21 @@
*/
package mage.cards.p;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.FilterSpell;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author LevelX2
@ -52,7 +53,7 @@ public class PsychicStrike extends CardImpl {
// Counter target spell. Its controller puts the top two cards of his or her library into his or her graveyard.
this.getSpellAbility().addTarget(new TargetSpell(new FilterSpell()));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_SPELL));
this.getSpellAbility().addEffect(new PsychicStrikeEffect());
}

View file

@ -27,17 +27,18 @@
*/
package mage.cards.p;
import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.constants.CardType;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.FilterSpell;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author North
@ -49,7 +50,7 @@ public class PunishIgnorance extends CardImpl {
// Counter target spell. Its controller loses 3 life and you gain 3 life.
this.getSpellAbility().addTarget(new TargetSpell(new FilterSpell()));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_SPELL));
this.getSpellAbility().addEffect(new CounterTargetEffect());
this.getSpellAbility().addEffect(new LoseLifeTargetControllerEffect(3));
Effect effect = new GainLifeEffect(3);

View file

@ -27,37 +27,28 @@
*/
package mage.cards.q;
import java.util.UUID;
import mage.constants.CardType;
import mage.abilities.effects.common.CounterTargetAndSearchGraveyardHandLibraryEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class Quash extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY));
}
public Quash(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{U}{U}");
// Counter target instant or sorcery spell.
// Search its controller's graveyard, hand, and library for all cards with the same name as that spell and exile them. Then that player shuffles his or her library.
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.getSpellAbility().addEffect(new CounterTargetAndSearchGraveyardHandLibraryEffect());
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.r;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
@ -40,10 +39,12 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author Quercitron
@ -54,7 +55,7 @@ public class RhysticStudy extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}");
// Whenever an opponent casts a spell, you may draw a card unless that player pays {1}.
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new RhysticStudyDrawEffect(), new FilterSpell(), false, SetTargetPointer.PLAYER));
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new RhysticStudyDrawEffect(), StaticFilters.FILTER_SPELL, false, SetTargetPointer.PLAYER));
}
public RhysticStudy(final RhysticStudy card) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -39,29 +38,26 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.target.TargetSpell;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author Loki
*/
public class SigilTracer extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Wizards you control");
private static final FilterSpell filterInstorSorc = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.not(new TappedPredicate()));
filter.add(new SubtypePredicate(SubType.WIZARD));
filterInstorSorc.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public SigilTracer(UUID ownerId, CardSetInfo setInfo) {
@ -74,7 +70,7 @@ public class SigilTracer extends CardImpl {
// {1}{U}, Tap two untapped Wizards you control: Copy target instant or sorcery spell. You may choose new targets for the copy.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CopyTargetSpellEffect(), new ManaCostsImpl("{1}{U}"));
ability.addTarget(new TargetSpell(filterInstorSorc));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, false)));
this.addAbility(ability);
}

View file

@ -27,8 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.costs.mana.GenericManaCost;
@ -39,10 +37,12 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author Galatolol
@ -53,8 +53,8 @@ public class SoulBarrier extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
// Whenever an opponent casts a creature spell, Soul Barrier deals 2 damage to that player unless he or she pays {2}.
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new SoulBarrierEffect(),
new FilterSpell(),false, SetTargetPointer.PLAYER));
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new SoulBarrierEffect(),
StaticFilters.FILTER_SPELL,false, SetTargetPointer.PLAYER));
}
public SoulBarrier(final SoulBarrier card) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
@ -39,10 +38,12 @@ import mage.constants.CardType;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author LevelX2
@ -60,7 +61,7 @@ public class SpelltitheEnforcer extends CardImpl {
this.addAbility(new SpellCastOpponentTriggeredAbility(
Zone.BATTLEFIELD,
new SpelltitheEnforcerEffect(),
new FilterSpell(),
StaticFilters.FILTER_SPELL,
false,
SetTargetPointer.PLAYER
));

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyTargetSpellEffect;
@ -35,33 +34,25 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public class SplitDecision extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public SplitDecision(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}");
// Will of the council - Choose target instant or sorcery spell. Starting with you, each player votes for denial or duplication. If denial gets more votes, counter the spell. If duplication gets more votes or the vote is tied, copy the spell. You may choose new targets for the copy.
this.getSpellAbility().addEffect(new SplitDecisionEffect());
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
}
public SplitDecision(final SplitDecision card) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
@ -39,23 +38,16 @@ import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class StratusDancer extends CardImpl {
private final static FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public StratusDancer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");
@ -74,7 +66,7 @@ public class StratusDancer extends CardImpl {
Effect effect = new CounterTargetEffect();
effect.setText("counter target instant or sorcery spell");
Ability ability = new TurnedFaceUpSourceTriggeredAbility(effect, false);
ability.addTarget(new TargetSpell(filter));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.addAbility(ability);
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.TriggeredAbilityImpl;
@ -38,7 +37,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -46,6 +45,8 @@ import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author Quercitron
@ -125,8 +126,6 @@ class TephradermCreatureDamageTriggeredAbility extends TriggeredAbilityImpl {
class TephradermSpellDamageTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterSpell FILTER_SPELL = new FilterSpell();
public TephradermSpellDamageTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(0));
}
@ -147,7 +146,7 @@ class TephradermSpellDamageTriggeredAbility extends TriggeredAbilityImpl {
}
StackObject sourceSpell = game.getStack().getStackObject(event.getSourceId());
if (sourceSpell != null && FILTER_SPELL.match(sourceSpell, getSourceId(), getControllerId(), game)) {
if (sourceSpell != null && StaticFilters.FILTER_SPELL.match(sourceSpell, getSourceId(), getControllerId(), game)) {
for (Effect effect : getEffects()) {
if (effect instanceof DamageTargetEffect) {
effect.setTargetPointer(new FixedTarget(sourceSpell.getControllerId()));

View file

@ -27,36 +27,27 @@
*/
package mage.cards.t;
import java.util.UUID;
import mage.constants.CardType;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author Loki
*/
public class Twincast extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public Twincast(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}{U}");
// Copy target instant or sorcery spell. You may choose new targets for the copy.
this.getSpellAbility().addEffect(new CopyTargetSpellEffect());
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
}
public Twincast(final Twincast card) {

View file

@ -27,15 +27,16 @@
*/
package mage.cards.u;
import java.util.UUID;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.LoseLifeTargetControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author LevelX2
@ -47,7 +48,7 @@ public class Undermine extends CardImpl {
// Counter target spell. Its controller loses 3 life.
this.getSpellAbility().addTarget(new TargetSpell(new FilterSpell()));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_SPELL));
this.getSpellAbility().addEffect(new CounterTargetEffect());
this.getSpellAbility().addEffect(new LoseLifeTargetControllerEffect(3));

View file

@ -39,10 +39,8 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetSpell;
import mage.target.common.TargetControlledPermanent;
@ -54,14 +52,6 @@ import java.util.UUID;
*/
public class UyoSilentProphet extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public UyoSilentProphet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}{U}");
addSuperType(SuperType.LEGENDARY);
@ -76,7 +66,7 @@ public class UyoSilentProphet extends CardImpl {
// {2}, Return two lands you control to their owner's hand: Copy target instant or sorcery spell. You may choose new targets for the copy.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CopyTargetSpellEffect(), new GenericManaCost(2));
ability.addCost(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(2, 2, new FilterControlledLandPermanent("lands"), false)));
ability.addTarget(new TargetSpell(filter));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.addAbility(ability);
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -38,25 +37,17 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author LoneFox
*/
public class VodalianMystic extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public VodalianMystic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");
this.subtype.add("Merfolk");
@ -66,7 +57,7 @@ public class VodalianMystic extends CardImpl {
// {T}: Target instant or sorcery spell becomes the color of your choice.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorTargetEffect(Duration.WhileOnStack), new TapSourceCost());
ability.addTarget(new TargetSpell(filter));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL));
this.addAbility(ability);
}

View file

@ -27,32 +27,23 @@
*/
package mage.cards.y;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.game.permanent.token.YoungPyromancerElementalToken;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class YoungPyromancer extends CardImpl {
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public YoungPyromancer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add("Human");
@ -62,7 +53,7 @@ public class YoungPyromancer extends CardImpl {
this.toughness = new MageInt(1);
// Whenever you cast an instant or sorcery spell, create a 1/1 red Elemental creature token.
this.addAbility(new SpellCastControllerTriggeredAbility(new CreateTokenEffect(new YoungPyromancerElementalToken()), filter, false));
this.addAbility(new SpellCastControllerTriggeredAbility(new CreateTokenEffect(new YoungPyromancerElementalToken()), StaticFilters.FILTER_INSTANT_OR_SORCERY_SPELL, false));
}

View file

@ -51,6 +51,10 @@ public final class StaticFilters {
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_INSTANT_OR_SORCERY_SPELL = new FilterSpell("instant or sorcery spell");
public static final FilterPermanent FILTER_CREATURE_TOKENS = new FilterCreaturePermanent("creature tokens");
public static final FilterPermanent FILTER_ATTACKING_CREATURES = new FilterCreaturePermanent("attacking creatures");
@ -87,6 +91,11 @@ public final class StaticFilters {
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE)
));
FILTER_INSTANT_OR_SORCERY_SPELL.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)
));
}
}

View file

@ -30,6 +30,7 @@ package mage.target;
import mage.abilities.Ability;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
@ -49,7 +50,7 @@ public class TargetSpell extends TargetObject {
private final Set<UUID> sourceIds = new HashSet<>();
public TargetSpell() {
this(1, 1, new FilterSpell());
this(1, 1, StaticFilters.FILTER_SPELL);
}
public TargetSpell(FilterSpell filter) {