- AiController: a more robust check for potential targets in order to avoid the AI activating an ability it can't legally target due to restrictions (e.g. Wicked Akuba).

This commit is contained in:
Agetian
2018-01-30 19:20:24 +03:00
parent d8a284ebb9
commit 369c4f77a0

View File

@@ -662,6 +662,11 @@ public class AiController {
if (sa instanceof SpellPermanent) { if (sa instanceof SpellPermanent) {
return canPlayFromEffectAI((SpellPermanent)sa, false, true); return canPlayFromEffectAI((SpellPermanent)sa, false, true);
} }
if (sa.usesTargeting()) {
if (!sa.getTargetRestrictions().hasCandidates(sa, true)) {
return AiPlayDecision.TargetingFailed;
}
}
if (sa instanceof Spell) { if (sa instanceof Spell) {
if (ComputerUtil.getDamageForPlaying(player, sa) >= player.getLife() if (ComputerUtil.getDamageForPlaying(player, sa) >= player.getLife()
&& !player.cantLoseForZeroOrLessLife() && player.canLoseLife()) { && !player.cantLoseForZeroOrLessLife() && player.canLoseLife()) {