- 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"), /** */
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;

View File

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

View File

@@ -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