From 5159afc70474e179fd7ee55e56e271ccec4e69de Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 24 Feb 2024 12:28:46 -0600 Subject: [PATCH] bugfix: null combat target --- src/engine/gameManager/CombatManager.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 47c50945..3462a92f 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -829,8 +829,14 @@ public enum CombatManager { damage *= 2.5f; //increase damage if sitting if (tarAc.getObjectType() == GameObjectType.Mob) { - if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)) - ((Mob)tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage); + if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)) { + if(((Mob) tarAc).playerAgroMap.contains(ac.getObjectUUID())) { + ((Mob) tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage); + } else{ + ((Mob) tarAc).playerAgroMap.put(ac.getObjectUUID(), damage); + } + + } ((Mob) tarAc).handleDirectAggro(ac); }