mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Fix casting with unpayable cost if no alternative provided
This commit is contained in:
@@ -370,15 +370,23 @@ public class PlayEffect extends SpellAbilityEffect {
|
|||||||
if ((sa.hasParam("WithoutManaCost") || sa.hasParam("PlayCost")) && tgtSA.costHasManaX() && !tgtSA.getPayCosts().getCostMana().canXbe0()) {
|
if ((sa.hasParam("WithoutManaCost") || sa.hasParam("PlayCost")) && tgtSA.costHasManaX() && !tgtSA.getPayCosts().getCostMana().canXbe0()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean unpayableCost = tgtSA.getHostCard().getManaCost().isNoCost();
|
||||||
if (sa.hasParam("WithoutManaCost")) {
|
if (sa.hasParam("WithoutManaCost")) {
|
||||||
tgtSA = tgtSA.copyWithNoManaCost();
|
tgtSA = tgtSA.copyWithNoManaCost();
|
||||||
} else if (sa.hasParam("PlayCost")) {
|
} else if (sa.hasParam("PlayCost")) {
|
||||||
Cost abCost;
|
Cost abCost;
|
||||||
String cost = sa.getParam("PlayCost");
|
String cost = sa.getParam("PlayCost");
|
||||||
if (cost.equals("ManaCost")) {
|
if (cost.equals("ManaCost")) {
|
||||||
|
if (unpayableCost) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
abCost = new Cost(source.getManaCost(), false);
|
abCost = new Cost(source.getManaCost(), false);
|
||||||
} else {
|
} else {
|
||||||
if (cost.contains("ConvertedManaCost")) {
|
if (cost.contains("ConvertedManaCost")) {
|
||||||
|
if (unpayableCost) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
final String costcmc = Integer.toString(tgtCard.getCMC());
|
final String costcmc = Integer.toString(tgtCard.getCMC());
|
||||||
cost = cost.replace("ConvertedManaCost", costcmc);
|
cost = cost.replace("ConvertedManaCost", costcmc);
|
||||||
}
|
}
|
||||||
@@ -386,6 +394,8 @@ public class PlayEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tgtSA = tgtSA.copyWithManaCostReplaced(tgtSA.getActivatingPlayer(), abCost);
|
tgtSA = tgtSA.copyWithManaCostReplaced(tgtSA.getActivatingPlayer(), abCost);
|
||||||
|
} else if (unpayableCost) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!optional) {
|
if (!optional) {
|
||||||
|
|||||||
Reference in New Issue
Block a user