diff --git a/src/engine/mobileAI/Behaviours/StandardMob.java b/src/engine/mobileAI/Behaviours/StandardMob.java index fd6687ce..8349e946 100644 --- a/src/engine/mobileAI/Behaviours/StandardMob.java +++ b/src/engine/mobileAI/Behaviours/StandardMob.java @@ -33,13 +33,11 @@ public class StandardMob { if(mob.combatTarget == null) { if (!inRange.isEmpty()) { CheckForAggro(mob); - return; } }else{ CheckToDropCombatTarget(mob); if(mob.combatTarget == null){ CheckForAggro(mob); - return; } } @@ -146,7 +144,7 @@ public class StandardMob { } //find most hated target - PlayerCharacter mostHated = (PlayerCharacter)inRange.iterator().next(); + PlayerCharacter mostHated = null; for(AbstractWorldObject awo : inRange){ PlayerCharacter loadedPlayer = (PlayerCharacter)awo; if (loadedPlayer == null) @@ -168,6 +166,9 @@ public class StandardMob { if (mob.enemy != null && mob.enemy.size() > 0 && !mob.enemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType())) continue; + if(mostHated == null) + mostHated = loadedPlayer; + if(mob.hate_values.containsKey(loadedPlayer)) if(mob.hate_values.get(loadedPlayer) > mob.hate_values.get(mostHated)) mostHated = loadedPlayer; @@ -181,16 +182,18 @@ public class StandardMob { if(mob.combatTarget != null){ //chase player - if(!CombatUtilities.inRange2D(mob,mob.combatTarget,mob.getRange())) - MovementUtilities.aiMove(mob,mob.combatTarget.loc,false); + if(!CombatUtilities.inRange2D(mob,mob.combatTarget,mob.getRange())) { + MovementUtilities.aiMove(mob, mob.combatTarget.loc, false); + }else{ + mob.stopMovement(mob.getMovementLoc()); + } }else{ //patrol - if (mob.isMoving()) { - return; - } - Vector3fImmutable patrolPoint = Vector3fImmutable.getRandomPointOnCircle(mob.bindLoc,40f); - MovementUtilities.aiMove(mob,patrolPoint,true); + if (mob.isMoving()) + return; + Vector3fImmutable patrolPoint = Vector3fImmutable.getRandomPointOnCircle(mob.bindLoc, 40f); + MovementUtilities.aiMove(mob, patrolPoint, true); } } @@ -227,7 +230,7 @@ public class StandardMob { } } public static void MobCallForHelp(Mob mob){ - HashSet mobs = WorldGrid.getObjectsInRangePartial(mob.loc,20f, MBServerStatics.MASK_MOB); + HashSet mobs = WorldGrid.getObjectsInRangePartial(mob.loc,60f, MBServerStatics.MASK_MOB); for(AbstractWorldObject awo : mobs){ Mob responder = (Mob)awo; if(responder.combatTarget == null)