diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 21e9c7e7..d5e0fb1a 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -1391,35 +1391,37 @@ public class MobAI { public static AbstractWorldObject ChangeTargetFromHateValue(Mob mob) { - try { + if(mob.combatTarget != null) + return mob.combatTarget; + //try { - float CurrentHateValue = 0; - if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.Mob)){ - return mob.getCombatTarget(); - } + // float CurrentHateValue = 0; + // if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.Mob)){ + // return mob.getCombatTarget(); + // } - if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) - CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID()).floatValue(); + // if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) + // CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID()).floatValue(); - AbstractWorldObject mostHatedTarget = null; + // AbstractWorldObject mostHatedTarget = null; - for (Entry playerEntry : mob.playerAgroMap.entrySet()) { + // for (Entry playerEntry : mob.playerAgroMap.entrySet()) { - PlayerCharacter potentialTarget = PlayerCharacter.getFromCache((int) playerEntry.getKey()); + // PlayerCharacter potentialTarget = PlayerCharacter.getFromCache((int) playerEntry.getKey()); - if (potentialTarget.equals(mob.getCombatTarget())) - continue; + // if (potentialTarget.equals(mob.getCombatTarget())) + // continue; - if (potentialTarget != null && mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) { - CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue(); - mostHatedTarget = potentialTarget; - } + // if (potentialTarget != null && mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) { + // CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue(); + // mostHatedTarget = potentialTarget; + // } - } - return mostHatedTarget; - } catch (Exception e) { - Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: ChangeTargetFromMostHated" + " " + e.getMessage()); - } + // } + // return mostHatedTarget; + //} catch (Exception e) { + // Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: ChangeTargetFromMostHated" + " " + e.getMessage()); + //} return null; } } \ No newline at end of file