From 553010bb7b7422235034a999c17f493771fce1bd Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 7 Sep 2023 12:07:39 -0400 Subject: [PATCH] Minions get marching orders from captain --- src/engine/mobileAI/MobAI.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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); }