SteamWar/FightSystem
Archiviert
13
1
Dieser Commit ist enthalten in:
Zeanon 2021-05-13 23:11:55 +02:00
Ursprung 1ede1c1101
Commit 309ba84865

Datei anzeigen

@ -103,30 +103,31 @@ public class HellsBells {
private void sideRun(boolean invert) { private void sideRun(boolean invert) {
int length = 10 + random.nextInt(zLength - 10); int length = 10 + random.nextInt(zLength - 10);
int xOffset = getWidthStart(xLength); int width = 5 + random.nextInt(5);
int xOffset = getWidthStart(xLength, width);
int zOffset = getLengthStart(zLength, length); int zOffset = getLengthStart(zLength, length);
int yOffset = 25 + getHeightStart(); int yOffset = getHeightStart();
Point redStart; Point redStart;
Point blueStart; Point blueStart;
if (invert) { if (invert) {
redStart = new Point(Config.RedPasteRegion.getMaxX() - xOffset, Config.RedPasteRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMaxZ() - zOffset); redStart = new Point(Config.RedPasteRegion.getMaxX() - xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMaxZ() - zOffset);
blueStart = new Point(Config.BluePasteRegion.getMinX() + xOffset, Config.BluePasteRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMinZ() + zOffset); blueStart = new Point(Config.BluePasteRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMinZ() + zOffset);
} else { } else {
redStart = new Point(Config.RedPasteRegion.getMinX() + xOffset, Config.RedPasteRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMinZ() + zOffset); redStart = new Point(Config.RedPasteRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMinZ() + zOffset);
blueStart = new Point(Config.BluePasteRegion.getMaxX() - xOffset, Config.BluePasteRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMaxZ() - zOffset); blueStart = new Point(Config.BluePasteRegion.getMaxX() - xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMaxZ() - zOffset);
} }
dropSideBombPart(redStart, blueStart, new int[]{length}, invert); dropSideBombs(redStart, blueStart, width, new int[]{length}, invert);
} }
private void dropSideBombPart(Point redStart, Point blueStart, int[] x, boolean invert) { private void dropSideBombs(Point redStart, Point blueStart, int width, int[] x, boolean invert) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(FightSystem.getPlugin(), () -> new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
for (int z = 0; z < 4; z++) { for (int z = 0; z < width; z++) {
if (invert) { if (invert) {
world.spawnEntity(redStart.subtractAndToLocation(world, x[0], 0, z), EntityType.PRIMED_TNT); world.spawnEntity(redStart.subtractAndToLocation(world, x[0], 0, z), EntityType.PRIMED_TNT);
@ -145,35 +146,36 @@ public class HellsBells {
x[0] -= 2; x[0] -= 2;
} }
}, 0, 4L); }.runTaskTimer(FightSystem.getPlugin(), 0, 4L);
} }
private void frontRun(boolean invert) { private void frontRun(boolean invert) {
int length = 10 + random.nextInt(xLength - 10); int length = 10 + random.nextInt(xLength - 10);
int xOffset = getWidthStart(zLength); int width = 5 + random.nextInt(5);
int zOffset = getLengthStart(xLength, length); int xOffset = getWidthStart(zLength, length);
int yOffset = 25 + getHeightStart(); int zOffset = getLengthStart(xLength, width);
int yOffset = getHeightStart();
Point redStart; Point redStart;
Point blueStart; Point blueStart;
if (invert) { if (invert) {
redStart = new Point(Config.RedPasteRegion.getMaxX() - xOffset, Config.RedPasteRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMaxZ() - zOffset); redStart = new Point(Config.RedPasteRegion.getMaxX() - xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMaxZ() - zOffset);
blueStart = new Point(Config.BluePasteRegion.getMinX() + xOffset, Config.BluePasteRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMinZ() + zOffset); blueStart = new Point(Config.BluePasteRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMinZ() + zOffset);
} else { } else {
redStart = new Point(Config.RedPasteRegion.getMinX() + xOffset, Config.RedPasteRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMinZ() + zOffset); redStart = new Point(Config.RedPasteRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMinZ() + zOffset);
blueStart = new Point(Config.BluePasteRegion.getMaxX() - xOffset, Config.BluePasteRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMaxZ() - zOffset); blueStart = new Point(Config.BluePasteRegion.getMaxX() - xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMaxZ() - zOffset);
} }
dropFrontBombPart(redStart, blueStart, new int[]{length}, invert); dropFrontBombs(redStart, blueStart, width, new int[]{length}, invert);
} }
private void dropFrontBombPart(Point redStart, Point blueStart, int[] z, boolean invert) { private void dropFrontBombs(Point redStart, Point blueStart, int width, int[] z, boolean invert) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(FightSystem.getPlugin(), () -> new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
for (int x = 0; x < 4; x++) { for (int x = 0; x < width; x++) {
if (invert) { if (invert) {
world.spawnEntity(redStart.subtractAndToLocation(world, x, 0, z[0]), EntityType.PRIMED_TNT); world.spawnEntity(redStart.subtractAndToLocation(world, x, 0, z[0]), EntityType.PRIMED_TNT);
@ -192,19 +194,19 @@ public class HellsBells {
z[0] -= 2; z[0] -= 2;
} }
}, 0, 4L); }.runTaskTimer(FightSystem.getPlugin(), 0, 4L);
} }
private int getLengthStart(int regionSize, int length) { private int getLengthStart(int regionSize, int length) {
return random.nextInt(regionSize - length); return random.nextInt(regionSize - length);
} }
private int getWidthStart(int regionSize) { private int getWidthStart(int regionSize, int length) {
return random.nextInt(regionSize - 4); return random.nextInt(regionSize - length);
} }
private int getHeightStart() { private int getHeightStart() {
return random.nextInt(15); return 5 + random.nextInt(15);
} }
private class HellsBellsCountdown extends Countdown { private class HellsBellsCountdown extends Countdown {