From 4941da593f4b6747530d02ff7f4cf4a2b259c3fd Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Thu, 20 Jul 2023 20:56:24 +0200 Subject: [PATCH] Fix casting with unpayable cost if no alternative provided --- .../java/forge/game/ability/effects/PlayEffect.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/forge-game/src/main/java/forge/game/ability/effects/PlayEffect.java b/forge-game/src/main/java/forge/game/ability/effects/PlayEffect.java index 7ec1c6447a0..e1439b8e9c4 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/PlayEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/PlayEffect.java @@ -370,15 +370,23 @@ public class PlayEffect extends SpellAbilityEffect { if ((sa.hasParam("WithoutManaCost") || sa.hasParam("PlayCost")) && tgtSA.costHasManaX() && !tgtSA.getPayCosts().getCostMana().canXbe0()) { continue; } + + boolean unpayableCost = tgtSA.getHostCard().getManaCost().isNoCost(); if (sa.hasParam("WithoutManaCost")) { tgtSA = tgtSA.copyWithNoManaCost(); } else if (sa.hasParam("PlayCost")) { Cost abCost; String cost = sa.getParam("PlayCost"); if (cost.equals("ManaCost")) { + if (unpayableCost) { + continue; + } abCost = new Cost(source.getManaCost(), false); } else { if (cost.contains("ConvertedManaCost")) { + if (unpayableCost) { + continue; + } final String costcmc = Integer.toString(tgtCard.getCMC()); cost = cost.replace("ConvertedManaCost", costcmc); } @@ -386,6 +394,8 @@ public class PlayEffect extends SpellAbilityEffect { } tgtSA = tgtSA.copyWithManaCostReplaced(tgtSA.getActivatingPlayer(), abCost); + } else if (unpayableCost) { + continue; } if (!optional) {