- Added an option to decrease the AI chance to randomly trade vs. an Embalm/Eternalize creature that will come back later.

- Enabling the option to hold land drops for main 2 from time to time when safe (tested by now, should work well).
This commit is contained in:
Agetian
2017-09-29 16:34:38 +00:00
parent 9bb5a69b56
commit a17663655b
6 changed files with 26 additions and 3 deletions

View File

@@ -1232,6 +1232,7 @@ public class AiBlockController {
boolean enableRandomTrades = false;
boolean randomTradeIfBehindOnBoard = false;
boolean randomTradeIfCreatInHand = false;
int chanceModForEmbalm = 0;
int chanceToTradeToSaveWalker = 0;
int chanceToTradeDownToSaveWalker = 0;
int minRandomTradeChance = 0;
@@ -1247,6 +1248,7 @@ public class AiBlockController {
randomTradeIfCreatInHand = aic.getBooleanProperty(AiProps.ALSO_TRADE_WHEN_HAVE_A_REPLACEMENT_CREAT);
minRandomTradeChance = aic.getIntProperty(AiProps.MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK);
maxRandomTradeChance = aic.getIntProperty(AiProps.MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK);
chanceModForEmbalm = aic.getIntProperty(AiProps.CHANCE_DECREASE_TO_TRADE_VS_EMBALM);
maxCreatDiff = aic.getIntProperty(AiProps.MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE);
maxCreatDiffWithRepl = aic.getIntProperty(AiProps.MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE_WITH_REPL);
chanceToTradeToSaveWalker = aic.getIntProperty(AiProps.CHANCE_TO_TRADE_TO_SAVE_PLANESWALKER);
@@ -1278,6 +1280,14 @@ public class AiBlockController {
int evalAtk = ComputerUtilCard.evaluateCreature(attacker, true, false);
int evalBlk = ComputerUtilCard.evaluateCreature(blocker, true, false);
boolean atkEmbalm = (attacker.hasStartOfKeyword("Embalm") || attacker.hasStartOfKeyword("Eternalize")) && !attacker.isToken();
boolean blkEmbalm = (blocker.hasStartOfKeyword("Embalm") || blocker.hasStartOfKeyword("Eternalize")) && !blocker.isToken();
if (atkEmbalm && !blkEmbalm) {
// The opponent will eventually get his creature back, while the AI won't
chance = Math.min(0, chance - chanceModForEmbalm);
}
if (blocker.isFaceDown() && blocker.getState(CardStateName.Original).getType().isCreature()) {
// if the blocker is a face-down creature (e.g. cast via Morph, Manifest), evaluate it
// in relation to the original state, not to the Morph state

View File

@@ -51,6 +51,7 @@ public enum AiProps { /** */
MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE_WITH_REPL ("1"), /** */
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK ("30"), /** */
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK ("70"), /** */
CHANCE_DECREASE_TO_TRADE_VS_EMBALM ("30"), /** */
CHANCE_TO_TRADE_TO_SAVE_PLANESWALKER ("70"), /** */
CHANCE_TO_TRADE_DOWN_TO_SAVE_PLANESWALKER ("0"), /** */
THRESHOLD_TOKEN_CHUMP_TO_SAVE_PLANESWALKER ("135"), /** */

View File

@@ -47,6 +47,9 @@ MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE_WITH_REPL=0
# 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=40
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=65
# The decrease amount for the trade chance when trading against a non-token Embalm/Eternalize creature with a non-token
# creature that does not have Embalm/Eternalize
CHANCE_DECREASE_TO_TRADE_VS_EMBALM=50
# Options to save / preserve loyalty of planeswalkers
# Chance to trade a (worse or roughly equal) creature in order to save a planeswalker or preserve its loyalty
@@ -68,7 +71,7 @@ CHEAT_WITH_MANA_ON_SHUFFLE=true
# The chance for the AI to attempt to hold land drops until Main 2 when it's safe and when it has nothing to potentially
# do with the extra mana
HOLD_LAND_DROP_FOR_MAIN2_IF_UNUSED=0
HOLD_LAND_DROP_FOR_MAIN2_IF_UNUSED=100
# Planechase logic
DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN=1

View File

@@ -47,6 +47,9 @@ MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE_WITH_REPL=1
# 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=30
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=70
# The decrease amount for the trade chance when trading against a non-token Embalm/Eternalize creature with a non-token
# creature that does not have Embalm/Eternalize
CHANCE_DECREASE_TO_TRADE_VS_EMBALM=30
# Options to save / preserve loyalty of planeswalkers
# Chance to trade a (worse or roughly equal) creature in order to save a planeswalker or preserve its loyalty
@@ -68,7 +71,7 @@ CHEAT_WITH_MANA_ON_SHUFFLE=true
# The chance for the AI to attempt to hold land drops until Main 2 when it's safe and when it has nothing to potentially
# do with the extra mana
HOLD_LAND_DROP_FOR_MAIN2_IF_UNUSED=0
HOLD_LAND_DROP_FOR_MAIN2_IF_UNUSED=100
# Planechase logic
DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN=1

View File

@@ -47,6 +47,9 @@ MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE_WITH_REPL=1
# 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=30
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=70
# The decrease amount for the trade chance when trading against a non-token Embalm/Eternalize creature with a non-token
# creature that does not have Embalm/Eternalize
CHANCE_DECREASE_TO_TRADE_VS_EMBALM=30
# Options to save / preserve loyalty of planeswalkers
# Chance to trade a (worse or roughly equal) creature in order to save a planeswalker or preserve its loyalty

View File

@@ -47,6 +47,9 @@ MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE_WITH_REPL=1
# 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=0
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK=50
# The decrease amount for the trade chance when trading against a non-token Embalm/Eternalize creature with a non-token
# creature that does not have Embalm/Eternalize
CHANCE_DECREASE_TO_TRADE_VS_EMBALM=10
# Options to save / preserve loyalty of planeswalkers
# Chance to trade a (worse or roughly equal) creature in order to save a planeswalker or preserve its loyalty
@@ -68,7 +71,7 @@ CHEAT_WITH_MANA_ON_SHUFFLE=true
# The chance for the AI to attempt to hold land drops until Main 2 when it's safe and when it has nothing to potentially
# do with the extra mana
HOLD_LAND_DROP_FOR_MAIN2_IF_UNUSED=0
HOLD_LAND_DROP_FOR_MAIN2_IF_UNUSED=30
# Planechase logic
DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN=1