mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Some more fine-grained control over AILogic PayEnergyConservatively.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user