@Override public SpellCastAllTriggeredAbility copy() { return new SpellCastAllTriggeredAbility(this); } }
@Override public boolean checkTrigger(GameEvent event, Game game) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) { if (setTargetPointer != SetTargetPointer.NONE) { for (Effect effect : this.getEffects()) { switch (setTargetPointer) { case SPELL: effect.setTargetPointer(new FixedTarget(spell.getId())); break; case PLAYER: effect.setTargetPointer(new FixedTarget(spell.getControllerId())); break; } } } return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (game.isActivePlayer(getControllerId()) && super.checkTrigger(event, game)) { SentinelTowerWatcher watcher = game.getState().getWatcher(SentinelTowerWatcher.class); if (watcher == null) { return false; } List<MageObjectReference> spellsCast = watcher.getSpellsThisTurn(); MageObject object = game.getObject(event.getTargetId()); if (object == null || spellsCast == null) { return false; } int damageToDeal = 0; for (MageObjectReference mor : spellsCast) { damageToDeal++; if (mor.refersTo(object, game)) { break; } } for (Effect effect : this.getEffects()) { if (effect instanceof DamageTargetEffect) { ((DamageTargetEffect) effect).setAmount(new StaticValue(damageToDeal)); return true; } } } return false; }
public ManaBreach(UUID ownerId, CardSetInfo setInfo) { 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(), StaticFilters.FILTER_SPELL, false, SetTargetPointer.PLAYER)); }
public AngelsFeather(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); // Whenever a player casts a white spell, you may gain 1 life. this.addAbility(new SpellCastAllTriggeredAbility(new GainLifeEffect(1), filter, true)); }
public AetherBarrier(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); // Whenever a player casts a creature spell, that player sacrifices a permanent unless he or she pays {1}. this.addAbility(new SpellCastAllTriggeredAbility(Zone.BATTLEFIELD, new AetherBarrierEffect(), StaticFilters.FILTER_SPELL_A_CREATURE, false, SetTargetPointer.PLAYER)); }
public IceCave(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}{U}"); // 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(), StaticFilters.FILTER_SPELL_A, false, SetTargetPointer.SPELL)); }
public DragonsClaw(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); // Whenever a player casts a red spell, you may gain 1 life. this.addAbility(new SpellCastAllTriggeredAbility(new GainLifeEffect(1), filter, true)); }
public Ricochet(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{R}"); // Whenever a player casts a spell that targets a single player, each player rolls a six-sided die. Change the target of that spell to the player with the lowest result. Reroll to break ties, if necessary. this.addAbility(new SpellCastAllTriggeredAbility(new RicochetEffect(), filter, false, SetTargetPointer.SPELL)); }
public NantukoShrine(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}"); // Whenever a player casts a spell, that player puts X 1/1 green Squirrel creature tokens onto the battlefield, where X is the number of cards in all graveyards with the same name as that spell. this.addAbility(new SpellCastAllTriggeredAbility(new NantukoShrineEffect(), StaticFilters.FILTER_SPELL, false, SetTargetPointer.SPELL)); }
public Dovescape(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W/U}{W/U}{W/U}"); // Whenever a player casts a noncreature spell, counter that spell. That player creates X 1/1 white and blue Bird creature tokens with flying, where X is the spell's converted mana cost. this.addAbility(new SpellCastAllTriggeredAbility(new DovescapeEffect(), filter, false, SetTargetPointer.SPELL)); }
public InTheEyeOfChaos(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}"); addSuperType(SuperType.WORLD); // Whenever a player casts an instant spell, counter it unless that player pays {X}, where X is its converted mana cost. this.addAbility(new SpellCastAllTriggeredAbility(Zone.BATTLEFIELD, new InTheEyeOfChaosEffect(), filter, false, SetTargetPointer.SPELL)); }
public Tangleroot(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); // Whenever a player casts a creature spell, that player adds {G}. this.addAbility(new SpellCastAllTriggeredAbility( new AddManaToManaPoolTargetControllerEffect(Mana.GreenMana(1), "their"), StaticFilters.FILTER_SPELL_A_CREATURE, false, SetTargetPointer.PLAYER)); }
public UnifyingTheory(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{U}"); // Whenever a player casts a spell, that player may pay {2}. If the player does, he or she draws a card. this.addAbility(new SpellCastAllTriggeredAbility(new UnifyingTheoryEffect() , new FilterSpell("a spell"), false, SetTargetPointer.PLAYER)); }
public PureReflection(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); // Whenever a player casts a creature spell, destroy all Reflections. Then that player creates an X/X white Reflection creature token, where X is the converted mana cost of that spell. this.addAbility(new SpellCastAllTriggeredAbility(new PureReflectionEffect(), new FilterCreatureSpell(), false, SetTargetPointer.SPELL)); }
public BloodbondMarch(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{G}"); // Whenever a player casts a creature spell, each player returns all cards with the same name as that spell from their graveyard to the battlefield. this.addAbility(new SpellCastAllTriggeredAbility(new BloodbondMarchEffect(), new FilterCreatureSpell(), false, SetTargetPointer.SPELL)); }
public HornOfPlenty(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}"); // Whenever a player casts a spell, he or she may pay {1}. If that player does, he or she draws a card at the beginning of the next end step. this.addAbility(new SpellCastAllTriggeredAbility(new HornOfPlentyEffect(), new FilterSpell("a spell"), false, SetTargetPointer.PLAYER)); }
public GladeGnarr(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}"); this.subtype.add(SubType.BEAST); this.power = new MageInt(4); this.toughness = new MageInt(4); // Whenever a player casts a blue spell, Glade Gnarr gets +2/+2 until end of turn. this.addAbility(new SpellCastAllTriggeredAbility(new BoostSourceEffect(2, 2, Duration.EndOfTurn), filter, false)); }
public BogGnarr(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}"); this.subtype.add( SubType.BEAST); this.power = new MageInt(2); this.toughness = new MageInt(2); // Whenever a player casts a black spell, Bog Gnarr gets +2/+2 until end of turn. this.addAbility(new SpellCastAllTriggeredAbility(new BoostSourceEffect(2, 2, Duration.EndOfTurn), filter, false)); }
public DemonsHorn(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); // Whenever a player casts a black spell, you may gain 1 life. this.addAbility(new SpellCastAllTriggeredAbility(new GainLifeEffect(new StaticValue(1), "you may gain 1 life"), filter, true)); }