diff --git a/res/ai/Default.ai b/res/ai/Default.ai index 0286332d088..09891c77225 100644 --- a/res/ai/Default.ai +++ b/res/ai/Default.ai @@ -1,3 +1,4 @@ -MULLIGAN_THRESHOLD=5 DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN=1 DEFAULT_PLANAR_DIE_ROLL_CHANCE=50 +MULLIGAN_THRESHOLD=5 +PLANAR_DIE_ROLL_HESITATION_CHANCE=10 diff --git a/res/ai/Reckless.ai b/res/ai/Reckless.ai index c8fdc4b5474..c4db667386c 100644 --- a/res/ai/Reckless.ai +++ b/res/ai/Reckless.ai @@ -1,3 +1,4 @@ -MULLIGAN_THRESHOLD=2 DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN=1 DEFAULT_PLANAR_DIE_ROLL_CHANCE=100 +MULLIGAN_THRESHOLD=2 +PLANAR_DIE_ROLL_HESITATION_CHANCE=0 diff --git a/src/main/java/forge/card/ability/ai/RollPlanarDiceAi.java b/src/main/java/forge/card/ability/ai/RollPlanarDiceAi.java index 325c3d5186f..6bf940168b4 100644 --- a/src/main/java/forge/card/ability/ai/RollPlanarDiceAi.java +++ b/src/main/java/forge/card/ability/ai/RollPlanarDiceAi.java @@ -23,6 +23,7 @@ public class RollPlanarDiceAi extends SpellAbilityAi { boolean decideToRoll = false; int maxActivations = aic.getIntProperty(AiProps.DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN); int chance = aic.getIntProperty(AiProps.DEFAULT_PLANAR_DIE_ROLL_CHANCE); + int hesitationChance = aic.getIntProperty(AiProps.PLANAR_DIE_ROLL_HESITATION_CHANCE); if (!plane.hasSVar("AIRollPlanarDieInMain1") && ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)) { return false; @@ -39,7 +40,7 @@ public class RollPlanarDiceAi extends SpellAbilityAi { if (plane.hasSVar("AIRollPlanarDieChance")) { chance = Integer.parseInt(plane.getSVar("AIRollPlanarDieChance")); } - if (MyRandom.getRandom().nextInt(100) >= chance) { + if (MyRandom.getRandom().nextInt(100) < chance) { decideToRoll = true; } break; @@ -56,6 +57,11 @@ public class RollPlanarDiceAi extends SpellAbilityAi { decideToRoll = false; } + // check if the AI hesitates + if (MyRandom.getRandom().nextInt(100) < hesitationChance) { + decideToRoll = false; // hesitate + } + return decideToRoll ? true : false; } diff --git a/src/main/java/forge/game/ai/AiProps.java b/src/main/java/forge/game/ai/AiProps.java index eb3dca9099d..04841f2097f 100644 --- a/src/main/java/forge/game/ai/AiProps.java +++ b/src/main/java/forge/game/ai/AiProps.java @@ -26,7 +26,8 @@ package forge.game.ai; public enum AiProps { /** */ DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN ("1"), /** */ DEFAULT_PLANAR_DIE_ROLL_CHANCE ("50"), /** */ - MULLIGAN_THRESHOLD ("5"); /** */ + MULLIGAN_THRESHOLD ("5"), /** */ + PLANAR_DIE_ROLL_HESITATION_CHANCE ("10"); /** */ private final String strDefaultVal;