mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
- Fixed the logic for the AI planar die roll chance.
- Added an ability to set a chance for the AI hesitating to roll a planar die (default AI at 10%, reckless AI at 0%).
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user