From 11c97e2daf3faa87810d7ee6f430caafce21ba90 Mon Sep 17 00:00:00 2001 From: dginovker Date: Sun, 16 Jun 2019 13:44:53 -0400 Subject: [PATCH] Beautiful pest control bots --- .../minigamebots/pestcontrol/CombatState.java | 30 +++++++++++++++---- .../pestcontrol/PestControlTestBot.java | 2 ++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/CombatState.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/CombatState.java index 1913bc599..dee2791c6 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/CombatState.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/CombatState.java @@ -11,6 +11,7 @@ import static plugin.activity.pestcontrol.PestControlHelper.*; public class CombatState { private PestControlTestBot bot; + private Random Random = new Random(); //Ya idc if that's bad java, it's killing me right now lmfao public CombatState(PestControlTestBot pestControlTestBot) { this.bot = pestControlTestBot; @@ -20,24 +21,41 @@ public class CombatState { bot.setCustomState("I'm at portals."); Node gate = bot.getClosestNodeWithEntry(75, GATE_ENTRIES); Node portal = bot.getClosestNodeWithEntry(75, PORTAL_ENTRIES); + if (bot.justStartedGame && new Random().nextInt(2) == 0) + { + return; + } if (bot.justStartedGame || gate == null && portal == null) { bot.setCustomState("Walking randomly"); bot.justStartedGame = false; bot.randomWalkAroundPoint(getMyPestControlSession(bot).getSquire().getLocation(), 15); - bot.movetimer = new Random().nextInt(5) + 1; + bot.movetimer = new Random().nextInt(7) + 6; return; } - if (gate != null) + if (gate != null && bot.randomType < 40 && (!bot.openedGate || new Random().nextInt(3) == 1)) { bot.setCustomState("Interacting gate ID " + gate.getId()); bot.interact(gate); + bot.openedGate = true; + bot.movetimer = new Random().nextInt(2) + 4; + return; + } else if (gate != null) { + bot.setCustomState("Waiting for someone to open gate"); + bot.movetimer = new Random().nextInt(2) + 1; + if (new Random().nextInt(2) == 0) + { + bot.randomWalkAroundPoint(gate.getLocation(), 5); + } return; } - - bot.setCustomState("Walking to portals"); - bot.randomWalkAroundPoint(portal.getLocation(), 5); - bot.movetimer = new Random().nextInt(5) + 5; + if (portal.getLocation() != null) + { + bot.setCustomState("Walking to portals"); + bot.randomWalkAroundPoint(portal.getLocation(), 5); + bot.movetimer = new Random().nextInt(5) + 5; + } + bot.setCustomState("Absolutely nothing. Everything is dead"); } public void fightNPCs() { diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/PestControlTestBot.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/PestControlTestBot.java index 83c339e89..34d4e9717 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/PestControlTestBot.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/PestControlTestBot.java @@ -20,6 +20,7 @@ public class PestControlTestBot extends PvMBots { public int movetimer = 0; public int randomType; + public boolean openedGate; private BoatInfo myBoat = BoatInfo.NOVICE; private CombatState combathandler = new CombatState(this); @@ -113,6 +114,7 @@ public class PestControlTestBot extends PvMBots { private int insideBoatWalks = 3; private void idleInBoat() { justStartedGame = true; + openedGate = false; if (randomType < 35) //He's the type of guy to walk around the boat { if (new Random().nextInt(insideBoatWalks) <= 1)