fix #13433 (DoIfCostPaid regression), add test

This commit is contained in:
xenohedron 2025-03-15 17:45:28 -04:00
parent bf8c8c4e99
commit 7b03af3de3
2 changed files with 30 additions and 7 deletions

View file

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