- The AI should not try to illegally target a player in case it can't find any other legal target to provide (e.g. Muck Drebb + Lightning Bolt to the face).

This commit is contained in:
Agetian
2017-01-22 11:14:45 +00:00
parent b62dad0793
commit 61b06410ea
2 changed files with 5 additions and 1 deletions

View File

@@ -170,7 +170,7 @@ public abstract class SpellAbilityAi {
// try to target opponent, then ally, then itself // try to target opponent, then ally, then itself
for (final Player p : players) { for (final Player p : players) {
if (p.canBeTargetedBy(sa)) { if (p.canBeTargetedBy(sa) && sa.canTarget(p)) {
sa.resetTargets(); sa.resetTargets();
sa.getTargets().add(p); sa.getTargets().add(p);
return true; return true;

View File

@@ -62,6 +62,10 @@ public class ChangeTargetsAi extends SpellAbilityAi {
// don't try targeting it if we can't legally target the host card with it in the first place // don't try targeting it if we can't legally target the host card with it in the first place
return false; return false;
} }
if (!sa.canTarget(topSa)) {
// don't try retargeting a spell that the current card can't legally retarget (e.g. Muck Drubb + Lightning Bolt to the face)
return false;
}
if (sa.getPayCosts().getCostMana() != null && sa.getPayCosts().getCostMana().getMana().hasPhyrexian()) { if (sa.getPayCosts().getCostMana() != null && sa.getPayCosts().getCostMana().getMana().hasPhyrexian()) {
ManaCost manaCost = sa.getPayCosts().getCostMana().getMana(); ManaCost manaCost = sa.getPayCosts().getCostMana().getMana();