diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 5d01745c..46c276f2 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -278,12 +278,17 @@ public class MobAI { if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1) mob.lastPatrolPointIndex = 0; - mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex); + // Minions are given marching orders by the captain if he is alive - if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) - mob.destination = mob.destination.add(Formation.getOffset(2, mob.minions.indexOf(mob.getObjectUUID()) + 3)); - - mob.lastPatrolPointIndex += 1; + if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) && mob.guardCaptain.isAlive()) { + Mob captain = (Mob) mob.guardCaptain; + mob.destination = captain.destination.add(Formation.getOffset(2, mob.guardCaptain.minions.indexOf(mob.getObjectUUID()) + 3)); + ; + mob.lastPatrolPointIndex = captain.lastPatrolPointIndex; + } else { + mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex); + mob.lastPatrolPointIndex += 1; + } MovementUtilities.aiMove(mob, mob.destination, true); @@ -731,9 +736,8 @@ public class MobAI { if (mob.getCombatTarget() == null) { if (!mob.isMoving()) Patrol(mob); - else { + else mob.stopPatrolTime = System.currentTimeMillis(); - } } else { chaseTarget(mob); }