mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
- 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:
@@ -22,6 +22,7 @@ import com.google.common.base.Predicates;
|
|||||||
import forge.card.CardStateName;
|
import forge.card.CardStateName;
|
||||||
import forge.game.CardTraitBase;
|
import forge.game.CardTraitBase;
|
||||||
import forge.game.GameEntity;
|
import forge.game.GameEntity;
|
||||||
|
import forge.game.GlobalRuleChange;
|
||||||
import forge.game.card.*;
|
import forge.game.card.*;
|
||||||
import forge.game.combat.Combat;
|
import forge.game.combat.Combat;
|
||||||
import forge.game.combat.CombatUtil;
|
import forge.game.combat.CombatUtil;
|
||||||
@@ -771,6 +772,16 @@ public class AiBlockController {
|
|||||||
blockers = getPossibleBlockers(combat, attacker, blockersLeft, false);
|
blockers = getPossibleBlockers(combat, attacker, blockersLeft, false);
|
||||||
blockers.removeAll(combat.getBlockers(attacker));
|
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
|
// Try to use safe blockers first
|
||||||
if (blockers.size() > 0) {
|
if (blockers.size() > 0) {
|
||||||
safeBlockers = getSafeBlockers(combat, attacker, blockers);
|
safeBlockers = getSafeBlockers(combat, attacker, blockers);
|
||||||
|
|||||||
@@ -2560,7 +2560,7 @@ public class ComputerUtilCombat {
|
|||||||
return original;
|
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();
|
final Game game = attacker.getGame();
|
||||||
|
|
||||||
// first try to replace the damage
|
// first try to replace the damage
|
||||||
|
|||||||
@@ -3,4 +3,6 @@ ManaCost:W
|
|||||||
Types:Enchantment
|
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.
|
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: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.
|
Oracle:Whenever a creature enters the battlefield under your control, you gain 1 life.
|
||||||
Reference in New Issue
Block a user