From ce542ce3199541055eee45a4d8920a612608efe1 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 28 Feb 2024 18:48:17 -0600 Subject: [PATCH] combat problem chasing --- src/engine/gameManager/CombatManager.java | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 17537800..e37ca1c5 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -821,25 +821,25 @@ public enum CombatManager { //Subtract Damage from target's health if (tarAc != null) { + if (tarAc.isSit()) + damage *= 2.5f; //increase damage if sitting + + if (tarAc.getObjectType() == GameObjectType.Mob) { + Mob mobTarget = (Mob) tarAc; + if (ac.getObjectType().equals(GameObjectType.PlayerCharacter)) { + if (mobTarget.playerAgroMap.containsKey(ac.getObjectUUID())) { + float hateValue = damage + mobTarget.playerAgroMap.get(ac.getObjectUUID()); + mobTarget.playerAgroMap.put(ac.getObjectUUID(), hateValue); + } else { + mobTarget.playerAgroMap.put(ac.getObjectUUID(), damage); + } - if (tarAc.isSit()) - damage *= 2.5f; //increase damage if sitting - - if (tarAc.getObjectType() == GameObjectType.Mob) { - if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)) { - if(((Mob) tarAc).playerAgroMap.containsKey(ac.getObjectUUID())) { - ((Mob) tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage); - } else{ - ((Mob) tarAc).playerAgroMap.put(ac.getObjectUUID(), damage); } - + mobTarget.handleDirectAggro(ac); } - ((Mob) tarAc).handleDirectAggro(ac); - } - - if (tarAc.getHealth() > 0) - d = tarAc.modifyHealth(-damage, ac, false); + if (tarAc.getHealth() > 0) + d = tarAc.modifyHealth(-damage, ac, false); } else if (target.getObjectType().equals(GameObjectType.Building)) { if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) { @@ -950,7 +950,7 @@ public enum CombatManager { } catch (Exception e) { Logger.error(ac.getName() + ' ' + errorTrack + ' ' + e); - e.printStackTrace(); + Logger.error(e.getMessage()); } }