Browse Source

Lore Mob AI Aggro

combat-2
FatBoy-DOTC 6 months ago
parent
commit
93c4103f61
  1. 34
      src/engine/mobileAI/MobAI.java

34
src/engine/mobileAI/MobAI.java

@ -968,33 +968,19 @@ public class MobAI {
} }
private static void hamletGuardAggro(Mob mob) { private static void hamletGuardAggro(Mob mob) {
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap; HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(mob.loc,MobAIThread.AI_BASE_AGGRO_RANGE,MBServerStatics.MASK_PLAYER);
for(AbstractWorldObject awo : loadedPlayers){
for (Entry<Integer, Float> playerEntry : loadedPlayers.entrySet()) { PlayerCharacter pc = (PlayerCharacter) awo;
if(!pc.isAlive() || !pc.isActive())
int playerID = playerEntry.getKey();
PlayerCharacter loadedPlayer = PlayerCharacter.getPlayerCharacter(playerID);
if (loadedPlayer == null)
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; continue;
if(pc.guild.equals(Guild.getErrantGuild())) {
if (MovementUtilities.inRangeToAggro(mob, loadedPlayer) && mob.getCombatTarget() == null) { mob.combatTarget = pc;
mob.setCombatTarget(loadedPlayer);
return; return;
} }
if(pc.guild.charter.equals(mob.guild.charter))
continue;
mob.combatTarget = pc;
return;
} }
} }

Loading…
Cancel
Save