From 80d0948e2471b3c5d85d8ef29573d5550801161c Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 2 Sep 2023 14:04:47 -0400 Subject: [PATCH] Contract power handling now additive. --- src/engine/mobileAI/MobAI.java | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 7b3c9ce1..4123c536 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -364,15 +364,21 @@ 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. + // Additional powers may come from the contract ID. This is to support + // powers for player guards irrespective of the mobbase used. - if (powerEntries.isEmpty()) { + if (mob.isPlayerGuard()) { + + ArrayList contractEntries = new ArrayList<>(); if (mob.contract != null) - powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID)); + contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID)); if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) - powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID)); + contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID)); + + powerEntries.addAll(contractEntries); + } // If player has this effect on them currently then remove @@ -459,15 +465,21 @@ 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. + // Additional powers may come from the contract ID. This is to support + // powers for player guards irrespective of the mobbase used. - if (powerEntries.isEmpty()) { + if (mob.isPlayerGuard()) { + + ArrayList contractEntries = new ArrayList<>(); if (mob.contract != null) - powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID)); + contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID)); if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) - powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID)); + contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID)); + + powerEntries.addAll(contractEntries); + } // If player has this effect on them currently then remove