From a43d9022fe246471162b3ec06da52e897ca553a4 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 27 Aug 2023 22:57:11 -0400 Subject: [PATCH] Siege engine slot override. --- src/engine/gameManager/NPCManager.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 154d601a..24fb9d21 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -341,18 +341,21 @@ public enum NPCManager { if (abstractCharacter.building.getBlueprint() != null && abstractCharacter.building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL) && abstractCharacter.building.getRank() == 8) buildingSlot = BuildingManager.getLastAvailableSlot(abstractCharacter.building); - else { - if(abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob)abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) { - Mob mob = (Mob)abstractCharacter; - buildingSlot = mob.guardCaptain.siegeMinionMap.size() + 2; - }else - buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building); + else + buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building); + + // Override slot for siege engines + + if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) { + Mob siegeMobile = (Mob) abstractCharacter; + buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.size() + 2; } + if (buildingSlot == -1) Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID()); // Pets are regular mobiles not hirelings (Siege engines) - if(abstractCharacter.contract != null) + if (abstractCharacter.contract != null) abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot); // Override bind and location for this npc derived