diff --git a/forge-ai/src/main/java/forge/ai/AiProps.java b/forge-ai/src/main/java/forge/ai/AiProps.java index c707aa7c0fb..8a49258ae52 100644 --- a/forge-ai/src/main/java/forge/ai/AiProps.java +++ b/forge-ai/src/main/java/forge/ai/AiProps.java @@ -56,7 +56,8 @@ public enum AiProps { /** */ TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS ("true"), /** */ COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION ("true"), /** */ COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION ("true"), /** */ - CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT ("true"); /** */ + CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT ("true"), /** */ + CONSERVATIVE_ENERGY_PAYMENT_ONLY_DEFENSIVELY ("true"); /** */ private final String strDefaultVal; diff --git a/forge-ai/src/main/java/forge/ai/GameState.java b/forge-ai/src/main/java/forge/ai/GameState.java index 9ddf7e5be02..40192c4a66c 100644 --- a/forge-ai/src/main/java/forge/ai/GameState.java +++ b/forge-ai/src/main/java/forge/ai/GameState.java @@ -830,7 +830,6 @@ public abstract class GameState { } private void applyCountersToGameEntity(GameEntity entity, String counterString) { - //entity.setCounters(new HashMap()); entity.clearCounters(); String[] allCounterStrings = counterString.split(","); for (final String counterPair : allCounterStrings) { diff --git a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java index 01e480e68ae..4f1cdad9c15 100644 --- a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java @@ -228,12 +228,14 @@ public class CountersPutAi extends SpellAbilityAi { if ("PayEnergyConservatively".equals(sa.getParam("AILogic"))) { boolean onlyInCombat = ai.getController().isAI() && ((PlayerControllerAi) ai.getController()).getAi().getBooleanProperty(AiProps.CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT); + boolean onlyDefensive = ai.getController().isAI() + && ((PlayerControllerAi) ai.getController()).getAi().getBooleanProperty(AiProps.CONSERVATIVE_ENERGY_PAYMENT_ONLY_DEFENSIVELY); if (playAggro) { // aggro profiles ignore conservative play for this AI logic return true; } else if (ai.getGame().getCombat() != null && sa.getHostCard() != null) { - if (ai.getGame().getCombat().isAttacking(sa.getHostCard())) { + if (ai.getGame().getCombat().isAttacking(sa.getHostCard()) && !onlyDefensive) { return true; } else if (ai.getGame().getCombat().isBlocking(sa.getHostCard())) { // when blocking, consider this if it's possible to save the blocker and/or kill at least one attacker diff --git a/forge-gui/res/ai/Cautious.ai b/forge-gui/res/ai/Cautious.ai index d9061345c5e..d7b2d745400 100644 --- a/forge-gui/res/ai/Cautious.ai +++ b/forge-gui/res/ai/Cautious.ai @@ -62,3 +62,6 @@ COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=false # AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only # be used in case the creature is engaged in favorable combat CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT=true +# If true, the conservative energy payment will not be used when the creature is attacking, +# only when it's blocking (for more controlling AIs) +CONSERVATIVE_ENERGY_PAYMENT_ONLY_DEFENSIVELY=true diff --git a/forge-gui/res/ai/Default.ai b/forge-gui/res/ai/Default.ai index d338fd176cc..0850cb8bf64 100644 --- a/forge-gui/res/ai/Default.ai +++ b/forge-gui/res/ai/Default.ai @@ -61,4 +61,7 @@ COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=false # AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only # be used in case the creature is engaged in favorable combat -CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT=true \ No newline at end of file +CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT=true +# If true, the conservative energy payment will not be used when the creature is attacking, +# only when it's blocking (for more controlling AIs) +CONSERVATIVE_ENERGY_PAYMENT_ONLY_DEFENSIVELY=false \ No newline at end of file diff --git a/forge-gui/res/ai/Experimental.ai b/forge-gui/res/ai/Experimental.ai index 995a9d43b4b..520ee879294 100644 --- a/forge-gui/res/ai/Experimental.ai +++ b/forge-gui/res/ai/Experimental.ai @@ -62,3 +62,6 @@ COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=true # AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only # be used in case the creature is engaged in favorable combat CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT=true +# If true, the conservative energy payment will not be used when the creature is attacking, +# only when it's blocking (for more controlling AIs) +CONSERVATIVE_ENERGY_PAYMENT_ONLY_DEFENSIVELY=false diff --git a/forge-gui/res/ai/Reckless.ai b/forge-gui/res/ai/Reckless.ai index 5ff042997eb..1fad38748fb 100644 --- a/forge-gui/res/ai/Reckless.ai +++ b/forge-gui/res/ai/Reckless.ai @@ -62,3 +62,6 @@ COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=false # AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only # be used in case the creature is engaged in favorable combat CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT=false +# If true, the conservative energy payment will not be used when the creature is attacking, +# only when it's blocking (for more controlling AIs) +CONSERVATIVE_ENERGY_PAYMENT_ONLY_DEFENSIVELY=false