From 59293271a5306cd989263fdba109688a59aebea1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 22 Mar 2015 20:14:35 +0100 Subject: [PATCH] Changes to the reset handling of ManaSpentToCastWatcher. --- .../dynamicvalue/common/ManaSpentToCastCount.java | 1 - .../watchers/common/ManaSpentToCastWatcher.java | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java index f9274b38ff..a4734cb8da 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java @@ -34,7 +34,6 @@ import mage.abilities.effects.Effect; import mage.constants.Zone; import mage.game.Game; import mage.game.stack.Spell; -import mage.game.stack.StackObject; /** * diff --git a/Mage/src/mage/watchers/common/ManaSpentToCastWatcher.java b/Mage/src/mage/watchers/common/ManaSpentToCastWatcher.java index 03a19763d3..608e809d93 100644 --- a/Mage/src/mage/watchers/common/ManaSpentToCastWatcher.java +++ b/Mage/src/mage/watchers/common/ManaSpentToCastWatcher.java @@ -33,6 +33,7 @@ import mage.constants.WatcherScope; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; import mage.game.stack.Spell; import mage.watchers.Watcher; @@ -63,6 +64,11 @@ public class ManaSpentToCastWatcher extends Watcher { payment = spell.getSpellAbility().getManaCostsToPay().getPayment(); } } + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && this.getSourceId().equals(event.getSourceId())) { + if (((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)) { + payment = null; + } + } } @Override @@ -74,11 +80,15 @@ public class ManaSpentToCastWatcher extends Watcher { Mana returnPayment = null; if (payment != null) { returnPayment = payment.copy(); - // reset payment for next check - payment = null; } return returnPayment; } + @Override + public void reset() { + super.reset(); + payment = null; + } + }