mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Some further work on the experimental attack/block trading options (disabled by default in all profiles except Experimental).
This commit is contained in:
@@ -916,10 +916,12 @@ public class AiAttackController {
|
|||||||
if (ratioDiff > 0 && doAttritionalAttack) {
|
if (ratioDiff > 0 && doAttritionalAttack) {
|
||||||
this.aiAggression = 5; // attack at all costs
|
this.aiAggression = 5; // attack at all costs
|
||||||
} else if ((ratioDiff >= 1 && this.attackers.size() > 1 && (humanLifeToDamageRatio < 2 || outNumber > 0))
|
} else if ((ratioDiff >= 1 && this.attackers.size() > 1 && (humanLifeToDamageRatio < 2 || outNumber > 0))
|
||||||
|| (playAggro && humanLifeToDamageRatio > 1)) {
|
|| (playAggro && MyRandom.percentTrue(chanceToAttackToTrade) && humanLifeToDamageRatio > 1)) {
|
||||||
this.aiAggression = 4; // attack expecting to trade or damage player.
|
this.aiAggression = 4; // attack expecting to trade or damage player.
|
||||||
} else if (MyRandom.percentTrue(chanceToAttackToTrade) && humanLifeToDamageRatio > 1
|
} else if (MyRandom.percentTrue(chanceToAttackToTrade) && humanLifeToDamageRatio > 1
|
||||||
&& ComputerUtil.countUsefulCreatures(ai) > ComputerUtil.countUsefulCreatures(defendingOpponent)) {
|
&& defendingOpponent != null
|
||||||
|
&& ComputerUtil.countUsefulCreatures(ai) > ComputerUtil.countUsefulCreatures(defendingOpponent)
|
||||||
|
&& ai.getLife() > defendingOpponent.getLife()) {
|
||||||
this.aiAggression = 4; // random (chance-based) attack expecting to trade or damage player.
|
this.aiAggression = 4; // random (chance-based) attack expecting to trade or damage player.
|
||||||
} else if (ratioDiff >= 0 && this.attackers.size() > 1) {
|
} else if (ratioDiff >= 0 && this.attackers.size() > 1) {
|
||||||
this.aiAggression = 3; // attack expecting to make good trades or damage player.
|
this.aiAggression = 3; // attack expecting to make good trades or damage player.
|
||||||
|
|||||||
@@ -575,9 +575,10 @@ public class AiBlockController {
|
|||||||
// Always trade when life in danger
|
// Always trade when life in danger
|
||||||
doTrade = true;
|
doTrade = true;
|
||||||
} else if (enableRandomTrades) {
|
} else if (enableRandomTrades) {
|
||||||
// Randomly trade creatures with lower power and worse abilities
|
// Randomly trade creatures with lower power and [hopefully] worse abilities
|
||||||
float chanceStep = (100 - minRandomTradeChance) / 15; // 15 steps between 5 life and 20+ life
|
int numSteps = ai.getStartingLife() - 5; // e.g. 15 steps between 5 life and 20 life
|
||||||
int chance = (int)Math.max(minRandomTradeChance, (100 - (Math.abs(5 - ai.getLife()) * chanceStep)));
|
float chanceStep = (maxRandomTradeChance - minRandomTradeChance) / numSteps;
|
||||||
|
int chance = (int)Math.max(minRandomTradeChance, (maxRandomTradeChance - (Math.abs(5 - ai.getLife()) * chanceStep)));
|
||||||
if (chance > maxRandomTradeChance) {
|
if (chance > maxRandomTradeChance) {
|
||||||
chance = maxRandomTradeChance;
|
chance = maxRandomTradeChance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ MULLIGAN_THRESHOLD=4
|
|||||||
|
|
||||||
# Aggro preferences (enabling these will generally make the AI attack more aggressively into potential trades)
|
# Aggro preferences (enabling these will generally make the AI attack more aggressively into potential trades)
|
||||||
PLAY_AGGRO=false
|
PLAY_AGGRO=false
|
||||||
# The chance to attack aggressively into a potential trade even if not playing all-out aggro (PLAY_AGGRO disabled)
|
# The chance to attack aggressively into a potential trade (works even if not playing all-out aggro, e.g. PLAY_AGGRO disabled,
|
||||||
|
# but only in more favorable conditions in that case - when ahead in life count and in parity or ahead in creature count)
|
||||||
CHANCE_TO_ATTACK_INTO_TRADE=0
|
CHANCE_TO_ATTACK_INTO_TRADE=0
|
||||||
# When enabled, the AI will use Berserk on offense to try to severely damage the opponent at the expense of the creature
|
# When enabled, the AI will use Berserk on offense to try to severely damage the opponent at the expense of the creature
|
||||||
USE_BERSERK_AGGRESSIVELY=false
|
USE_BERSERK_AGGRESSIVELY=false
|
||||||
@@ -13,9 +14,9 @@ USE_BERSERK_AGGRESSIVELY=false
|
|||||||
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK=false
|
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK=false
|
||||||
# If enabled, the AI will consider trade blocking even if its creature count is lower than the opponent's
|
# If enabled, the AI will consider trade blocking even if its creature count is lower than the opponent's
|
||||||
RANDOMLY_TRADE_EVEN_IF_HAS_LESS_CREATS=false
|
RANDOMLY_TRADE_EVEN_IF_HAS_LESS_CREATS=false
|
||||||
# Min and max chance to randomly aggressively trade when blocking
|
# Min and max chance to randomly aggressively trade when blocking (note that it will become 100 if the AI is in danger)
|
||||||
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=20
|
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=20
|
||||||
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=100
|
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=65
|
||||||
|
|
||||||
# Only works when AI cheating is enabled in preferences, otherwise does nothing
|
# Only works when AI cheating is enabled in preferences, otherwise does nothing
|
||||||
CHEAT_WITH_MANA_ON_SHUFFLE=true
|
CHEAT_WITH_MANA_ON_SHUFFLE=true
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ MULLIGAN_THRESHOLD=4
|
|||||||
|
|
||||||
# Aggro preferences (enabling these will generally make the AI attack more aggressively into potential trades)
|
# Aggro preferences (enabling these will generally make the AI attack more aggressively into potential trades)
|
||||||
PLAY_AGGRO=false
|
PLAY_AGGRO=false
|
||||||
# The chance to attack aggressively into a potential trade even if not playing all-out aggro (PLAY_AGGRO disabled)
|
# The chance to attack aggressively into a potential trade (works even if not playing all-out aggro, e.g. PLAY_AGGRO disabled,
|
||||||
|
# but only in more favorable conditions in that case - when ahead in life count and in parity or ahead in creature count)
|
||||||
CHANCE_TO_ATTACK_INTO_TRADE=0
|
CHANCE_TO_ATTACK_INTO_TRADE=0
|
||||||
# When enabled, the AI will use Berserk on offense to try to severely damage the opponent at the expense of the creature
|
# When enabled, the AI will use Berserk on offense to try to severely damage the opponent at the expense of the creature
|
||||||
USE_BERSERK_AGGRESSIVELY=false
|
USE_BERSERK_AGGRESSIVELY=false
|
||||||
@@ -13,9 +14,9 @@ USE_BERSERK_AGGRESSIVELY=false
|
|||||||
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK=false
|
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK=false
|
||||||
# If enabled, the AI will consider trade blocking even if its creature count is lower than the opponent's
|
# If enabled, the AI will consider trade blocking even if its creature count is lower than the opponent's
|
||||||
RANDOMLY_TRADE_EVEN_IF_HAS_LESS_CREATS=false
|
RANDOMLY_TRADE_EVEN_IF_HAS_LESS_CREATS=false
|
||||||
# Min and max chance to randomly aggressively trade when blocking
|
# Min and max chance to randomly aggressively trade when blocking (note that it will become 100 if the AI is in danger)
|
||||||
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=20
|
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=20
|
||||||
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=100
|
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=65
|
||||||
|
|
||||||
# Only works when AI cheating is enabled in preferences, otherwise does nothing
|
# Only works when AI cheating is enabled in preferences, otherwise does nothing
|
||||||
CHEAT_WITH_MANA_ON_SHUFFLE=true
|
CHEAT_WITH_MANA_ON_SHUFFLE=true
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ MULLIGAN_THRESHOLD=4
|
|||||||
|
|
||||||
# Aggro preferences (enabling these will generally make the AI attack more aggressively into potential trades)
|
# Aggro preferences (enabling these will generally make the AI attack more aggressively into potential trades)
|
||||||
PLAY_AGGRO=false
|
PLAY_AGGRO=false
|
||||||
# The chance to attack aggressively into a potential trade even if not playing all-out aggro (PLAY_AGGRO disabled)
|
# The chance to attack aggressively into a potential trade (works even if not playing all-out aggro, e.g. PLAY_AGGRO disabled,
|
||||||
|
# but only in more favorable conditions in that case - when ahead in life count and in parity or ahead in creature count)
|
||||||
CHANCE_TO_ATTACK_INTO_TRADE=20
|
CHANCE_TO_ATTACK_INTO_TRADE=20
|
||||||
# When enabled, the AI will use Berserk on offense to try to severely damage the opponent at the expense of the creature
|
# When enabled, the AI will use Berserk on offense to try to severely damage the opponent at the expense of the creature
|
||||||
USE_BERSERK_AGGRESSIVELY=true
|
USE_BERSERK_AGGRESSIVELY=true
|
||||||
@@ -13,9 +14,9 @@ USE_BERSERK_AGGRESSIVELY=true
|
|||||||
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK=true
|
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK=true
|
||||||
# If enabled, the AI will consider trade blocking even if its creature count is lower than the opponent's
|
# If enabled, the AI will consider trade blocking even if its creature count is lower than the opponent's
|
||||||
RANDOMLY_TRADE_EVEN_IF_HAS_LESS_CREATS=true
|
RANDOMLY_TRADE_EVEN_IF_HAS_LESS_CREATS=true
|
||||||
# Min and max chance to randomly aggressively trade when blocking
|
# Min and max chance to randomly aggressively trade when blocking (note that it will become 100 if the AI is in danger)
|
||||||
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=20
|
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=20
|
||||||
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=100
|
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=65
|
||||||
|
|
||||||
# Only works when AI cheating is enabled in preferences, otherwise does nothing
|
# Only works when AI cheating is enabled in preferences, otherwise does nothing
|
||||||
CHEAT_WITH_MANA_ON_SHUFFLE=true
|
CHEAT_WITH_MANA_ON_SHUFFLE=true
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ MULLIGAN_THRESHOLD=3
|
|||||||
|
|
||||||
# Aggro preferences (enabling these will generally make the AI attack more aggressively)
|
# Aggro preferences (enabling these will generally make the AI attack more aggressively)
|
||||||
PLAY_AGGRO=true
|
PLAY_AGGRO=true
|
||||||
# The chance to attack aggressively into a potential trade even if not playing all-out aggro (PLAY_AGGRO disabled)
|
# The chance to attack aggressively into a potential trade (works even if not playing all-out aggro, e.g. PLAY_AGGRO disabled,
|
||||||
|
# but only in more favorable conditions in that case - when ahead in life count and in parity or ahead in creature count)
|
||||||
CHANCE_TO_ATTACK_INTO_TRADE=100
|
CHANCE_TO_ATTACK_INTO_TRADE=100
|
||||||
# When enabled, the AI will use Berserk on offense to try to severely damage the opponent at the expense of the creature
|
# When enabled, the AI will use Berserk on offense to try to severely damage the opponent at the expense of the creature
|
||||||
USE_BERSERK_AGGRESSIVELY=true
|
USE_BERSERK_AGGRESSIVELY=true
|
||||||
@@ -13,9 +14,9 @@ USE_BERSERK_AGGRESSIVELY=true
|
|||||||
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK=false
|
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK=false
|
||||||
# If enabled, the AI will consider trade blocking even if its creature count is lower than the opponent's
|
# If enabled, the AI will consider trade blocking even if its creature count is lower than the opponent's
|
||||||
RANDOMLY_TRADE_EVEN_IF_HAS_LESS_CREATS=false
|
RANDOMLY_TRADE_EVEN_IF_HAS_LESS_CREATS=false
|
||||||
# Min and max chance to randomly aggressively trade when blocking
|
# Min and max chance to randomly aggressively trade when blocking (note that it will become 100 if the AI is in danger)
|
||||||
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=20
|
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=20
|
||||||
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=100
|
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=65
|
||||||
|
|
||||||
# Only works when AI cheating is enabled in preferences, otherwise does nothing
|
# Only works when AI cheating is enabled in preferences, otherwise does nothing
|
||||||
CHEAT_WITH_MANA_ON_SHUFFLE=true
|
CHEAT_WITH_MANA_ON_SHUFFLE=true
|
||||||
|
|||||||
Reference in New Issue
Block a user