- Improve damage chaining so that the AI doesn't try to chain a spell with restricted targeting to a general use spell (e.g. a spell that targets only attacking creatures to a Lightning Strike outside of combat).

This commit is contained in:
Agetian
2018-12-13 20:08:01 +03:00
parent 8419eeea8f
commit 3896a79cfa

View File

@@ -1070,6 +1070,14 @@ public class DamageDealAi extends DamageAiBase {
continue;
} else if (tgtSa.canTgtPlaneswalker() && !tgtAb.canTgtPlaneswalker()) {
continue;
} else if ((tgtSa.getSAValidTargeting() != null && tgtSa.getSAValidTargeting().contains("."))
|| (tgtAb.getSAValidTargeting() != null && tgtAb.getSAValidTargeting().contains("."))) {
if (!tgtAb.getSAValidTargeting().contains(tgtSa.getSAValidTargeting())) {
// if the targeting has additional conditions, make sure that the chained spell
// contains the same condition specifications (or at least these specs are a part
// of what SA can target, hopefully)
continue;
}
}
// FIXME: should it also check restrictions for targeting players?
ManaCost costSa = sa.getPayCosts() != null ? sa.getPayCosts().getTotalMana() : ManaCost.NO_COST;