Fix crash with Master Warcraft

This commit is contained in:
tool4EvEr
2021-12-05 20:02:11 +01:00
parent 1c9d4a5614
commit 26edab4373

View File

@@ -457,8 +457,12 @@ public class ComputerUtilCombat {
} }
} }
int threshold = (((PlayerControllerAi) ai.getController()).getAi().getIntProperty(AiProps.AI_IN_DANGER_THRESHOLD)); int threshold = 0;
int maxTreshold = (((PlayerControllerAi) ai.getController()).getAi().getIntProperty(AiProps.AI_IN_DANGER_MAX_THRESHOLD)) - threshold; int maxTreshold = 0;
if (ai.getController().isAI()) {
threshold = ((PlayerControllerAi) ai.getController()).getAi().getIntProperty(AiProps.AI_IN_DANGER_THRESHOLD);
maxTreshold = ((PlayerControllerAi) ai.getController()).getAi().getIntProperty(AiProps.AI_IN_DANGER_MAX_THRESHOLD) - threshold;
}
int chance = MyRandom.getRandom().nextInt(80) + 5; int chance = MyRandom.getRandom().nextInt(80) + 5;
while (maxTreshold > 0) { while (maxTreshold > 0) {