|
|
|
@ -968,33 +968,19 @@ public class MobAI {
@@ -968,33 +968,19 @@ public class MobAI {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void hamletGuardAggro(Mob mob) { |
|
|
|
|
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap; |
|
|
|
|
|
|
|
|
|
for (Entry<Integer, Float> playerEntry : loadedPlayers.entrySet()) { |
|
|
|
|
|
|
|
|
|
int playerID = playerEntry.getKey(); |
|
|
|
|
PlayerCharacter loadedPlayer = PlayerCharacter.getPlayerCharacter(playerID); |
|
|
|
|
|
|
|
|
|
if (loadedPlayer == null) |
|
|
|
|
HashSet<AbstractWorldObject> 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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|