From 58b427b977497c561d75e498c30cc3bd0a2d109d Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 2 Sep 2023 13:34:26 -0400 Subject: [PATCH] Contract support added to mobile ai when gathering powers. --- src/engine/mobileAI/MobAI.java | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 43a8b600..7b3c9ce1 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -323,13 +323,17 @@ public class MobAI { return false; } - if (PowersManager.getPowersForRune(mob.getMobBaseID()).isEmpty()) + // Mobile has no powers defined. + + if (PowersManager.getPowersForRune(mob.getMobBaseID()).isEmpty() && + PowersManager.getPowersForRune(mob.contractUUID).isEmpty()) return false; if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) { mob.setCombatTarget(null); return false; } + if (mob.nextCastTime == 0) mob.nextCastTime = System.currentTimeMillis(); @@ -360,6 +364,17 @@ public class MobAI { powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID())); purgeEntries = new ArrayList<>(); + // Fallback to contract is nothing in mobbase. This is to support player guards. + + if (powerEntries.isEmpty()) { + + if (mob.contract != null) + powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID)); + + if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) + powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID)); + } + // If player has this effect on them currently then remove // this token from our list. @@ -444,6 +459,17 @@ public class MobAI { powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID())); purgeEntries = new ArrayList<>(); + // Fallback to contract is nothing in mobbase. This is to support player guards. + + if (powerEntries.isEmpty()) { + + if (mob.contract != null) + powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID)); + + if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) + powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID)); + } + // If player has this effect on them currently then remove // this token from our list.