|  |  | @ -7,6 +7,7 @@ import engine.gameManager.PowersManager; | 
			
		
	
		
		
			
				
					
					|  |  |  | import engine.gameManager.ZoneManager; |  |  |  | import engine.gameManager.ZoneManager; | 
			
		
	
		
		
			
				
					
					|  |  |  | import engine.math.Vector3f; |  |  |  | import engine.math.Vector3f; | 
			
		
	
		
		
			
				
					
					|  |  |  | import engine.math.Vector3fImmutable; |  |  |  | import engine.math.Vector3fImmutable; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import engine.mobileAI.MobAI; | 
			
		
	
		
		
			
				
					
					|  |  |  | import engine.mobileAI.Threads.MobAIThread; |  |  |  | import engine.mobileAI.Threads.MobAIThread; | 
			
		
	
		
		
			
				
					
					|  |  |  | import engine.mobileAI.utilities.CombatUtilities; |  |  |  | import engine.mobileAI.utilities.CombatUtilities; | 
			
		
	
		
		
			
				
					
					|  |  |  | import engine.mobileAI.utilities.MovementUtilities; |  |  |  | import engine.mobileAI.utilities.MovementUtilities; | 
			
		
	
	
		
		
			
				
					|  |  | @ -32,7 +33,6 @@ public class MobHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(mob.combatTarget == null || !mob.combatTarget.isAlive()){ |  |  |  |         if(mob.combatTarget == null || !mob.combatTarget.isAlive()){ | 
			
		
	
		
		
			
				
					
					|  |  |  |             CheckForAggro(mob); |  |  |  |             CheckForAggro(mob); | 
			
		
	
		
		
			
				
					
					|  |  |  |             return; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(mob.combatTarget != null) |  |  |  |         if(mob.combatTarget != null) | 
			
		
	
		
		
			
				
					
					|  |  |  |             CheckToDropAggro(mob); |  |  |  |             CheckToDropAggro(mob); | 
			
		
	
	
		
		
			
				
					|  |  | @ -45,7 +45,7 @@ public class MobHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static void CheckToDropAggro(Mob mob){ |  |  |  |     public static void CheckToDropAggro(Mob mob){ | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(mob.loc.distanceSquared(mob.combatTarget.loc) > (64f * 64f)) |  |  |  |         if(mob.loc.distanceSquared(mob.combatTarget.loc) > (128f * 128f)) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             mob.setCombatTarget(null); |  |  |  |             mob.setCombatTarget(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -100,6 +100,12 @@ public class MobHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static void CheckForAggro(Mob mob){ |  |  |  |     public static void CheckForAggro(Mob mob){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         switch(mob.BehaviourType){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case SimpleStandingGuard: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case Simple: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case None: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         PlayerCharacter tar = null; |  |  |  |         PlayerCharacter tar = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |         for(int id : mob.playerAgroMap.keySet()){ |  |  |  |         for(int id : mob.playerAgroMap.keySet()){ | 
			
		
	
		
		
			
				
					
					|  |  |  |             PlayerCharacter target = PlayerCharacter.getFromCache(id); |  |  |  |             PlayerCharacter target = PlayerCharacter.getFromCache(id); | 
			
		
	
	
		
		
			
				
					|  |  | @ -107,6 +113,8 @@ public class MobHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if(MobCanAggro(mob,target)) |  |  |  |                 if(MobCanAggro(mob,target)) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     tar = target; |  |  |  |                     tar = target; | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if(tar != null) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             mob.setCombatTarget(tar); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static Boolean MobCanAggro(Mob mob, PlayerCharacter loadedPlayer){ |  |  |  |     public static Boolean MobCanAggro(Mob mob, PlayerCharacter loadedPlayer){ | 
			
		
	
	
		
		
			
				
					|  |  | @ -136,21 +144,27 @@ public class MobHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(!mob.isAlive()) |  |  |  |         if(!mob.isAlive()) | 
			
		
	
		
		
			
				
					
					|  |  |  |             return; |  |  |  |             return; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         mob.updateLocation(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(mob.combatTarget == null){ |  |  |  |         if(mob.combatTarget == null){ | 
			
		
	
		
		
			
				
					
					|  |  |  |             //patrol
 |  |  |  |             //patrol
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             Patrol(mob); |  |  |  |             Patrol(mob); | 
			
		
	
		
		
			
				
					
					|  |  |  |         }else{ |  |  |  |         }else{ | 
			
		
	
		
		
			
				
					
					|  |  |  |             //combat movement
 |  |  |  |             //combat movement
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(CombatUtilities.inRangeToAttack(mob,mob.combatTarget)) |  |  |  |             if(CombatUtilities.inRangeToAttack(mob,mob.combatTarget)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 return; |  |  |  |                 return; | 
			
		
	
		
		
			
				
					
					|  |  |  |             else |  |  |  |             }else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 MovementUtilities.aiMove(mob,mob.combatTarget.loc,false); |  |  |  |                 MovementUtilities.moveToLocation(mob, mob.combatTarget.loc, mob.getRange()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static void CheckToAttack(Mob mob){ |  |  |  |     public static void CheckToAttack(Mob mob){ | 
			
		
	
		
		
			
				
					
					|  |  |  |         try { |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if(mob.getLastAttackTime() > System.currentTimeMillis()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             PlayerCharacter target = (PlayerCharacter) mob.combatTarget; |  |  |  |             PlayerCharacter target = (PlayerCharacter) mob.combatTarget; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (!mob.canSee(target)) { |  |  |  |             if (!mob.canSee(target)) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -158,7 +172,7 @@ public class MobHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 return; |  |  |  |                 return; | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mob.BehaviourType.callsForHelp) |  |  |  |             //if (mob.BehaviourType.callsForHelp)
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             MobCallForHelp(mob); |  |  |  |             MobCallForHelp(mob); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mob.isMoving() && mob.getRange() > 20) |  |  |  |             if (mob.isMoving() && mob.getRange() > 20) | 
			
		
	
	
		
		
			
				
					|  |  | @ -196,32 +210,17 @@ public class MobHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static void MobCallForHelp(Mob mob) { |  |  |  |     public static void MobCallForHelp(Mob mob) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         try { |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             boolean callGotResponse = false; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mob.nextCallForHelp == 0) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mob.nextCallForHelp = System.currentTimeMillis(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mob.nextCallForHelp < System.currentTimeMillis()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 return; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             //mob sends call for help message
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             ChatManager.chatSayInfo(null, mob.getName() + " calls for help!"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             Zone mobCamp = mob.getParentZone(); |  |  |  |             Zone mobCamp = mob.getParentZone(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (Mob helper : mobCamp.zoneMobSet) { |  |  |  |             for (Mob helper : mobCamp.zoneMobSet) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (helper.BehaviourType.respondsToCallForHelp && helper.BehaviourType.BehaviourHelperType.equals(mob.BehaviourType)) { |  |  |  |                 if(helper.equals(mob)) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     helper.setCombatTarget(mob.getCombatTarget()); |  |  |  |                     continue; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     callGotResponse = true; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             //wait 60 seconds to call for help again
 |  |  |  |                 if(helper.combatTarget != null) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     continue; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (callGotResponse) |  |  |  |                     helper.setCombatTarget(mob.getCombatTarget()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 mob.nextCallForHelp = System.currentTimeMillis() + 60000; |  |  |  |             } | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } catch (Exception e) { |  |  |  |         } catch (Exception e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             //(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCallForHelp" + " " + e.getMessage());
 |  |  |  |             //(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCallForHelp" + " " + e.getMessage());
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -232,6 +231,8 @@ public class MobHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         try { |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if(mob.isMoving()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return; | 
			
		
	
		
		
			
				
					
					|  |  |  |             //make sure mob is out of combat stance
 |  |  |  |             //make sure mob is out of combat stance
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             int patrolDelay = ThreadLocalRandom.current().nextInt((int) (MobAIThread.AI_PATROL_DIVISOR * 0.5f), MobAIThread.AI_PATROL_DIVISOR) + MobAIThread.AI_PATROL_DIVISOR; |  |  |  |             int patrolDelay = ThreadLocalRandom.current().nextInt((int) (MobAIThread.AI_PATROL_DIVISOR * 0.5f), MobAIThread.AI_PATROL_DIVISOR) + MobAIThread.AI_PATROL_DIVISOR; | 
			
		
	
	
		
		
			
				
					|  |  | @ -275,4 +276,5 @@ public class MobHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |             //(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
 |  |  |  |             //(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |