Browse Source

Null check is made before this method call.

feature-workorder
MagicBot 1 year ago
parent
commit
5eb6302d2a
  1. 20
      src/engine/mobileAI/MobAI.java

20
src/engine/mobileAI/MobAI.java

@ -439,7 +439,7 @@ public class MobAI { @@ -439,7 +439,7 @@ public class MobAI {
msg.setUnknown04(2);
PowersManager.finishUseMobPower(msg, mob, 0, 0);
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
long randomCooldown = (long) ((ThreadLocalRandom.current().nextInt(10, 15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
return true;
@ -575,7 +575,7 @@ public class MobAI { @@ -575,7 +575,7 @@ public class MobAI {
//no players loaded, no need to proceed
if (mob.playerAgroMap.isEmpty()) {
if(mob.getCombatTarget() != null)
if (mob.getCombatTarget() != null)
mob.setCombatTarget(null);
return;
}
@ -722,16 +722,16 @@ public class MobAI { @@ -722,16 +722,16 @@ public class MobAI {
case Pet1:
if ((PlayerCharacter) mob.guardCaptain == null)
if (mob.guardCaptain == null)
return;
if (!mob.playerAgroMap.containsKey(((PlayerCharacter) mob.guardCaptain).getObjectUUID())) {
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
//mob no longer has its owner loaded, translocate pet to owner
MovementManager.translocate(mob, ((PlayerCharacter) mob.guardCaptain).getLoc(), null);
MovementManager.translocate(mob, mob.guardCaptain.getLoc(), null);
return;
}
if (mob.getCombatTarget() == null) {
@ -739,11 +739,11 @@ public class MobAI { @@ -739,11 +739,11 @@ public class MobAI {
//move back to owner
if (CombatUtilities.inRange2D(mob, (PlayerCharacter) mob.guardCaptain, 6))
if (CombatUtilities.inRange2D(mob, mob.guardCaptain, 6))
return;
mob.destination = ((PlayerCharacter) mob.guardCaptain).getLoc();
mob.destination = mob.guardCaptain.getLoc();
MovementUtilities.moveToLocation(mob, mob.destination, 5);
} else
chaseTarget(mob);
@ -893,7 +893,7 @@ public class MobAI { @@ -893,7 +893,7 @@ public class MobAI {
mob.setCombatTarget(null);
for (Integer playerEntry : mob.playerAgroMap.keySet())
mob.playerAgroMap.put(playerEntry,0f);
mob.playerAgroMap.put(playerEntry, 0f);
}
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
@ -907,7 +907,7 @@ public class MobAI { @@ -907,7 +907,7 @@ public class MobAI {
float rangeSquared = mob.getRange() * mob.getRange();
float distanceSquared = mob.getLoc().distanceSquared2D(mob.getCombatTarget().getLoc());
if(mob.isMoving() == true && distanceSquared < rangeSquared - 50) {
if (mob.isMoving() == true && distanceSquared < rangeSquared - 50) {
mob.destination = mob.getLoc();
MovementUtilities.moveToLocation(mob, mob.destination, 0);
} else if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) {
@ -1135,7 +1135,7 @@ public class MobAI { @@ -1135,7 +1135,7 @@ public class MobAI {
// Defer to captain if possible for current target
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) &&
mob.combatTarget == null && mob.guardCaptain.isAlive()
mob.guardCaptain.isAlive()
&& mob.guardCaptain.combatTarget != null) {
mob.setCombatTarget(mob.guardCaptain.combatTarget);
return;

Loading…
Cancel
Save