From 967303d2de98c6a38ea8a0f952608b38f935aa17 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 9 Sep 2023 10:20:25 -0500 Subject: [PATCH] outlaw and hate value moved to modifyHealth --- src/engine/gameManager/CombatManager.java | 17 ----------------- src/engine/objects/AbstractCharacter.java | 12 +++++++++++- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 0fc0f776..bc998025 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -141,11 +141,6 @@ public enum CombatManager { if (off == null) CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second } - - City playerCity = ZoneManager.getCityAtLocation(playerCharacter.getLoc()); - - if (playerCity != null && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false) - playerCity.cityOutlaws.add(playerCharacter.getObjectUUID()); } public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException { @@ -825,12 +820,6 @@ public enum CombatManager { if (tarAc.isSit()) 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); - ((Mob) tarAc).handleDirectAggro(ac); - } - if (tarAc.getHealth() > 0) d = tarAc.modifyHealth(-damage, ac, false); @@ -1323,12 +1312,6 @@ public enum CombatManager { if (attackedMobile.guardCaptain.combatTarget == null) attackedMobile.guardCaptain.setCombatTarget(attacker); - // Add to city outlaw list - - if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && - attackedMobile.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false) - attackedMobile.guardedCity.cityOutlaws.add(attacker.getObjectUUID()); - } // Mobile already has a target; don't switch. diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 87ef3fff..15a6f987 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -1244,11 +1244,21 @@ public abstract class AbstractCharacter extends AbstractWorldObject { CombatManager.handleRetaliate(this, attacker); } + if(this.getObjectType().equals(GameObjectType.Mob)){ + //handle hate value addition + Mob target = (Mob)this; + if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) { + target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value); + if (target.isPlayerGuard()){ + if(target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false) + target.guardedCity.cityOutlaws.add(attacker.getObjectUUID()); + } + } + } return newHealth - oldHealth; } finally { this.healthLock.writeLock().unlock(); } - } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace();