From 3f416f83d3860f989694702efc59aca5d3acbd76 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 9 Sep 2023 09:11:43 -0400 Subject: [PATCH] Patrol points only set once. --- src/engine/mobileAI/MobAI.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index e5945f49..a5072fc0 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -266,17 +266,18 @@ public class MobAI { //guards inherit barracks patrol points dynamically - if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) { + if (mob.patrolPoints == null || mob.patrolPoints.isEmpty()) + if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) { - Building barracks = mob.building; + Building barracks = mob.building; - if (barracks != null && barracks.patrolPoints != null && !barracks.getPatrolPoints().isEmpty()) { - mob.patrolPoints = barracks.patrolPoints; - } else { - randomGuardPatrolPoint(mob); - return; + if (barracks != null && barracks.patrolPoints != null && !barracks.getPatrolPoints().isEmpty()) { + mob.patrolPoints = barracks.patrolPoints; + } else { + randomGuardPatrolPoint(mob); + return; + } } - } if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1) mob.lastPatrolPointIndex = 0;