From 3dd3cb2b6c37c849422fa6bb4dbfbb2136b67026 Mon Sep 17 00:00:00 2001 From: North Date: Fri, 14 Sep 2012 10:04:50 +0300 Subject: [PATCH] Small change to StormAbility --- .../mage/abilities/keyword/StormAbility.java | 44 +++++-------------- Utils/keywords.txt | 1 + 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/Mage/src/mage/abilities/keyword/StormAbility.java b/Mage/src/mage/abilities/keyword/StormAbility.java index 844536d356..323797f1f7 100644 --- a/Mage/src/mage/abilities/keyword/StormAbility.java +++ b/Mage/src/mage/abilities/keyword/StormAbility.java @@ -45,13 +45,9 @@ import mage.watchers.common.CastSpellLastTurnWatcher; * * @author Plopman */ +public class StormAbility extends TriggeredAbilityImpl { - -public class StormAbility extends TriggeredAbilityImpl{ - - - public StormAbility() - { + public StormAbility() { super(Constants.Zone.STACK, new StormEffect()); } @@ -65,18 +61,12 @@ public class StormAbility extends TriggeredAbilityImpl{ @Override public boolean checkTrigger(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.SPELL_CAST && event.getSourceId().equals(this.sourceId)) - { + if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getSourceId().equals(this.sourceId)) { StackObject spell = game.getStack().getStackObject(this.sourceId); - if(spell instanceof Spell) - { - for(Effect effect : this.getEffects()) - { - if(effect instanceof StormEffect) - { - ((StormEffect)effect).setSpell((Spell)spell); - } - } + if (spell instanceof Spell) { + for (Effect effect : this.getEffects()) { + effect.setValue("StormSpell", spell); + } return true; } } @@ -87,28 +77,25 @@ public class StormAbility extends TriggeredAbilityImpl{ public String getRule() { return "Storm"; } - } + class StormEffect extends OneShotEffect { - private Spell spell; - public StormEffect() { super(Constants.Outcome.Copy); } public StormEffect(final StormEffect effect) { super(effect); - this.spell = effect.spell; } @Override public boolean apply(Game game, Ability source) { + Spell spell = (Spell) this.getValue("StormSpell"); if (spell != null) { CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher"); - - for(int i = 0; i < watcher.getSpellOrder(spell) - 1; i++) - { + + for (int i = 0; i < watcher.getSpellOrder(spell) - 1; i++) { Spell copy = spell.copySpell(); copy.setControllerId(source.getControllerId()); copy.setCopiedSpell(true); @@ -124,13 +111,4 @@ class StormEffect extends OneShotEffect { public StormEffect copy() { return new StormEffect(this); } - - public void setSpell(Spell spell) { - this.spell = spell; - } - - - - } - diff --git a/Utils/keywords.txt b/Utils/keywords.txt index 09ace73b0a..299ec88911 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -19,6 +19,7 @@ Mountainwalk|new| Persist|new| Plainswalk|new| Rebound|new| +Storm|new| Swampwalk|new| Totem armor|new| Unblockable|new|