mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Some more work on attack/block trades [experimental].
This commit is contained in:
@@ -588,15 +588,19 @@ public class AiAttackController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggro options
|
||||||
boolean playAggro = false;
|
boolean playAggro = false;
|
||||||
int chanceToAttackToTrade = 0;
|
int chanceToAttackToTrade = 0;
|
||||||
boolean tradeIfTappedOut = false;
|
boolean tradeIfTappedOut = false;
|
||||||
|
int extraChanceIfOppHasMana = 0;
|
||||||
if (ai.getController().isAI()) {
|
if (ai.getController().isAI()) {
|
||||||
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
|
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
|
||||||
playAggro = aic.getBooleanProperty(AiProps.PLAY_AGGRO);
|
playAggro = aic.getBooleanProperty(AiProps.PLAY_AGGRO);
|
||||||
chanceToAttackToTrade = aic.getIntProperty(AiProps.CHANCE_TO_ATTACK_INTO_TRADE);
|
chanceToAttackToTrade = aic.getIntProperty(AiProps.CHANCE_TO_ATTACK_INTO_TRADE);
|
||||||
tradeIfTappedOut = aic.getBooleanProperty(AiProps.ATTACK_INTO_TRADE_WHEN_TAPPED_OUT);
|
tradeIfTappedOut = aic.getBooleanProperty(AiProps.ATTACK_INTO_TRADE_WHEN_TAPPED_OUT);
|
||||||
|
extraChanceIfOppHasMana = aic.getIntProperty(AiProps.CHANCE_TO_ATKTRADE_WHEN_OPP_HAS_MANA);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean bAssault = this.doAssault(ai);
|
final boolean bAssault = this.doAssault(ai);
|
||||||
// TODO: detect Lightmine Field by presence of a card with a specific trigger
|
// TODO: detect Lightmine Field by presence of a card with a specific trigger
|
||||||
final boolean lightmineField = ComputerUtilCard.isPresentOnBattlefield(ai.getGame(), "Lightmine Field");
|
final boolean lightmineField = ComputerUtilCard.isPresentOnBattlefield(ai.getGame(), "Lightmine Field");
|
||||||
@@ -924,7 +928,8 @@ public class AiAttackController {
|
|||||||
&& defendingOpponent != null
|
&& defendingOpponent != null
|
||||||
&& ComputerUtil.countUsefulCreatures(ai) > ComputerUtil.countUsefulCreatures(defendingOpponent)
|
&& ComputerUtil.countUsefulCreatures(ai) > ComputerUtil.countUsefulCreatures(defendingOpponent)
|
||||||
&& ai.getLife() > defendingOpponent.getLife()
|
&& ai.getLife() > defendingOpponent.getLife()
|
||||||
&& (ComputerUtilMana.getAvailableManaEstimate(ai) > 0) || tradeIfTappedOut) {
|
&& (ComputerUtilMana.getAvailableManaEstimate(ai) > 0) || tradeIfTappedOut
|
||||||
|
&& (ComputerUtilMana.getAvailableManaEstimate(defendingOpponent) == 0) || MyRandom.percentTrue(extraChanceIfOppHasMana)) {
|
||||||
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.
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public enum AiProps { /** */
|
|||||||
PLAY_AGGRO ("false"),
|
PLAY_AGGRO ("false"),
|
||||||
CHANCE_TO_ATTACK_INTO_TRADE ("40"), /** */
|
CHANCE_TO_ATTACK_INTO_TRADE ("40"), /** */
|
||||||
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT ("false"), /** */
|
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT ("false"), /** */
|
||||||
|
CHANCE_TO_ATKTRADE_WHEN_OPP_HAS_MANA ("0"), /** */
|
||||||
TRY_TO_HOLD_COMBAT_TRICKS_UNTIL_BLOCK ("false"), /** */
|
TRY_TO_HOLD_COMBAT_TRICKS_UNTIL_BLOCK ("false"), /** */
|
||||||
CHANCE_TO_HOLD_COMBAT_TRICKS_UNTIL_BLOCK ("30"), /** */
|
CHANCE_TO_HOLD_COMBAT_TRICKS_UNTIL_BLOCK ("30"), /** */
|
||||||
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK ("false"), /** */
|
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK ("false"), /** */
|
||||||
|
|||||||
@@ -1236,6 +1236,7 @@ public class ComputerUtilCard {
|
|||||||
}
|
}
|
||||||
chance += threat;
|
chance += threat;
|
||||||
|
|
||||||
|
// -- Hold combat trick (the AI will try to delay the pump until Declare Blockers) --
|
||||||
// Enable combat trick mode only in case it's a pure buff spell in hand with no keywords or with Trample,
|
// Enable combat trick mode only in case it's a pure buff spell in hand with no keywords or with Trample,
|
||||||
// First Strike, or Double Strike, otherwise the AI is unlikely to cast it or it's too late to
|
// First Strike, or Double Strike, otherwise the AI is unlikely to cast it or it's too late to
|
||||||
// cast it during Declare Blockers, thus ruining its attacker
|
// cast it during Declare Blockers, thus ruining its attacker
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ CHANCE_TO_ATTACK_INTO_TRADE=0
|
|||||||
# is globally enabled). If disabled, the non-aggro AI will only attack into trades when it has mana open, thus having a chance
|
# is globally enabled). If disabled, the non-aggro AI will only attack into trades when it has mana open, thus having a chance
|
||||||
# to "bluff" (or use, if available) combat tricks at the same time.
|
# to "bluff" (or use, if available) combat tricks at the same time.
|
||||||
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT=false
|
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT=false
|
||||||
|
# When above zero, the AI will attack into trading options when the opponent is not tapped out, thus risking getting an
|
||||||
|
# unexpected combat trick or ability activation. Note that this chance is rolled separately after CHANCE_TO_ATTACK_INTO_TRADE
|
||||||
|
# has already succeeded.
|
||||||
|
CHANCE_TO_ATKTRADE_WHEN_OPP_HAS_MANA=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
|
||||||
# Try to hold combat tricks until blockers are declared in an attempt to trick the opponent into blocking a weak creature
|
# Try to hold combat tricks until blockers are declared in an attempt to trick the opponent into blocking a weak creature
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ CHANCE_TO_ATTACK_INTO_TRADE=0
|
|||||||
# is globally enabled). If disabled, the non-aggro AI will only attack into trades when it has mana open, thus having a chance
|
# is globally enabled). If disabled, the non-aggro AI will only attack into trades when it has mana open, thus having a chance
|
||||||
# to "bluff" (or use, if available) combat tricks at the same time.
|
# to "bluff" (or use, if available) combat tricks at the same time.
|
||||||
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT=false
|
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT=false
|
||||||
|
# When above zero, the AI will attack into trading options when the opponent is not tapped out, thus risking getting an
|
||||||
|
# unexpected combat trick or ability activation. Note that this chance is rolled separately after CHANCE_TO_ATTACK_INTO_TRADE
|
||||||
|
# has already succeeded.
|
||||||
|
CHANCE_TO_ATKTRADE_WHEN_OPP_HAS_MANA=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
|
||||||
# Try to hold combat tricks until blockers are declared in an attempt to trick the opponent into blocking a weak creature
|
# Try to hold combat tricks until blockers are declared in an attempt to trick the opponent into blocking a weak creature
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ CHANCE_TO_ATTACK_INTO_TRADE=40
|
|||||||
# is globally enabled). If disabled, the non-aggro AI will only attack into trades when it has mana open, thus having a chance
|
# is globally enabled). If disabled, the non-aggro AI will only attack into trades when it has mana open, thus having a chance
|
||||||
# to "bluff" (or use, if available) combat tricks at the same time.
|
# to "bluff" (or use, if available) combat tricks at the same time.
|
||||||
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT=false
|
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT=false
|
||||||
|
# When above zero, the AI will attack into trading options when the opponent is not tapped out, thus risking getting an
|
||||||
|
# unexpected combat trick or ability activation. Note that this chance is rolled separately after CHANCE_TO_ATTACK_INTO_TRADE
|
||||||
|
# has already succeeded.
|
||||||
|
CHANCE_TO_ATKTRADE_WHEN_OPP_HAS_MANA=10
|
||||||
# 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
|
||||||
# Try to hold combat tricks until blockers are declared in an attempt to trick the opponent into blocking a weak creature
|
# Try to hold combat tricks until blockers are declared in an attempt to trick the opponent into blocking a weak creature
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ CHANCE_TO_ATTACK_INTO_TRADE=100
|
|||||||
# is globally enabled). If disabled, the non-aggro AI will only attack into trades when it has mana open, thus having a chance
|
# is globally enabled). If disabled, the non-aggro AI will only attack into trades when it has mana open, thus having a chance
|
||||||
# to "bluff" (or use, if available) combat tricks at the same time.
|
# to "bluff" (or use, if available) combat tricks at the same time.
|
||||||
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT=true
|
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT=true
|
||||||
|
# When above zero, the AI will attack into trading options when the opponent is not tapped out, thus risking getting an
|
||||||
|
# unexpected combat trick or ability activation. Note that this chance is rolled separately after CHANCE_TO_ATTACK_INTO_TRADE
|
||||||
|
# has already succeeded.
|
||||||
|
CHANCE_TO_ATKTRADE_WHEN_OPP_HAS_MANA=35
|
||||||
# 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
|
||||||
# Try to hold combat tricks until blockers are declared in an attempt to trick the opponent into blocking a weak creature
|
# Try to hold combat tricks until blockers are declared in an attempt to trick the opponent into blocking a weak creature
|
||||||
|
|||||||
Reference in New Issue
Block a user