From 7b26b7bf91f3fd7d73784213b4a63fbc203d1a4d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 3 Dec 2023 16:47:36 +0100 Subject: [PATCH] Found Something --- .../de/steamwar/fightsystem/FightSystem.java | 6 +- .../de/steamwar/fightsystem/ai/LixfelAI.java | 14 +- .../steamwar/fightsystem/ai/chaos/Bridge.java | 31 --- .../steamwar/fightsystem/ai/chaos/Cannon.java | 146 ++------------ .../fightsystem/ai/chaos/ChaosAI.java | 136 +++++++++---- .../fightsystem/ai/chaos/gears/Gear.java | 66 +++++++ .../ai/chaos/gears/TheUnderground.java | 184 ++++++++++++++++++ .../fightsystem/ai/navmesh/NavMesh.java | 2 - gradlew | 0 9 files changed, 370 insertions(+), 215 deletions(-) delete mode 100644 FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/Bridge.java create mode 100644 FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/gears/Gear.java create mode 100644 FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/gears/TheUnderground.java mode change 100755 => 100644 gradlew diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index 2aa5739..5a497af 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -23,6 +23,7 @@ import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.core.Core; import de.steamwar.fightsystem.ai.LixfelAI; import de.steamwar.fightsystem.ai.navmesh.NavMesh; +import de.steamwar.fightsystem.ai.chaos.ChaosAI; import de.steamwar.fightsystem.commands.*; import de.steamwar.fightsystem.countdown.*; import de.steamwar.fightsystem.event.HellsBells; @@ -171,11 +172,10 @@ public class FightSystem extends JavaPlugin { } FightStatistics.unrank(); - FightWorld.forceLoad(); Bukkit.getScheduler().runTask(getPlugin(), () -> { - new LixfelAI(Fight.getBlueTeam(), "Lixfel.AI"); - new LixfelAI(Fight.getRedTeam(), "YoyoNow.AI"); + new ChaosAI(Fight.getBlueTeam()); + new LixfelAI(Fight.getRedTeam(), SteamwarUser.get(-1)); }); } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ai/LixfelAI.java b/FightSystem_Core/src/de/steamwar/fightsystem/ai/LixfelAI.java index b01104a..688d9cc 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/ai/LixfelAI.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/ai/LixfelAI.java @@ -23,7 +23,6 @@ import de.steamwar.entity.REntityServer; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.ai.navmesh.NavMesh; import de.steamwar.fightsystem.fight.FightTeam; -import de.steamwar.fightsystem.states.FightState; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SteamwarUser; import org.bukkit.Material; @@ -31,7 +30,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import java.util.*; -import java.util.function.Function; public class LixfelAI extends AI { @@ -40,8 +38,8 @@ public class LixfelAI extends AI { private final FightTeam team; private final NavMesh navMesh; - public LixfelAI(FightTeam team, String user) { - super(team, SteamwarUser.get(user)); + public LixfelAI(FightTeam team, SteamwarUser user) { + super(team, user); this.team = team; navMesh = new NavMesh(team, entityServer); } @@ -69,14 +67,6 @@ public class LixfelAI extends AI { private Vector destination = null; private int index = 0; - LixfelPathplanner getPathplanner() { - return pathplanner; - } - - void setAction(Action action) { - this.action = action; - } - @Override protected void plan() { setReady(); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/Bridge.java b/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/Bridge.java deleted file mode 100644 index 076b93f..0000000 --- a/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/Bridge.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2023 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.fightsystem.ai.chaos; - -import org.bukkit.util.Vector; - -public class Bridge { - private Bridge() { - } - - public static final Vector BRIDGE_POS = new Vector(25, 14, 24); - public static final Vector BRIDGE_SHIELDS = new Vector(25, 15, 25); - public static final Vector BRIDGE_MG = new Vector(21, 15, 24); -} diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/Cannon.java b/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/Cannon.java index af6ff45..e54ebfe 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/Cannon.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/Cannon.java @@ -28,7 +28,7 @@ public class Cannon { public final Vector escape; public final String name; - private Cannon(String name, Vector[] tnt, Vector button, Vector load, Vector escape) { + public Cannon(String name, Vector[] tnt, Vector button, Vector load, Vector escape) { this.tnt = tnt; this.button = button; this.load = load; @@ -36,137 +36,23 @@ public class Cannon { this.name = name; } - public static final Vector[] DS_LEFT_TNT = new Vector[] { - new Vector(40, 24, 12), - new Vector(39, 24, 12), - new Vector(38, 23, 12), - new Vector(38, 24, 12), - new Vector(40, 23, 15), - new Vector(40, 23, 14), - new Vector(40, 24, 15), - new Vector(40, 24, 14), - new Vector(38, 23, 15), - new Vector(38, 23, 14), - new Vector(38, 24, 15), - new Vector(38, 24, 14), - new Vector(40, 23, 12), - }; - public static final Vector DS_LEFT_BUTTON = new Vector(39, 25, 11); - public static final Vector DS_LEFT_LOAD = new Vector(39, 25, 13); - public static final Vector DS_LEFT_ESCAPE = new Vector(31, 26, 13); - public static final Cannon DS_LEFT = new Cannon("Downstäb Links", DS_LEFT_TNT, DS_LEFT_BUTTON, DS_LEFT_LOAD, DS_LEFT_ESCAPE); + public Vector[] getTnt() { + return tnt; + } - public static final Vector[] DS_RIGHT_TNT = new Vector[] { - new Vector(12, 24, 12), - new Vector(11, 24, 12), - new Vector(10, 23, 12), - new Vector(10, 24, 12), - new Vector(10, 23, 15), - new Vector(10, 23, 14), - new Vector(10, 24, 15), - new Vector(10, 24, 14), - new Vector(12, 23, 14), - new Vector(12, 24, 14), - new Vector(12, 23, 15), - new Vector(12, 24, 15), - new Vector(12, 23, 12), - }; - public static final Vector DS_RIGHT_BUTTON = new Vector(11, 25, 11); - public static final Vector DS_RIGHT_LOAD = new Vector(11, 25, 13); - public static final Vector DS_RIGHT_ESCAPE = new Vector(19, 26, 13); - public static final Cannon DS_RIGHT = new Cannon("Downstäb Rechts", DS_RIGHT_TNT, DS_RIGHT_BUTTON, DS_RIGHT_LOAD, DS_RIGHT_ESCAPE); + public Vector getButton() { + return button; + } - public static final Vector[] STATIC_LEFT_TNT = new Vector[] { - new Vector(37, 17, 15), - new Vector(37, 17, 14), - new Vector(37, 18, 16), - new Vector(37, 18, 15), - new Vector(37, 18, 14), - new Vector(36, 17, 16), - new Vector(36, 17, 15), - new Vector(36, 17, 14), - new Vector(36, 18, 16), - new Vector(36, 18, 15), - new Vector(36, 18, 14), - new Vector(37, 17, 16), - }; - public static final Vector STATIC_LEFT_BUTTON = new Vector(38, 18, 11); - public static final Vector STATIC_LEFT_LOAD = new Vector(37, 17, 12); - public static final Vector STATIC_LEFT_ESCAPE = new Vector(30, 13, 9); - public static final Cannon STATIC_LEFT = new Cannon("Lupf Links", STATIC_LEFT_TNT, STATIC_LEFT_BUTTON, STATIC_LEFT_LOAD, STATIC_LEFT_ESCAPE); + public Vector getLoad() { + return load; + } - public static final Vector[] STATIC_RIGHT_TNT = new Vector[] { - new Vector(14, 17, 15), - new Vector(14, 18, 16), - new Vector(14, 18, 15), - new Vector(14, 17, 14), - new Vector(14, 18, 14), - new Vector(13, 17, 16), - new Vector(13, 17, 15), - new Vector(13, 17, 14), - new Vector(13, 18, 16), - new Vector(13, 18, 15), - new Vector(13, 18, 14), - new Vector(14, 17, 16), - }; - public static final Vector STATIC_RIGHT_BUTTON = new Vector(12, 18, 11); - public static final Vector STATIC_RIGHT_LOAD = new Vector(13, 17, 12); - public static final Vector STATIC_RIGHT_ESCAPE = new Vector(20, 13, 9); - public static final Cannon STATIC_RIGHT = new Cannon("Lupf Rechts", STATIC_RIGHT_TNT, STATIC_RIGHT_BUTTON, STATIC_RIGHT_LOAD, STATIC_RIGHT_ESCAPE); + public Vector getEscape() { + return escape; + } - public static final Vector[] AK_TNT = new Vector[] { - new Vector(10, 7, 17), - new Vector(10, 11, 17), - new Vector(10, 10, 17), - new Vector(10, 8, 17), - new Vector(10, 9, 17), - new Vector(10, 7, 15), - new Vector(11, 7, 15), - new Vector(12, 7, 15), - new Vector(10, 10, 15), - new Vector(11, 10, 15), - new Vector(12, 10, 15), - new Vector(12, 8, 15), - new Vector(12, 9, 15), - new Vector(11, 8, 15), - new Vector(11, 9, 15), - new Vector(10, 8, 15), - new Vector(10, 9, 15), - new Vector(10, 7, 19), - new Vector(11, 7, 19), - new Vector(12, 7, 19), - new Vector(12, 8, 19), - new Vector(11, 8, 19), - new Vector(10, 8, 19), - new Vector(10, 10, 19), - new Vector(11, 10, 19), - new Vector(12, 10, 19), - new Vector(12, 9, 19), - new Vector(11, 9, 19), - new Vector(10, 9, 19), - new Vector(10, 6, 17), - }; - public static final Vector AK_BUTTON = new Vector(9, 9, 16); - public static final Vector AK_LOAD = new Vector(11, 8, 17); - public static final Cannon AK = new Cannon("Arschkratzer", AK_TNT, AK_BUTTON, AK_LOAD, null); - - public static final Vector[] HA_RIGHT_TNT = new Vector[] { - new Vector(23, 5, 9), - new Vector(23, 6, 9), - new Vector(23, 7, 9), - new Vector(23, 8, 9), - }; - - public static final Vector[] HA_LEFT_TNT = new Vector[] { - new Vector(27, 5, 9), - new Vector(27, 6, 9), - new Vector(27, 7, 9), - new Vector(27, 8, 9), - }; - - public static final Vector HA_RIGHT_LOAD = new Vector(23, 8, 8); - public static final Vector HA_LEFT_LOAD = new Vector(27, 8, 8); - - public static final Cannon HA_LEFT = new Cannon("Halbautomatik Links", HA_LEFT_TNT, null, HA_LEFT_LOAD, null); - public static final Cannon HA_RIGHT = new Cannon("Halbautomatik Rechts", HA_RIGHT_TNT, null, HA_RIGHT_LOAD, null); + public String getName() { + return name; + } } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/ChaosAI.java b/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/ChaosAI.java index 4e665fd..34f1ca7 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/ChaosAI.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/ChaosAI.java @@ -19,39 +19,44 @@ package de.steamwar.fightsystem.ai.chaos; +import de.steamwar.entity.REntityServer; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.ai.AI; -import de.steamwar.fightsystem.ai.LixfelPathplanner; +import de.steamwar.fightsystem.ai.chaos.gears.Gear; +import de.steamwar.fightsystem.ai.chaos.gears.TheUnderground; +import de.steamwar.fightsystem.ai.navmesh.NavMesh; import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.states.FightState; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.util.Vector; import java.util.*; public class ChaosAI extends AI { - private final LixfelPathplanner pathplanner = new LixfelPathplanner(chooseSchematic()); private State state = State.PRE_PREPARE; - private static final Cannon[] cannons = new Cannon[] { - Cannon.DS_LEFT, - Cannon.DS_RIGHT, - Cannon.STATIC_LEFT, - Cannon.STATIC_RIGHT, - Cannon.HA_LEFT, - Cannon.HA_RIGHT, - //Cannon.AK, - }; + private static final Gear gear = TheUnderground.THE_UNDERGROUND; + private Cannon currentCannon; private boolean igniteMg = false; private static final Random random = new Random(); public static Map onePrepares = new HashMap<>(); private boolean prepares = false; private static final Map> cannonsShot = new HashMap<>(); + private final NavMesh navMesh; + private final REntityServer entityServer = new REntityServer(); + private Vector source = null; + private Vector destination = null; + private int index = 0; + private State nextState = null; + public ChaosAI(FightTeam team) { this(team, SteamwarUser.get(14533)); } @@ -59,6 +64,7 @@ public class ChaosAI extends AI { public ChaosAI(FightTeam team, SteamwarUser user) { super(team, user); + this.navMesh = new NavMesh(team, entityServer); if (Boolean.FALSE.equals(onePrepares.getOrDefault(team, false))) { prepares = true; onePrepares.put(team, true); @@ -67,7 +73,7 @@ public class ChaosAI extends AI { @Override public SchematicNode chooseSchematic() { - return SchematicNode.getSchematicNode(111476); + return SchematicNode.getSchematicNode(gear.getSchematicId()); } @Override @@ -77,16 +83,17 @@ public class ChaosAI extends AI { Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { state = State.PREPARE; }, 20 * 15); - state = State.PREPARING_PREPARE; - break; - case WAIT_TILL_IGNITE: - case PREPARING_PREPARE: + state = State.WAIT; break; case PREPARE: prepare(); - state = State.PREPARE_READY; break; case PREPARE_READY: + if (prepares) { + for (Vector prepareButton : gear.getPrepareButtons()) { + interact(prepareButton); + } + } setReady(); state = State.WAIT_TILL_START; break; @@ -99,10 +106,10 @@ public class ChaosAI extends AI { case IGNITE_MG: if(igniteMg) { if (prepares) { - interact(Bridge.BRIDGE_MG); + interact(gear.getMgButton()); chat("Die MG ist angezündet!"); } - state = State.WAIT_TILL_IGNITE; + state = State.WAIT; currentCannon = randomCannon(); Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> state = State.FIGHT, 20 * 9); } @@ -110,20 +117,69 @@ public class ChaosAI extends AI { case FIGHT: fireCannon(currentCannon); break; + case LOAD_CANNON: + loadCannon(currentCannon); + break; case ESCAPE: - chat("Ich flüchte!"); - if (currentCannon.escape != null) { - pathplanner.planToAnywhere(getPosition(), currentCannon.escape.add(new Vector(0.5, 0, 0.5))).forEach(this::move); - } - cannonsShot.computeIfAbsent(team, fightTeam -> new HashSet<>()).remove(currentCannon); currentCannon = randomCannon(); - state = State.FIGHT; + state = State.WAIT; + Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> state = State.FIGHT, 20 * 4); + break; + case WAIT: + break; + case WALK: + if (!getEntity().isOnGround() && getEntity().getLocation().getBlock().getType() != Material.LADDER) return; + + List oldRoute = navMesh.path(source, destination); + navMesh.update(getEntity().getLocation().toVector()); + List path = navMesh.path(source, destination); + + if (path.isEmpty()) { + source = null; + destination = null; + state = nextState; + chat("no route"); + return; + } + if (!oldRoute.equals(path)) { + source = getEntity().getLocation().toVector(); + index = 0; + chat("new route"); + return; + } + if (index == 0) { + chat(source + " -> " + destination + " = " + path.size()); + } + + Vector loc = path.get(index++); + move(toAIPosition(loc)); + + if (index == path.size()) { + source = null; + destination = null; + state = nextState; + } break; } } + private void moveTo(Vector vec, State nextState) { + source = getEntity().getLocation().toVector(); + Vector currentBest = null; + for (Vector vector : navMesh.getWalkableBlocks(source)) { + if (currentBest == null || vector.distanceSquared(vec) < currentBest.distanceSquared(vec)) { + currentBest = vector; + } + } + + destination = currentBest; + index = 0; + state = State.WALK; + this.nextState = nextState; + } + @Override public void stop() { chat("gege wp eZ win 4nus"); @@ -135,19 +191,25 @@ public class ChaosAI extends AI { @Override public boolean acceptJoinRequest(Player player, FightTeam team) { + if (team == this.team) { + entityServer.addPlayer(player); + } return team == this.team; } public void fireCannon(Cannon cannon) { chat("Ich feuere " + cannon.name + " an!"); - pathplanner.planToAnywhere(getPosition(), cannon.load.add(new Vector(0.5, 0, 0.5))).forEach(this::move); + moveTo(cannon.load.clone().add(new Vector(0.5, 0, 0.5)), State.LOAD_CANNON); + } + + private void loadCannon(Cannon cannon) { if (cannon.button == null) { for (int i = 0; i < 20; i++) { for (Vector vector : cannon.tnt) { setTNT(vector); } for (int j = 0; j < 30; j++) { - getBlock(Bridge.BRIDGE_MG); + getBlock(gear.getMgButton()); } } } else { @@ -157,13 +219,15 @@ public class ChaosAI extends AI { interact(cannon.button); } - state = State.ESCAPE; + if (currentCannon.escape != null) { + moveTo(cannon.getEscape().clone().add(new Vector(0.5, 0, 0.5)), State.ESCAPE); + } } private Cannon randomCannon() { - Cannon nextCannon = cannons[random.nextInt(cannons.length)]; + Cannon nextCannon = gear.getCannons()[random.nextInt(gear.getCannons().length)]; while (cannonsShot.computeIfAbsent(team, fightTeam -> new HashSet<>()).contains(nextCannon)) { - nextCannon = cannons[random.nextInt(cannons.length)]; + nextCannon = gear.getCannons()[random.nextInt(gear.getCannons().length)]; } cannonsShot.computeIfAbsent(team, fightTeam -> new HashSet<>()).add(nextCannon); @@ -178,28 +242,26 @@ public class ChaosAI extends AI { } Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { igniteMg = true; - }, 20 * 21); + }, 20L * gear.getMgTime()); } public void prepare() { chat("Prepare your fkin 4nus"); if (prepares) { - pathplanner.planToAnywhere(getPosition(), Bridge.BRIDGE_POS.add(new Vector(0.5, 0, 0.5))).forEach(this::move); - interact(Bridge.BRIDGE_SHIELDS); - pathplanner.planToAnywhere(getPosition(), Bridge.BRIDGE_POS.add(new Vector(0.5, 0, 0.5)).subtract(new Vector(2, 0, 0))).forEach(this::move); + moveTo(gear.getBridge().clone().add(new Vector(0.5, 0, 0.5)), State.PREPARE_READY); } } private enum State { PRE_PREPARE, - PREPARING_PREPARE, PREPARE, PREPARE_READY, WAIT_TILL_START, IGNITE_MG, - WAIT_TILL_IGNITE, FIGHT, + LOAD_CANNON, ESCAPE, - + WAIT, + WALK, } } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/gears/Gear.java b/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/gears/Gear.java new file mode 100644 index 0000000..f02a023 --- /dev/null +++ b/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/gears/Gear.java @@ -0,0 +1,66 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.fightsystem.ai.chaos.gears; + +import de.steamwar.fightsystem.ai.chaos.Cannon; +import org.bukkit.util.Vector; + +public class Gear { + + private final Cannon[] cannons; + private final Vector bridge; + private final Vector[] prepareButtons; + private final Vector mgButton; + private final int mgTime; + private final int schematicId; + + protected Gear(Cannon[] cannons, Vector bridge, Vector[] prepareButtons, Vector mgButton, int mgTime, int schematicId) { + this.cannons = cannons; + this.bridge = bridge; + this.prepareButtons = prepareButtons; + this.mgButton = mgButton; + this.mgTime = mgTime; + this.schematicId = schematicId; + } + + public Cannon[] getCannons() { + return cannons; + } + + public Vector getBridge() { + return bridge; + } + + public Vector[] getPrepareButtons() { + return prepareButtons; + } + + public Vector getMgButton() { + return mgButton; + } + + public int getMgTime() { + return mgTime; + } + + public int getSchematicId() { + return schematicId; + } +} diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/gears/TheUnderground.java b/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/gears/TheUnderground.java new file mode 100644 index 0000000..f30ec3a --- /dev/null +++ b/FightSystem_Core/src/de/steamwar/fightsystem/ai/chaos/gears/TheUnderground.java @@ -0,0 +1,184 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.fightsystem.ai.chaos.gears; + +import de.steamwar.fightsystem.ai.chaos.Cannon; +import org.bukkit.util.Vector; + +public class TheUnderground { + + public static final Vector[] DS_LEFT_TNT = new Vector[] { + new Vector(40, 24, 12), + new Vector(39, 24, 12), + new Vector(38, 23, 12), + new Vector(38, 24, 12), + new Vector(40, 23, 15), + new Vector(40, 23, 14), + new Vector(40, 24, 15), + new Vector(40, 24, 14), + new Vector(38, 23, 15), + new Vector(38, 23, 14), + new Vector(38, 24, 15), + new Vector(38, 24, 14), + new Vector(40, 23, 12), + }; + public static final Vector DS_LEFT_BUTTON = new Vector(39, 25, 11); + public static final Vector DS_LEFT_LOAD = new Vector(39, 25, 13); + public static final Vector DS_LEFT_ESCAPE = new Vector(31, 26, 13); + public static final Cannon DS_LEFT = new Cannon("Downstäb Links", DS_LEFT_TNT, DS_LEFT_BUTTON, DS_LEFT_LOAD, DS_LEFT_ESCAPE); + + public static final Vector[] DS_RIGHT_TNT = new Vector[] { + new Vector(12, 24, 12), + new Vector(11, 24, 12), + new Vector(10, 23, 12), + new Vector(10, 24, 12), + new Vector(10, 23, 15), + new Vector(10, 23, 14), + new Vector(10, 24, 15), + new Vector(10, 24, 14), + new Vector(12, 23, 14), + new Vector(12, 24, 14), + new Vector(12, 23, 15), + new Vector(12, 24, 15), + new Vector(12, 23, 12), + }; + public static final Vector DS_RIGHT_BUTTON = new Vector(11, 25, 11); + public static final Vector DS_RIGHT_LOAD = new Vector(11, 25, 13); + public static final Vector DS_RIGHT_ESCAPE = new Vector(19, 26, 13); + public static final Cannon DS_RIGHT = new Cannon("Downstäb Rechts", DS_RIGHT_TNT, DS_RIGHT_BUTTON, DS_RIGHT_LOAD, DS_RIGHT_ESCAPE); + + public static final Vector[] STATIC_LEFT_TNT = new Vector[] { + new Vector(37, 17, 15), + new Vector(37, 17, 14), + new Vector(37, 18, 16), + new Vector(37, 18, 15), + new Vector(37, 18, 14), + new Vector(36, 17, 16), + new Vector(36, 17, 15), + new Vector(36, 17, 14), + new Vector(36, 18, 16), + new Vector(36, 18, 15), + new Vector(36, 18, 14), + new Vector(37, 17, 16), + }; + public static final Vector STATIC_LEFT_BUTTON = new Vector(38, 18, 11); + public static final Vector STATIC_LEFT_LOAD = new Vector(37, 17, 12); + public static final Vector STATIC_LEFT_ESCAPE = new Vector(30, 13, 9); + public static final Cannon STATIC_LEFT = new Cannon("Lupf Links", STATIC_LEFT_TNT, STATIC_LEFT_BUTTON, STATIC_LEFT_LOAD, STATIC_LEFT_ESCAPE); + + public static final Vector[] STATIC_RIGHT_TNT = new Vector[] { + new Vector(14, 17, 15), + new Vector(14, 18, 16), + new Vector(14, 18, 15), + new Vector(14, 17, 14), + new Vector(14, 18, 14), + new Vector(13, 17, 16), + new Vector(13, 17, 15), + new Vector(13, 17, 14), + new Vector(13, 18, 16), + new Vector(13, 18, 15), + new Vector(13, 18, 14), + new Vector(14, 17, 16), + }; + public static final Vector STATIC_RIGHT_BUTTON = new Vector(12, 18, 11); + public static final Vector STATIC_RIGHT_LOAD = new Vector(13, 17, 12); + public static final Vector STATIC_RIGHT_ESCAPE = new Vector(20, 13, 9); + public static final Cannon STATIC_RIGHT = new Cannon("Lupf Rechts", STATIC_RIGHT_TNT, STATIC_RIGHT_BUTTON, STATIC_RIGHT_LOAD, STATIC_RIGHT_ESCAPE); + + public static final Vector[] AK_TNT = new Vector[] { + new Vector(10, 7, 17), + new Vector(10, 11, 17), + new Vector(10, 10, 17), + new Vector(10, 8, 17), + new Vector(10, 9, 17), + new Vector(10, 7, 15), + new Vector(11, 7, 15), + new Vector(12, 7, 15), + new Vector(10, 10, 15), + new Vector(11, 10, 15), + new Vector(12, 10, 15), + new Vector(12, 8, 15), + new Vector(12, 9, 15), + new Vector(11, 8, 15), + new Vector(11, 9, 15), + new Vector(10, 8, 15), + new Vector(10, 9, 15), + new Vector(10, 7, 19), + new Vector(11, 7, 19), + new Vector(12, 7, 19), + new Vector(12, 8, 19), + new Vector(11, 8, 19), + new Vector(10, 8, 19), + new Vector(10, 10, 19), + new Vector(11, 10, 19), + new Vector(12, 10, 19), + new Vector(12, 9, 19), + new Vector(11, 9, 19), + new Vector(10, 9, 19), + new Vector(10, 6, 17), + }; + public static final Vector AK_BUTTON = new Vector(9, 9, 16); + public static final Vector AK_LOAD = new Vector(11, 8, 17); + public static final Cannon AK = new Cannon("Arschkratzer", AK_TNT, AK_BUTTON, AK_LOAD, null); + + public static final Vector[] HA_RIGHT_TNT = new Vector[] { + new Vector(23, 5, 9), + new Vector(23, 6, 9), + new Vector(23, 7, 9), + new Vector(23, 8, 9), + }; + + public static final Vector[] HA_LEFT_TNT = new Vector[] { + new Vector(27, 5, 9), + new Vector(27, 6, 9), + new Vector(27, 7, 9), + new Vector(27, 8, 9), + }; + + public static final Vector HA_RIGHT_LOAD = new Vector(23, 8, 8); + public static final Vector HA_LEFT_LOAD = new Vector(27, 8, 8); + + public static final Cannon HA_LEFT = new Cannon("Halbautomatik Links", HA_LEFT_TNT, null, HA_LEFT_LOAD, null); + public static final Cannon HA_RIGHT = new Cannon("Halbautomatik Rechts", HA_RIGHT_TNT, null, HA_RIGHT_LOAD, null); + + public static final Vector BRIDGE_POS = new Vector(25, 14, 24); + public static final Vector BRIDGE_SHIELDS = new Vector(25, 15, 25); + public static final Vector BRIDGE_MG = new Vector(21, 15, 24); + + public static final Gear THE_UNDERGROUND = new Gear( + new Cannon[] { + DS_LEFT, + DS_RIGHT, + STATIC_LEFT, + STATIC_RIGHT, + AK, + HA_LEFT, + HA_RIGHT, + //Cannon.AK, + }, + BRIDGE_POS, + new Vector[] { + BRIDGE_SHIELDS + }, + BRIDGE_MG, + 21, + 124667 + ); +} diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ai/navmesh/NavMesh.java b/FightSystem_Core/src/de/steamwar/fightsystem/ai/navmesh/NavMesh.java index d746c71..eb57491 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/ai/navmesh/NavMesh.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/ai/navmesh/NavMesh.java @@ -78,14 +78,12 @@ public class NavMesh implements Listener { }); floorBlock.forEach(this::checkNeighbouring); System.out.println(System.currentTimeMillis() - time + " ms"); - /* iterateWalkableBlocks((vector, ceilingOffset) -> { RArmorStand armorStand = new RArmorStand(entityServer, vector.toLocation(WORLD), RArmorStand.Size.MARKER); armorStand.setNoGravity(true); armorStand.setInvisible(true); armorStand.setDisplayName("+" + (ceilingOffset == null ? "∞" : ceilingOffset)); }); - */ }, 20); }); new OneShotStateDependent(ArenaMode.All, FightState.Spectate, () -> { diff --git a/gradlew b/gradlew old mode 100755 new mode 100644