From bd9dbcbb42dc72854cfdf406a534d884a32c7636 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 13 Sep 2023 20:12:07 -0500 Subject: [PATCH] NPCs load rune sets --- src/engine/gameManager/NPCManager.java | 7 +++++++ src/engine/objects/AbstractCharacter.java | 2 +- src/engine/objects/NPC.java | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index bd5a4ce4..e53a0332 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -458,4 +458,11 @@ public enum NPCManager { mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank + mob.skills.get(entry.skill_type).getNumTrains())); } } + + public static void applyRunesForNPC(NPC npc){ + for(int runeID : _runeSetMap.get(npc.runeSetID)){ + RuneBase rb = RuneBase.getRuneBase(runeID); + npc.runes.add(new CharacterRune(rb,npc.getObjectUUID())); + } + } } diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 2574e3ad..31b77ca5 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -121,7 +121,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { public int hidden = 0; // current rank of hide/sneak/invis public CopyOnWriteArrayList minions = new CopyOnWriteArrayList(); - protected ArrayList runes; + public ArrayList runes; public AbstractCharacter() { super(); diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 88bb5a11..61eb24d5 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -972,6 +972,11 @@ public class NPC extends AbstractCharacter { Bounds npcBounds = Bounds.borrow(); npcBounds.setBounds(this.getLoc()); + //apply NPC rune effects + if(NPCManager._runeSetMap.containsKey(this.runeSetID)){ + NPCManager.applyRunesForNPC(this); + } + } catch (Exception e) { Logger.error(e.getMessage()); }