From 93c4103f6120fe7dfaef1731960dbc3bd20b2737 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 14 May 2024 18:42:38 -0500 Subject: [PATCH] Lore Mob AI Aggro --- src/engine/mobileAI/MobAI.java | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 12e0940d..187e9946 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -968,33 +968,19 @@ public class MobAI { } private static void hamletGuardAggro(Mob mob) { - ConcurrentHashMap loadedPlayers = mob.playerAgroMap; - - for (Entry playerEntry : loadedPlayers.entrySet()) { - - int playerID = playerEntry.getKey(); - PlayerCharacter loadedPlayer = PlayerCharacter.getPlayerCharacter(playerID); - - if (loadedPlayer == null) + HashSet loadedPlayers = WorldGrid.getObjectsInRangePartial(mob.loc,MobAIThread.AI_BASE_AGGRO_RANGE,MBServerStatics.MASK_PLAYER); + for(AbstractWorldObject awo : loadedPlayers){ + PlayerCharacter pc = (PlayerCharacter) awo; + if(!pc.isAlive() || !pc.isActive()) continue; - - if (!loadedPlayer.isAlive()) - continue; - - //Can't see target, skip aggro. - - if (!mob.canSee(loadedPlayer)) - continue; - - // No aggro for this player - - if (!guardCanAggro(mob, loadedPlayer)) - continue; - - if (MovementUtilities.inRangeToAggro(mob, loadedPlayer) && mob.getCombatTarget() == null) { - mob.setCombatTarget(loadedPlayer); + if(pc.guild.equals(Guild.getErrantGuild())) { + mob.combatTarget = pc; return; } + if(pc.guild.charter.equals(mob.guild.charter)) + continue; + mob.combatTarget = pc; + return; } }