6 changed files with 1547 additions and 1 deletions
			
			
		| @ -0,0 +1,33 @@@@ -0,0 +1,33 @@ | ||||
| package engine.mobileAI.MobBehaviours; | ||||
| 
 | ||||
| import engine.gameManager.ZoneManager; | ||||
| import engine.mobileAI.utilities.MovementUtilities; | ||||
| import engine.objects.Mob; | ||||
| import org.pmw.tinylog.Logger; | ||||
| 
 | ||||
| public class Pet { | ||||
| 
 | ||||
|     public static void run(Mob pet){ | ||||
| 
 | ||||
|         try { | ||||
| 
 | ||||
|             if(StaticBehaviours.EarlyExit(pet)) | ||||
|                 return; | ||||
| 
 | ||||
|             if (pet.getOwner() == null && pet.isNecroPet() == false && pet.isSiege() == false) | ||||
|                 if (ZoneManager.getSeaFloor().zoneMobSet.contains(pet)) | ||||
|                     pet.killCharacter("no owner"); | ||||
| 
 | ||||
|             if(!pet.isSiege()) | ||||
|                 pet.BehaviourType.canRoam = true; | ||||
| 
 | ||||
| 
 | ||||
|             if (MovementUtilities.canMove(pet) && pet.BehaviourType.canRoam) | ||||
|                 StaticBehaviours.CheckMobMovement(pet); | ||||
| 
 | ||||
|             StaticBehaviours.CheckForAttack(pet); | ||||
|         } catch (Exception e) { | ||||
|             Logger.info(pet.getObjectUUID() + " " + pet.getName() + " Failed At: PetLogic" + " " + e.getMessage()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,146 @@@@ -0,0 +1,146 @@ | ||||
| package engine.mobileAI.MobBehaviours; | ||||
| 
 | ||||
| import engine.Enum; | ||||
| import engine.objects.AbstractWorldObject; | ||||
| import engine.objects.Mob; | ||||
| import engine.objects.PlayerCharacter; | ||||
| import org.pmw.tinylog.Logger; | ||||
| 
 | ||||
| public class PlayerGuard { | ||||
| 
 | ||||
|     public static void run(Mob guard) { | ||||
| 
 | ||||
|         if(StaticBehaviours.EarlyExit(guard)) | ||||
|             return; | ||||
| 
 | ||||
|         if (guard.mobPowers.isEmpty()) { | ||||
|             //mele
 | ||||
|             if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardWallArcher)) { | ||||
|                 GuardWallArcherLogic(guard); | ||||
|             } else { | ||||
|                 if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) { | ||||
|                     GuardCaptainLogic(guard); | ||||
|                 } else if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion)) { | ||||
|                     GuardMinionLogic(guard); | ||||
|                 } | ||||
|             } | ||||
|         } else { | ||||
|             //caster
 | ||||
|             if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) { | ||||
|                 MagisterCaptainLogic(guard); | ||||
|             } else if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion)) { | ||||
|                 MagisterMinionLogic(guard); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void GuardCaptainLogic(Mob mob) { | ||||
| 
 | ||||
|         try { | ||||
|             StaticBehaviours.checkToDropGuardAggro(mob); | ||||
|             if (mob.getCombatTarget() == null) | ||||
|                 StaticBehaviours.CheckForPlayerGuardAggro(mob); | ||||
| 
 | ||||
|             AbstractWorldObject newTarget = StaticBehaviours.ChangeTargetFromHateValue(mob); | ||||
| 
 | ||||
|             if (newTarget != null) { | ||||
| 
 | ||||
|                 if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { | ||||
|                     if (StaticBehaviours.GuardCanAggro(mob, (PlayerCharacter) newTarget)) | ||||
|                         mob.setCombatTarget(newTarget); | ||||
|                 } else | ||||
|                     mob.setCombatTarget(newTarget); | ||||
| 
 | ||||
|             } | ||||
|             StaticBehaviours.CheckMobMovement(mob); | ||||
|             StaticBehaviours.CheckForAttack(mob); | ||||
|         } catch (Exception e) { | ||||
|             Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void GuardMinionLogic(Mob mob) { | ||||
| 
 | ||||
|         try { | ||||
|             StaticBehaviours.checkToDropGuardAggro(mob); | ||||
| 
 | ||||
|             boolean isComanded = mob.npcOwner.isAlive(); | ||||
|             if (!isComanded) { | ||||
|                 GuardCaptainLogic(mob); | ||||
|             }else { | ||||
|                 if (mob.npcOwner.getCombatTarget() != null) | ||||
|                     mob.setCombatTarget(mob.npcOwner.getCombatTarget()); | ||||
|                 else | ||||
|                 if (mob.getCombatTarget() != null) | ||||
|                     mob.setCombatTarget(null); | ||||
|             } | ||||
|             StaticBehaviours.CheckMobMovement(mob); | ||||
|             StaticBehaviours.CheckForAttack(mob); | ||||
|         } catch (Exception e) { | ||||
|             Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void GuardWallArcherLogic(Mob mob) { | ||||
| 
 | ||||
|         try { | ||||
|             StaticBehaviours.checkToDropGuardAggro(mob); | ||||
| 
 | ||||
|             if (mob.getCombatTarget() == null) | ||||
|                 StaticBehaviours.CheckForPlayerGuardAggro(mob); | ||||
|             else | ||||
|                 StaticBehaviours.CheckForAttack(mob); | ||||
|         } catch (Exception e) { | ||||
|             Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardWallArcherLogic" + " " + e.getMessage()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void MagisterCaptainLogic(Mob mob){ | ||||
|         try { | ||||
|             StaticBehaviours.checkToDropGuardAggro(mob); | ||||
|             if (mob.getCombatTarget() == null) | ||||
|                 StaticBehaviours.CheckForPlayerGuardAggro(mob); | ||||
| 
 | ||||
|             AbstractWorldObject newTarget = StaticBehaviours.ChangeTargetFromHateValue(mob); | ||||
| 
 | ||||
|             if (newTarget != null) { | ||||
| 
 | ||||
|                 if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { | ||||
|                     if (StaticBehaviours.GuardCanAggro(mob, (PlayerCharacter) newTarget)) | ||||
|                         mob.setCombatTarget(newTarget); | ||||
|                 } else | ||||
|                     mob.setCombatTarget(newTarget); | ||||
| 
 | ||||
|             } | ||||
|             StaticBehaviours.CheckMobMovement(mob); | ||||
|             CheckForCast(mob); | ||||
|         } catch (Exception e) { | ||||
|             Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void MagisterMinionLogic(Mob mob){ | ||||
|         try { | ||||
|             StaticBehaviours.checkToDropGuardAggro(mob); | ||||
| 
 | ||||
|             boolean isComanded = mob.npcOwner.isAlive(); | ||||
|             if (!isComanded) { | ||||
|                 MagisterCaptainLogic(mob); | ||||
|             }else { | ||||
|                 if (mob.npcOwner.getCombatTarget() != null) | ||||
|                     mob.setCombatTarget(mob.npcOwner.getCombatTarget()); | ||||
|                 else | ||||
|                 if (mob.getCombatTarget() != null) | ||||
|                     mob.setCombatTarget(null); | ||||
|             } | ||||
|             StaticBehaviours.CheckMobMovement(mob); | ||||
|             CheckForCast(mob); | ||||
|         } catch (Exception e) { | ||||
|             Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void CheckForCast(Mob mob){ | ||||
| 
 | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,27 @@@@ -0,0 +1,27 @@ | ||||
| package engine.mobileAI.MobBehaviours; | ||||
| 
 | ||||
| import engine.Enum; | ||||
| import engine.objects.Mob; | ||||
| 
 | ||||
| public class SiegeEngine { | ||||
| 
 | ||||
|     public static void run(Mob engine){ | ||||
| 
 | ||||
|         if(StaticBehaviours.EarlyExit(engine)) | ||||
|             return; | ||||
| 
 | ||||
|         if(engine.getOwner() == null) | ||||
|             return; | ||||
| 
 | ||||
|         if(engine.combatTarget == null) | ||||
|             return; | ||||
| 
 | ||||
|         if(engine.combatTarget.loc.distanceSquared(engine.loc) > engine.getRange() * engine.getRange()) | ||||
|             return; | ||||
| 
 | ||||
|         if(!engine.combatTarget.getObjectType().equals(Enum.GameObjectType.Building)) | ||||
|             return; | ||||
| 
 | ||||
|         StaticBehaviours.CheckForAttack(engine); | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,53 @@@@ -0,0 +1,53 @@ | ||||
| package engine.mobileAI.MobBehaviours; | ||||
| 
 | ||||
| import engine.Enum; | ||||
| import engine.objects.AbstractWorldObject; | ||||
| import engine.objects.Mob; | ||||
| import org.pmw.tinylog.Logger; | ||||
| 
 | ||||
| public class Standard { | ||||
| 
 | ||||
|     public static void run(Mob mob){ | ||||
| 
 | ||||
|         try { | ||||
| 
 | ||||
|             if(StaticBehaviours.EarlyExit(mob)) | ||||
|                 return; | ||||
| 
 | ||||
|             //check for players that can be aggroed if mob is agressive and has no target
 | ||||
| 
 | ||||
|             if (mob.getCombatTarget() != null && !mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID())) | ||||
|                 mob.setCombatTarget(null); | ||||
| 
 | ||||
|             if (mob.BehaviourType.isAgressive) { | ||||
| 
 | ||||
|                 AbstractWorldObject newTarget = StaticBehaviours.ChangeTargetFromHateValue(mob); | ||||
| 
 | ||||
|                 if (newTarget != null) | ||||
|                     mob.setCombatTarget(newTarget); | ||||
|                 else { | ||||
|                     if (mob.getCombatTarget() == null) { | ||||
|                         if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard) | ||||
|                             StaticBehaviours.SafeGuardAggro(mob);  //safehold guard
 | ||||
|                         else | ||||
|                             StaticBehaviours.CheckForAggro(mob);   //normal aggro
 | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             //check if mob can move for patrol or moving to target
 | ||||
| 
 | ||||
|             if (mob.BehaviourType.canRoam) | ||||
|                 StaticBehaviours.CheckMobMovement(mob); | ||||
| 
 | ||||
|             //check if mob can attack if it isn't wimpy
 | ||||
| 
 | ||||
|             if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null) | ||||
|                 StaticBehaviours.CheckForAttack(mob); | ||||
| 
 | ||||
| 
 | ||||
|         } catch (Exception e) { | ||||
|             Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DefaultLogic" + " " + e.getMessage()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
									
										
											File diff suppressed because it is too large
											Load Diff
										
									
								
							
						
					Loading…
					
					
				
		Reference in new issue