Add AI support for Fiery Justice.

This commit is contained in:
Eric
2022-09-11 20:56:56 -05:00
parent e54f0e0f41
commit c094721b60
3 changed files with 14 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package forge.ai.ability;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCombat;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
@@ -71,6 +72,11 @@ public abstract class DamageAiBase extends SpellAbilityAi {
return false;
}
// If the opponent will gain life (ex. Fiery Justice), not beneficial unless life gain is harmful or ignored
if ("OpponentGainLife".equals(sa.getParam("AILogic")) && ComputerUtil.lifegainPositive(enemy, sa.getHostCard())) {
return false;
}
// Benefits hitting players?
// If has triggered ability on dealing damage to an opponent, go for it!
Card hostcard = sa.getHostCard();

View File

@@ -781,6 +781,13 @@ public class DamageDealAi extends DamageAiBase {
sa.resetTargets();
return false;
}
// if opponent will gain life (ex. Fiery Justice), don't target only enemy player unless life gain is harmful or ignored
if ("OpponentGainLife".equals(logic) && tcs.size() == 1 && tcs.contains(enemy) && ComputerUtil.lifegainPositive(enemy, source)){
sa.resetTargets();
return false;
}
return true;
}

View File

@@ -1,7 +1,6 @@
Name:Fiery Justice
ManaCost:R G W
Types:Sorcery
A:SP$ DealDamage | Cost$ R G W | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target to distribute damage to | NumDmg$ 5 | TargetMin$ 1 | TargetMax$ 5 | DividedAsYouChoose$ 5 | SubAbility$ Justice | SpellDescription$ CARDNAME deals 5 damage divided as you choose among any number of targets. Target opponent gains 5 life.
A:SP$ DealDamage | Cost$ R G W | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target to distribute damage to | NumDmg$ 5 | TargetMin$ 1 | TargetMax$ 5 | DividedAsYouChoose$ 5 | AILogic$ OpponentGainLife | SubAbility$ Justice | SpellDescription$ CARDNAME deals 5 damage divided as you choose among any number of targets. Target opponent gains 5 life.
SVar:Justice:DB$ GainLife | ValidTgts$ Opponent | TgtPrompt$ Select target opponent to gain life | LifeAmount$ 5
AI:RemoveDeck:All
Oracle:Fiery Justice deals 5 damage divided as you choose among any number of targets. Target opponent gains 5 life.