- Fixed the AI trying to gang-block and kill an attacker which can't be killed because combat damage to it would be prevented.

- Added a couple AI hints to Ajani's Welcome.
This commit is contained in:
Agetian
2018-12-05 16:44:20 +03:00
parent 0f7df1f4e1
commit d4ee65f937
3 changed files with 14 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import com.google.common.base.Predicates;
import forge.card.CardStateName;
import forge.game.CardTraitBase;
import forge.game.GameEntity;
import forge.game.GlobalRuleChange;
import forge.game.card.*;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
@@ -771,6 +772,16 @@ public class AiBlockController {
blockers = getPossibleBlockers(combat, attacker, blockersLeft, false);
blockers.removeAll(combat.getBlockers(attacker));
// Don't add any blockers that won't kill the attacker because the damage would be prevented by a static effect
if (!ai.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noPrevention)) {
blockers = CardLists.filter(blockers, new Predicate<Card>() {
@Override
public boolean apply(Card blocker) {
return !ComputerUtilCombat.isCombatDamagePrevented(blocker, attacker, blocker.getNetCombatDamage());
}
});
}
// Try to use safe blockers first
if (blockers.size() > 0) {
safeBlockers = getSafeBlockers(combat, attacker, blockers);

View File

@@ -2560,7 +2560,7 @@ public class ComputerUtilCombat {
return original;
}
private static boolean isCombatDamagePrevented(final Card attacker, final GameEntity target, final int damage) {
public static boolean isCombatDamagePrevented(final Card attacker, final GameEntity target, final int damage) {
final Game game = attacker.getGame();
// first try to replace the damage

View File

@@ -3,4 +3,6 @@ ManaCost:W
Types:Enchantment
T:Mode$ ChangesZone | TriggerZones$ Battlefield | ValidCard$ Creature.YouCtrl | Origin$ Any | Destination$ Battlefield | Execute$ TrigGainLife | TriggerDescription$ Whenever a creature enters the battlefield under your control, you gain 1 life.
SVar:TrigGainLife:DB$ GainLife | Defined$ You | LifeAmount$ 1
SVar:PlayMain1:TRUE
SVar:AIPriorityModifier:9
Oracle:Whenever a creature enters the battlefield under your control, you gain 1 life.