mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Changes to the reset handling of ManaSpentToCastWatcher.
This commit is contained in:
parent
740611119b
commit
59293271a5
2 changed files with 12 additions and 3 deletions
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue