From 15f75f8d11f47df152b081551c3e76868af0745c Mon Sep 17 00:00:00 2001 From: BetaSteward Date: Sun, 9 Oct 2011 14:58:08 -0400 Subject: [PATCH] fixed issue 141 --- .../championsofkamigawa/GhostlyPrison.java | 9 +++------ .../src/mage/sets/newphyrexia/NornsAnnex.java | 4 +--- .../sets/scarsofmirrodin/LeoninArbiter.java | 4 +--- .../sets/scarsofmirrodin/VigilForTheLost.java | 2 +- .../src/mage/sets/tempest/Propaganda.java | 4 +--- .../src/mage/sets/tenth/WindbornMuse.java | 4 +--- .../abilities/costs/mana/ManaCostsImpl.java | 19 +++++++++++++++++++ 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/GhostlyPrison.java b/Mage.Sets/src/mage/sets/championsofkamigawa/GhostlyPrison.java index bcd8a5e0209..95621819bd8 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/GhostlyPrison.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/GhostlyPrison.java @@ -91,16 +91,13 @@ class GhostlyPrisonReplacementEffect extends ReplacementEffectImpl { public boolean apply(Game game, Ability source) { ManaCostsImpl cost = new ManaCostsImpl("{X}"); cost.clearPaid(); - if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) { + if (cost.payOrRollback(source, game, source.getId(), source.getControllerId())) { Player player = game.getPlayer(source.getControllerId()); player.gainLife(cost.getX(), game); return true; diff --git a/Mage.Sets/src/mage/sets/tempest/Propaganda.java b/Mage.Sets/src/mage/sets/tempest/Propaganda.java index 3ea3b8e7911..089106e161f 100644 --- a/Mage.Sets/src/mage/sets/tempest/Propaganda.java +++ b/Mage.Sets/src/mage/sets/tempest/Propaganda.java @@ -93,9 +93,7 @@ class PropagandaReplacementEffect extends ReplacementEffectImpl extends ArrayList implements M return true; } + /** + * bookmarks the current state and restores it if player doesn't pay the mana cost + * + * @param ability + * @param game + * @param sourceId + * @param controllerId + * @return true if the cost was paid + */ + public boolean payOrRollback(Ability ability, Game game, UUID sourceId, UUID controllerId) { + int bookmark = game.bookmarkState(); + if (pay(ability, game, sourceId, controllerId, false)) { + game.removeBookmark(bookmark); + return true; + } + game.restoreState(bookmark); + return false; + } + @Override public ManaCosts getUnpaid() { ManaCosts unpaid = new ManaCostsImpl();