From 62ebb0657cf3682f1c0490a3b36c1f496868a92f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 22 Jul 2022 10:14:28 +0200 Subject: [PATCH] Add gaussian distribution --- .../de/steamwar/fightsystem/event/HellsBells.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java b/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java index 85d9260..7fe7e4b 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java @@ -43,8 +43,8 @@ public class HellsBells { public static final Random random = new Random(); - private final int xLength = Config.BluePasteRegion.getSizeX(); - private final int zLength = Config.BluePasteRegion.getSizeZ(); + private final int xLength = Config.BlueExtendRegion.getSizeX(); + private final int zLength = Config.BlueExtendRegion.getSizeZ(); private State current = State.PRE; private int currentDrops = 0; private HellsBellsCountdown currentCountdown; @@ -87,11 +87,11 @@ public class HellsBells { Point blueStart; if (direction.isNorthOrWest()) { - redStart = new Point(Config.RedPasteRegion.getMaxX() - xOffset, Config.RedPasteRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMaxZ() - zOffset); - blueStart = new Point(Config.BluePasteRegion.getMinX() + xOffset, Config.BluePasteRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMinZ() + zOffset); + redStart = new Point(Config.RedExtendRegion.getMaxX() - xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset); + blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset); } else { - redStart = new Point(Config.RedPasteRegion.getMinX() + xOffset, Config.RedPasteRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMinZ() + zOffset); - blueStart = new Point(Config.BluePasteRegion.getMaxX() - xOffset, Config.BluePasteRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMaxZ() - zOffset); + redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMinZ() + zOffset); + blueStart = new Point(Config.BlueExtendRegion.getMaxX() - xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMaxZ() - zOffset); } currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> { @@ -113,7 +113,7 @@ public class HellsBells { } private int getStart(int regionSize, int length) { - double randomNumber = (random.nextDouble() - random.nextDouble()) / 2 + 0.5; + double randomNumber = (Math.max(Math.min(random.nextGaussian(), -2), 2) + 2) / 4; Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - length))); return Math.max(Math.min((int) (randomNumber * (regionSize - length)), regionSize - length), 0); }