mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- 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:
@@ -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;
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user