- Some more fine-grained control over AILogic PayEnergyConservatively.

This commit is contained in:
Agetian
2017-08-23 15:16:47 +00:00
parent 3e4e87db23
commit abe710f3ab
7 changed files with 18 additions and 4 deletions

View File

@@ -56,7 +56,8 @@ public enum AiProps { /** */
TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS ("true"), /** */ TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS ("true"), /** */
COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION ("true"), /** */ COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION ("true"), /** */
COMBAT_ATTRITION_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; private final String strDefaultVal;

View File

@@ -830,7 +830,6 @@ public abstract class GameState {
} }
private void applyCountersToGameEntity(GameEntity entity, String counterString) { private void applyCountersToGameEntity(GameEntity entity, String counterString) {
//entity.setCounters(new HashMap<CounterType, Integer>());
entity.clearCounters(); entity.clearCounters();
String[] allCounterStrings = counterString.split(","); String[] allCounterStrings = counterString.split(",");
for (final String counterPair : allCounterStrings) { for (final String counterPair : allCounterStrings) {

View File

@@ -228,12 +228,14 @@ public class CountersPutAi extends SpellAbilityAi {
if ("PayEnergyConservatively".equals(sa.getParam("AILogic"))) { if ("PayEnergyConservatively".equals(sa.getParam("AILogic"))) {
boolean onlyInCombat = ai.getController().isAI() boolean onlyInCombat = ai.getController().isAI()
&& ((PlayerControllerAi) ai.getController()).getAi().getBooleanProperty(AiProps.CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT); && ((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) { if (playAggro) {
// aggro profiles ignore conservative play for this AI logic // aggro profiles ignore conservative play for this AI logic
return true; return true;
} else if (ai.getGame().getCombat() != null && sa.getHostCard() != null) { } 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; return true;
} else if (ai.getGame().getCombat().isBlocking(sa.getHostCard())) { } 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 // when blocking, consider this if it's possible to save the blocker and/or kill at least one attacker

View File

@@ -62,3 +62,6 @@ COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=false
# AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only # AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only
# be used in case the creature is engaged in favorable combat # be used in case the creature is engaged in favorable combat
CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT=true 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

View File

@@ -61,4 +61,7 @@ COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=false
# AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only # AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only
# be used in case the creature is engaged in favorable combat # be used in case the creature is engaged in favorable combat
CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT=true 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

View File

@@ -62,3 +62,6 @@ COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=true
# AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only # AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only
# be used in case the creature is engaged in favorable combat # be used in case the creature is engaged in favorable combat
CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT=true 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

View File

@@ -62,3 +62,6 @@ COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=false
# AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only # AILogic$ PayEnergyConservatively (used for Britsling Hydra and Longtusk Cub) will only
# be used in case the creature is engaged in favorable combat # be used in case the creature is engaged in favorable combat
CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT=false 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