- CostAdjustment: account for cases when subability uses targeting and the parent SA doesn't (e.g. Spellwild Ouphe targeted with an AF Charm instant).

This commit is contained in:
Agetian
2017-10-11 15:00:54 +00:00
parent 857d6f87a0
commit f70e33a3ea

View File

@@ -510,12 +510,13 @@ public class CostAdjustment {
}
}
if (params.containsKey("ValidTarget")) {
if (!sa.usesTargeting()) {
return false;
}
SpellAbility curSa = sa;
boolean targetValid = false;
outer: while (curSa != null) {
if (!curSa.usesTargeting()) {
curSa = curSa.getSubAbility();
continue;
}
for (GameObject target : curSa.getTargets().getTargets()) {
if (target.isValid(params.get("ValidTarget").split(","), hostCard.getController(), hostCard, curSa)) {
targetValid = true;
@@ -528,12 +529,13 @@ public class CostAdjustment {
}
}
if (params.containsKey("ValidSpellTarget")) {
if (!sa.usesTargeting()) {
return false;
}
SpellAbility curSa = sa;
boolean targetValid = false;
outer: while (curSa != null) {
if (!curSa.usesTargeting()) {
curSa = curSa.getSubAbility();
continue;
}
for (SpellAbility target : curSa.getTargets().getTargetSpells()) {
Card targetCard = target.getHostCard();
if (targetCard.isValid(params.get("ValidSpellTarget").split(","), hostCard.getController(), hostCard, curSa)) {