forked from External/mage
fix #13433 (DoIfCostPaid regression), add test
This commit is contained in:
parent
bf8c8c4e99
commit
7b03af3de3
2 changed files with 30 additions and 7 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue