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.

This commit is contained in:
LevelX2 2013-04-01 10:58:11 +02:00
parent 7ef08656f6
commit 5f17804e93
2 changed files with 13 additions and 0 deletions

View file

@ -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<MiracleAbility> {

View file

@ -108,6 +108,7 @@ public class MiracleWatcher extends WatcherImpl<MiracleWatcher> {
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<MiracleWatcher> {
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;
}
}