- Prevent the AI from relying on the ability to play a spell with an optional cost when deciding to do an assault attack with possible non-combat damage (prevents certain silly suicidal chump-attacks)

This commit is contained in:
Agetian
2018-12-15 09:10:55 +03:00
parent 134b4a7d77
commit f9cd173405
2 changed files with 5 additions and 4 deletions

View File

@@ -26,10 +26,7 @@ import forge.card.CardType;
import forge.card.ColorSet;
import forge.card.MagicColor;
import forge.card.mana.ManaCostShard;
import forge.game.CardTraitPredicates;
import forge.game.Game;
import forge.game.GameObject;
import forge.game.GameType;
import forge.game.*;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
@@ -1454,6 +1451,9 @@ public class ComputerUtil {
if (!ComputerUtilCost.canPayCost(sa, ai)) {
continue;
}
if (!GameActionUtil.getOptionalCostValues(sa).isEmpty()) {
continue; // we can't rely on the AI being always willing and able to pay the optional cost to deal extra damage
}
damage = dmg;
}

View File

@@ -466,6 +466,7 @@ public final class GameActionUtil {
newSA.setPayCosts(new Cost(jumpstartCost, false).add(newSA.getPayCosts()));
newSA.getRestrictions().setZone(ZoneType.Graveyard);
newSA.setDescription(newSA.getDescription() + " (Jump-start)");
newSA.addOptionalCost(OptionalCost.Jumpstart);
if (newSA.canPlay()) {
abilities.add(i, newSA);
i++;