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