Finish RestrictValid check early if cost is for effect

This commit is contained in:
TRT
2022-03-18 15:02:42 +01:00
committed by tool4EvEr
parent b317e46353
commit faefab9395
2 changed files with 11 additions and 3 deletions

View File

@@ -312,8 +312,11 @@ public class AbilityManaPart implements java.io.Serializable {
continue;
}
if (restriction.startsWith("CostContainsX")) {
if (sa.costHasManaX()) {
if (restriction.startsWith("CostContains")) {
if (restriction.endsWith("X") && sa.costHasManaX()) {
return true;
}
if (restriction.endsWith("C") && sa.getPayCosts().hasManaCost() && sa.getPayCosts().getCostMana().getManaToPay().getGenericCost() > 0) {
return true;
}
continue;
@@ -338,6 +341,11 @@ public class AbilityManaPart implements java.io.Serializable {
return true;
}
// the payment is for a resolving SA, currently no other restrictions would allow that
if (getSourceCard().getGame().getStack().getInstanceFromSpellAbility(sa.getRootAbility()) != null) {
return false;
}
if (sa.isValid(restriction, this.getSourceCard().getController(), this.getSourceCard(), null)) {
return true;
}