- Experimental: attempting to improve the AI choice for attrition attack when predicting possible opponent's forces with evasion (e.g. Flying). Currently enabled only for the Experimental AI profile for the testing period.

This commit is contained in:
Agetian
2017-08-21 17:29:57 +00:00
parent 12452c9b2a
commit 1e6467cf80
6 changed files with 35 additions and 2 deletions

View File

@@ -243,6 +243,19 @@ public class AiAttackController {
return false; return false;
} }
public final static Card getCardCanBlockAnAttacker(final Card c, final List<Card> attackers, final boolean nextTurn) {
final List<Card> attackerList = new ArrayList<Card>(attackers);
if (!c.isCreature()) {
return null;
}
for (final Card attacker : attackerList) {
if (CombatUtil.canBlock(attacker, c, nextTurn)) {
return attacker;
}
}
return null;
}
// this checks to make sure that the computer player doesn't lose when the human player attacks // this checks to make sure that the computer player doesn't lose when the human player attacks
// this method is used by getAttackers() // this method is used by getAttackers()
public final List<Card> notNeededAsBlockers(final Player ai, final List<Card> attackers) { public final List<Card> notNeededAsBlockers(final Player ai, final List<Card> attackers) {
@@ -734,8 +747,15 @@ public class AiAttackController {
humanForces += 1; // player forces they might use to attack humanForces += 1; // player forces they might use to attack
} }
// increment player forces that are relevant to an attritional attack - includes walls // increment player forces that are relevant to an attritional attack - includes walls
if (canBlockAnAttacker(pCard, candidateAttackers, true)) {
boolean predictEvasion = (ai.getController().isAI()
&& ((PlayerControllerAi)ai.getController()).getAi().getBooleanProperty(AiProps.COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION));
Card potentialOppBlocker = getCardCanBlockAnAttacker(pCard, candidateAttackers, true);
if (potentialOppBlocker != null) {
humanForcesForAttritionalAttack += 1; humanForcesForAttritionalAttack += 1;
if (predictEvasion) {
candidateAttackers.remove(potentialOppBlocker);
}
} }
} }

View File

@@ -54,7 +54,8 @@ public enum AiProps { /** */
TOKEN_GENERATION_ABILITY_CHANCE ("100"), /** */ TOKEN_GENERATION_ABILITY_CHANCE ("100"), /** */
TOKEN_GENERATION_ALWAYS_IF_FROM_PLANESWALKER ("true"), /** */ TOKEN_GENERATION_ALWAYS_IF_FROM_PLANESWALKER ("true"), /** */
TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS ("true"), TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS ("true"),
COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION ("false"); /** */ COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION ("true"), /** */
COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION ("true"); /** */
private final String strDefaultVal; private final String strDefaultVal;

View File

@@ -55,3 +55,6 @@ TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS=true
# Attempt to predict the number of potential blockers with various forms of evasion when # Attempt to predict the number of potential blockers with various forms of evasion when
# deciding to do an all-in assault attack (Experimental!) # deciding to do an all-in assault attack (Experimental!)
COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION=false COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION=false
# Attempt to predict the number of potential blockers with various forms of evasion when
# deciding to do an attrition race attack (Experimental!)
COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=false

View File

@@ -55,3 +55,6 @@ TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS=true
# Attempt to predict the number of potential blockers with various forms of evasion when # Attempt to predict the number of potential blockers with various forms of evasion when
# deciding to do an all-in assault attack (Experimental!) # deciding to do an all-in assault attack (Experimental!)
COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION=false COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION=false
# Attempt to predict the number of potential blockers with various forms of evasion when
# deciding to do an attrition race attack (Experimental!)
COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=false

View File

@@ -55,3 +55,6 @@ TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS=true
# Attempt to predict the number of potential blockers with various forms of evasion when # Attempt to predict the number of potential blockers with various forms of evasion when
# deciding to do an all-in assault attack (Experimental!) # deciding to do an all-in assault attack (Experimental!)
COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION=true COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION=true
# Attempt to predict the number of potential blockers with various forms of evasion when
# deciding to do an attrition race attack (Experimental!)
COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=true

View File

@@ -55,3 +55,6 @@ TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS=true
# Attempt to predict the number of potential blockers with various forms of evasion when # Attempt to predict the number of potential blockers with various forms of evasion when
# deciding to do an all-in assault attack (Experimental!) # deciding to do an all-in assault attack (Experimental!)
COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION=false COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION=false
# Attempt to predict the number of potential blockers with various forms of evasion when
# deciding to do an attrition race attack (Experimental!)
COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION=false