From 03f0f3fcf0318d627dcf66b7125abd2f7e3100d8 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 17 May 2024 19:41:26 -0500 Subject: [PATCH] noob island guard aggro --- src/engine/mobileAI/MobAI.java | 36 ++++++++++++++++++++++++---------- src/engine/objects/City.java | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index acb240a5..5c2b8533 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -8,6 +8,7 @@ package engine.mobileAI; +import engine.InterestManagement.RealmMap; import engine.InterestManagement.WorldGrid; import engine.gameManager.*; import engine.math.Vector3f; @@ -972,19 +973,34 @@ public class MobAI { } private static void hamletGuardAggro(Mob mob) { - 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(pc.guild.equals(Guild.getErrantGuild())) { + City city = ZoneManager.getCityAtLocation(mob.bindLoc); + if(city != null && city.isNoobIsle == 1){ + //noob island guards only aggro to mobs + HashSet loadedMobs = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_MOB); + for (AbstractWorldObject awo : loadedMobs) { + Mob targetMob = (Mob) awo; + if (!targetMob.isAlive() || targetMob.despawned) + continue; + if (targetMob.isPet()) + continue; + mob.combatTarget = targetMob; + return; + } + } else { + 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 (pc.guild.equals(Guild.getErrantGuild())) { + mob.combatTarget = pc; + return; + } + if (pc.guild.charter.equals(mob.guild.charter)) + continue; mob.combatTarget = pc; return; } - if(pc.guild.charter.equals(mob.guild.charter)) - continue; - mob.combatTarget = pc; - return; } } diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index e1b5f4a6..ac75ee9d 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -59,7 +59,7 @@ public class City extends AbstractWorldObject { private String cityName; private String motto; private String description; - private int isNoobIsle; //1: noob, 0: not noob: -1: not noob, no teleport + public int isNoobIsle; //1: noob, 0: not noob: -1: not noob, no teleport private int population = 0; private int siegesWithstood = 0; private int radiusType;