From 259025d572b63bac504da3fc697428ddee29534d Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 17 Apr 2023 21:31:56 -0500 Subject: [PATCH] guard recall off city grid --- src/engine/ai/MobileFSM.java | 14 +++++++------- src/engine/gameManager/NPCManager.java | 6 ++++-- src/engine/objects/Mob.java | 3 ++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 77b3f956..7ce85eef 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -506,13 +506,8 @@ public class MobileFSM { CheckForRespawn(mob); return; } - if (mob.getLoc().distanceSquared2D(mob.npcOwner.getLoc()) > sqr(2000)) { - MovementManager.translocate(mob,((Mob)mob.npcOwner).building.getLoc(),null); - mob.setAggroTargetID(0); - mob.setCombatTarget(null); - } + CheckToSendMobHome(mob); if(mob.npcOwner.isAlive() == false){ - CheckToSendMobHome(mob); CheckForPlayerGuardAggro(mob); CheckMobMovement(mob); if(mob.getCombatTarget() != null){ @@ -599,7 +594,6 @@ public class MobileFSM { } mob.updateLocation(); if (mob.isPet() == false && mob.isSummonedPet() == false && mob.isNecroPet() == false) { - if (mob.getCombatTarget() == null) { patrol(mob); } else { @@ -673,6 +667,12 @@ public class MobileFSM { mobAttack(mob); } private static void CheckToSendMobHome(Mob mob) { + if(mob.isPlayerGuard() && ZoneManager.getCityAtLocation(mob.getLoc()).equals(mob.getGuild().getOwnedCity()) == false){ + PowersBase recall = PowersManager.getPowerByToken(-1994153779); + PowersManager.useMobPower(mob, mob, recall, 40); + mob.setAggroTargetID(0); + mob.setCombatTarget(null); + } if (mob.getLoc().distanceSquared2D(mob.getBindLoc()) > sqr(2000)) { PowersBase recall = PowersManager.getPowerByToken(-1994153779); PowersManager.useMobPower(mob, mob, recall, 40); diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 5810417b..fcc40b4a 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -319,11 +319,13 @@ public enum NPCManager { slot += guardCaptain.siegeMinionMap.size() + 1; guardCaptain.siegeMinionMap.put(mob, slot); - mob.setInBuildingLoc(guardCaptain.building, guardCaptain); - mob.setBindLoc(loc.add(mob.inBuildingLoc)); + //mob.setInBuildingLoc(guardCaptain.building, guardCaptain); + //mob.setBindLoc(loc.add(mob.inBuildingLoc)); mob.deathTime = System.currentTimeMillis(); mob.spawnTime = 900; mob.npcOwner = guardCaptain; + mob.setBindLoc(guardCaptain.building.getLoc()); + MovementManager.translocate(mob,guardCaptain.building.getLoc(),null); mob.BehaviourType = Enum.MobBehaviourType.GuardMinion; return mob; } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 5d452b02..74634b5a 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -13,6 +13,7 @@ import engine.Enum; import engine.Enum.*; import engine.InterestManagement.WorldGrid; import engine.ai.MobileFSM; +import engine.ai.utilities.MovementUtilities; import engine.exception.SerializationException; import engine.gameManager.*; import engine.job.JobContainer; @@ -248,7 +249,7 @@ public class Mob extends AbstractIntelligenceAgent { if (NPC.ISGuardCaptain(contract.getContractID())) { this.spawnTime = 60 * 15; this.isPlayerGuard = true; - this.nameOverride = contract.getName(); + this.nameOverride = contract.getName() + " Captain"; } int guildID = rs.getInt("mob_guildUID");