SteamWar/FightSystem
Archiviert
13
1

Fix HellsBells distribution

Dieser Commit ist enthalten in:
yoyosource 2021-06-26 15:30:36 +02:00
Ursprung e5d7c5c702
Commit f7bf4dd0eb

Datei anzeigen

@ -79,8 +79,8 @@ public class HellsBells {
AtomicInteger length = new AtomicInteger(10 + random.nextInt(direction.getLength(zLength, xLength) - 10)); AtomicInteger length = new AtomicInteger(10 + random.nextInt(direction.getLength(zLength, xLength) - 10));
int width = 5 + random.nextInt(5); int width = 5 + random.nextInt(5);
int xOffset = getWidthStart(direction.getLength(xLength, zLength), direction.getLength(length.get(), width)); int xOffset = getStart(direction.getLength(xLength, zLength), direction.getLength(length.get(), width));
int zOffset = getLengthStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get())); int zOffset = getStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get()));
int yOffset = getHeightStart(); int yOffset = getHeightStart();
Point redStart; Point redStart;
@ -112,12 +112,9 @@ public class HellsBells {
}, 0L, 4L); }, 0L, 4L);
} }
private int getLengthStart(int regionSize, int length) { private int getStart(int regionSize, int length) {
return random.nextInt(regionSize - length); double randomNumber = (random.nextDouble() - random.nextDouble()) / 2 + 0.5;
} return (int) (randomNumber * (regionSize - length));
private int getWidthStart(int regionSize, int length) {
return random.nextInt(regionSize - length);
} }
private int getHeightStart() { private int getHeightStart() {