Browse Source

Lore Mob AI Aggro

combat-2
FatBoy-DOTC 7 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 { @@ -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)
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))
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 (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;
}
}

Loading…
Cancel
Save