diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/DoIfCostPaidTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/DoIfCostPaidTest.java index b24e05559eb..0df14fb489a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/DoIfCostPaidTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/DoIfCostPaidTest.java @@ -98,4 +98,31 @@ public class DoIfCostPaidTest extends CardTestPlayerBase { execute(); } + @Test + public void testCannotPay() { + String thirst = "Thirst for Meaning"; // Draw three cards. Then discard two cards unless you discard an enchantment card. + skipInitShuffling(); + addCard(Zone.LIBRARY, playerA, "Craw Wurm"); + addCard(Zone.LIBRARY, playerA, "Runeclaw Bear"); + addCard(Zone.LIBRARY, playerA, "Glory Seeker"); + addCard(Zone.HAND, playerA, thirst); + addCard(Zone.BATTLEFIELD, playerA, "Island", 3); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, thirst); + // can't discard enchantment, so must discard two + setChoice(playerA, "Runeclaw Bear"); + setChoice(playerA, "Glory Seeker"); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, 3); + assertGraveyardCount(playerA, thirst, 1); + assertGraveyardCount(playerA, "Runeclaw Bear", 1); + assertGraveyardCount(playerA, "Glory Seeker", 1); + assertHandCount(playerA, 1); + assertHandCount(playerA, "Craw Wurm", 1); + } + } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java index e577f5d4ea0..321c0ef7787 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java @@ -98,16 +98,12 @@ public class DoIfCostPaid extends OneShotEffect { if (player == null || mageObject == null) { return false; } - - // nothing to pay (do not support mana cost - it's true all the time) - if (!this.cost.canPay(source, source, player.getId(), game)) { - return false; - } - String message = CardUtil.replaceSourceName(makeChooseText(game, source), mageObject.getName()); Outcome payOutcome = executingEffects.getOutcome(source, this.outcome); + // nothing to pay (do not support mana cost - it's true all the time) + boolean canPay = cost.canPay(source, source, player.getId(), game); boolean didPay = false; - if (!optional || player.chooseUse(payOutcome, message, source, game)) { + if (canPay && (!optional || player.chooseUse(payOutcome, message, source, game))) { cost.clearPaid(); int bookmark = game.bookmarkState(); if (cost.pay(source, game, source, player.getId(), false)) {