From 456c405c11cac3789155adc06662a79225758136 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 7 Nov 2015 08:35:56 +0100 Subject: [PATCH] * Glade Gnarr - Removed unneccessary custom class. --- .../src/mage/sets/apocalypse/GladeGnarr.java | 57 ++++--------------- 1 file changed, 11 insertions(+), 46 deletions(-) diff --git a/Mage.Sets/src/mage/sets/apocalypse/GladeGnarr.java b/Mage.Sets/src/mage/sets/apocalypse/GladeGnarr.java index ec27442e28..d09a25aafd 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/GladeGnarr.java +++ b/Mage.Sets/src/mage/sets/apocalypse/GladeGnarr.java @@ -30,25 +30,26 @@ package mage.sets.apocalypse; import java.util.UUID; import mage.MageInt; import mage.ObjectColor; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SpellCastAllTriggeredAbility; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Rarity; -import mage.constants.Zone; -import mage.filter.FilterCard; +import mage.filter.FilterSpell; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.game.stack.Spell; /** * @author Loki */ public class GladeGnarr extends CardImpl { + private static final FilterSpell filter = new FilterSpell("a blue spell"); + + static { + filter.add(new ColorPredicate(ObjectColor.BLUE)); + } + public GladeGnarr(UUID ownerId) { super(ownerId, 78, "Glade Gnarr", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{G}"); this.expansionSetCode = "APC"; @@ -56,7 +57,9 @@ public class GladeGnarr extends CardImpl { this.power = new MageInt(4); this.toughness = new MageInt(4); - this.addAbility(new GladeGnarrTriggeredAbility()); + + // 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 GladeGnarr(final GladeGnarr card) { @@ -68,41 +71,3 @@ public class GladeGnarr extends CardImpl { return new GladeGnarr(this); } } - -class GladeGnarrTriggeredAbility extends TriggeredAbilityImpl { - - private static final FilterCard filter = new FilterCard("a blue spell"); - - static { - filter.add(new ColorPredicate(ObjectColor.BLUE)); - } - - public GladeGnarrTriggeredAbility() { - super(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), false); - } - - public GladeGnarrTriggeredAbility(final GladeGnarrTriggeredAbility ability) { - super(ability); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.SPELL_CAST; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - return spell != null && filter.match(spell, game); - } - - @Override - public String getRule() { - return "Whenever a player casts " + filter.getMessage() + ", " + super.getRule(); - } - - @Override - public GladeGnarrTriggeredAbility copy() { - return new GladeGnarrTriggeredAbility(this); - } -} \ No newline at end of file