From 3ae18ab0b8f2747070a001f45f45b075caf31522 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Jun 2021 17:16:29 +0200 Subject: [PATCH] Fix HellsBells distribution --- .../src/de/steamwar/fightsystem/event/HellsBells.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/event/HellsBells.java b/FightSystem_Main/src/de/steamwar/fightsystem/event/HellsBells.java index 578819f..d21b308 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/event/HellsBells.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/event/HellsBells.java @@ -114,7 +114,7 @@ public class HellsBells { private int getStart(int regionSize, int length) { double randomNumber = (random.nextDouble() - random.nextDouble()) / 2 + 0.5; - return (int) (randomNumber * (regionSize - length)); + return Math.max(Math.min((int) (randomNumber * (regionSize - length)), regionSize - length), 0); } private int getHeightStart() {