mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- 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:
@@ -243,6 +243,19 @@ public class AiAttackController {
|
||||
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 method is used by getAttackers()
|
||||
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
|
||||
}
|
||||
// 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;
|
||||
if (predictEvasion) {
|
||||
candidateAttackers.remove(potentialOppBlocker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ public enum AiProps { /** */
|
||||
TOKEN_GENERATION_ABILITY_CHANCE ("100"), /** */
|
||||
TOKEN_GENERATION_ALWAYS_IF_FROM_PLANESWALKER ("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;
|
||||
|
||||
|
||||
@@ -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
|
||||
# deciding to do an all-in assault attack (Experimental!)
|
||||
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
|
||||
|
||||
@@ -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
|
||||
# deciding to do an all-in assault attack (Experimental!)
|
||||
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
|
||||
|
||||
@@ -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
|
||||
# deciding to do an all-in assault attack (Experimental!)
|
||||
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
|
||||
|
||||
@@ -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
|
||||
# deciding to do an all-in assault attack (Experimental!)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user