Browse Source

outlaw and hate value moved to modifyHealth

feature-workorder
FatBoy-DOTC 1 year ago
parent
commit
967303d2de
  1. 17
      src/engine/gameManager/CombatManager.java
  2. 12
      src/engine/objects/AbstractCharacter.java

17
src/engine/gameManager/CombatManager.java

@ -141,11 +141,6 @@ public enum CombatManager {
if (off == null) if (off == null)
CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second 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 { public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {
@ -825,12 +820,6 @@ public enum CombatManager {
if (tarAc.isSit()) if (tarAc.isSit())
damage *= 2.5f; //increase damage if sitting 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) if (tarAc.getHealth() > 0)
d = tarAc.modifyHealth(-damage, ac, false); d = tarAc.modifyHealth(-damage, ac, false);
@ -1323,12 +1312,6 @@ public enum CombatManager {
if (attackedMobile.guardCaptain.combatTarget == null) if (attackedMobile.guardCaptain.combatTarget == null)
attackedMobile.guardCaptain.setCombatTarget(attacker); 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. // Mobile already has a target; don't switch.

12
src/engine/objects/AbstractCharacter.java

@ -1244,11 +1244,21 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
CombatManager.handleRetaliate(this, attacker); 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; return newHealth - oldHealth;
} finally { } finally {
this.healthLock.writeLock().unlock(); this.healthLock.writeLock().unlock();
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();

Loading…
Cancel
Save