mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 21:42:07 -08:00
use staticfilter for 'a spell'
This commit is contained in:
parent
dfc290a206
commit
b4d806211c
23 changed files with 46 additions and 31 deletions
|
|
@ -5,6 +5,7 @@ import mage.abilities.effects.Effect;
|
|||
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.stack.Spell;
|
||||
|
|
@ -15,12 +16,11 @@ import mage.target.targetpointer.FixedTarget;
|
|||
*/
|
||||
public class SpellCastOpponentTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private static final FilterSpell spellCard = new FilterSpell("a spell");
|
||||
protected FilterSpell filter;
|
||||
protected SetTargetPointer setTargetPointer;
|
||||
|
||||
public SpellCastOpponentTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, spellCard, optional);
|
||||
this(effect, StaticFilters.FILTER_SPELL_A, optional);
|
||||
}
|
||||
|
||||
public SpellCastOpponentTriggeredAbility(Effect effect, FilterSpell filter, boolean optional) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ public final class ChandraTorchOfDefianceEmblem extends Emblem {
|
|||
this.setName("Emblem Chandra");
|
||||
Effect effect = new DamageTargetEffect(5);
|
||||
effect.setText("this emblem deals 5 damage to any target");
|
||||
Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, new FilterSpell("a spell"), false, false);
|
||||
Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, StaticFilters.FILTER_SPELL_A, false, false);
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
getAbilities().add(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.common.MillCardsTargetEffect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
|
|
@ -19,7 +20,7 @@ public final class JaceTelepathUnboundEmblem extends Emblem {
|
|||
this.setName("Emblem Jace");
|
||||
Effect effect = new MillCardsTargetEffect(5);
|
||||
effect.setText("target opponent mills five cards");
|
||||
Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, new FilterSpell("a spell"), false, false);
|
||||
Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, StaticFilters.FILTER_SPELL_A, false, false);
|
||||
ability.addTarget(new TargetOpponent());
|
||||
getAbilities().add(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.common.ExileTargetEffect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -36,8 +37,6 @@ public final class VenserTheSojournerEmblem extends Emblem {
|
|||
|
||||
class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private static final FilterSpell spellCard = new FilterSpell("a spell");
|
||||
protected FilterSpell filter;
|
||||
|
||||
/**
|
||||
* If true, the source that triggered the ability will be set as target to
|
||||
|
|
@ -46,12 +45,10 @@ class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public VenserTheSojournerSpellCastTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.COMMAND, effect, optional);
|
||||
this.filter = spellCard;
|
||||
}
|
||||
|
||||
public VenserTheSojournerSpellCastTriggeredAbility(final VenserTheSojournerSpellCastTriggeredAbility ability) {
|
||||
super(ability);
|
||||
filter = ability.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -63,7 +60,7 @@ class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
return spell != null && filter.match(spell, game);
|
||||
return spell != null && StaticFilters.FILTER_SPELL_A.match(spell, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import mage.abilities.effects.common.RollPlanarDieEffect;
|
|||
import mage.abilities.effects.common.cost.PlanarDieRollCostIncreasingEffect;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Plane;
|
||||
import mage.players.Player;
|
||||
|
|
@ -29,14 +30,13 @@ import java.util.List;
|
|||
*/
|
||||
public class FieldsOfSummerPlane extends Plane {
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell("a spell");
|
||||
|
||||
public FieldsOfSummerPlane() {
|
||||
this.setPlaneType(Planes.PLANE_FIELDS_OF_SUMMER);
|
||||
this.setExpansionSetCodeForImage("PCA");
|
||||
|
||||
// Whenever a player casts a spell, that player may gain 2 life
|
||||
SpellCastAllTriggeredAbility ability = new SpellCastAllTriggeredAbility(Zone.COMMAND, new FieldsOfSummerEffect(), filter, false, SetTargetPointer.PLAYER);
|
||||
SpellCastAllTriggeredAbility ability = new SpellCastAllTriggeredAbility(Zone.COMMAND, new FieldsOfSummerEffect(), StaticFilters.FILTER_SPELL_A, false, SetTargetPointer.PLAYER);
|
||||
this.getAbilities().add(ability);
|
||||
|
||||
// Active player can roll the planar die: Whenever you roll {CHAOS}, you may gain 10 life
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue