From 5f17804e93bcf45ed3eb05847fea1a67144563c1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 1 Apr 2013 10:58:11 +0200 Subject: [PATCH] Fixed a bug of miracle keyword, were in case you canceled to cast the spell for it miracle costs, the card could be cast later in turn also for miracle cost instead of regular costs. --- Mage/src/mage/abilities/keyword/MiracleAbility.java | 5 +++++ Mage/src/mage/watchers/common/MiracleWatcher.java | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/Mage/src/mage/abilities/keyword/MiracleAbility.java b/Mage/src/mage/abilities/keyword/MiracleAbility.java index 6fa5d8ab81f..41c0d779c1f 100644 --- a/Mage/src/mage/abilities/keyword/MiracleAbility.java +++ b/Mage/src/mage/abilities/keyword/MiracleAbility.java @@ -44,6 +44,11 @@ import mage.abilities.costs.Cost; * plays with that card revealed until that card leaves his or her hand, that ability * resolves, or that ability otherwise leaves the stack. * + * You can cast a card for its miracle cost only as the miracle triggered ability resolves. + * If you don't want to cast it at that time (or you can't cast it, perhaps because + * there are no legal targets available), you won't be able to cast it later for the miracle cost. + * + * * @author noxx */ public class MiracleAbility extends StaticAbility { diff --git a/Mage/src/mage/watchers/common/MiracleWatcher.java b/Mage/src/mage/watchers/common/MiracleWatcher.java index db5505aeb13..d20c1ea845d 100644 --- a/Mage/src/mage/watchers/common/MiracleWatcher.java +++ b/Mage/src/mage/watchers/common/MiracleWatcher.java @@ -108,6 +108,7 @@ public class MiracleWatcher extends WatcherImpl { controller.lookAtCards("Miracle", cards, game); if (controller.chooseUse(Outcome.Benefit, "Use Miracle " + manaCostsToPay.getText() + "?", game)) { controller.revealCards("Miracle", cards, game); + ManaCosts costRef = card.getSpellAbility().getManaCostsToPay(); // replace with the new cost costRef.clear(); @@ -115,6 +116,13 @@ public class MiracleWatcher extends WatcherImpl { costRef.add(manaCost); } controller.cast(card.getSpellAbility(), game, false); + + // Reset the casting costs (in case the player cancels cast and plays the card later) + costRef.clear(); + for (ManaCost manaCost : card.getSpellAbility().getManaCosts()) { + costRef.add(manaCost); + } + break; } }