Browse Source

combat manager error tracking

lakebane-recovery
FatBoy-DOTC 5 days ago
parent
commit
956ff11574
  1. 35
      src/engine/gameManager/CombatManager.java

35
src/engine/gameManager/CombatManager.java

@ -1009,23 +1009,17 @@ public enum CombatManager {
//handle damage shields //handle damage shields
if (ac.isAlive() && tarAc != null && tarAc.isAlive()) if (ac.isAlive() && tarAc != null && tarAc.isAlive())
try {
handleDamageShields(ac, tarAc, damage); handleDamageShields(ac, tarAc, damage);
}catch(Exception e){
//handle mob hate values Logger.error(e.getMessage());
if(target.getObjectType().equals(GameObjectType.Mob) && ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
Mob mobTarget = (Mob)target;
if(mobTarget.hate_values.containsKey((PlayerCharacter) ac)){
mobTarget.hate_values.put((PlayerCharacter) ac,mobTarget.hate_values.get((PlayerCharacter) ac) + damage);
}else{
mobTarget.hate_values.put((PlayerCharacter) ac, damage);
}
} }
} else { } else {
// Apply Weapon power effect if any. // Apply Weapon power effect if any.
// don't try to apply twice if dual wielding. // don't try to apply twice if dual wielding.
try {
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) { if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
dpj = ((PlayerCharacter) ac).getWeaponPower(); dpj = ((PlayerCharacter) ac).getWeaponPower();
@ -1037,33 +1031,38 @@ public enum CombatManager {
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
float attackRange = getWeaponRange(wb, bonus); float attackRange = getWeaponRange(wb, bonus);
if(ac.isMoving()){ if (ac.isMoving()) {
attackRange += (ac.getSpeed() * 0.1f); attackRange += (ac.getSpeed() * 0.1f);
} }
if(AbstractWorldObject.IsAbstractCharacter(target)) { if (AbstractWorldObject.IsAbstractCharacter(target)) {
AbstractCharacter tarAc = (AbstractCharacter) target; AbstractCharacter tarAc = (AbstractCharacter) target;
if(tarAc != null && tarAc.isMoving()){ if (tarAc != null && tarAc.isMoving()) {
attackRange += (tarAc.getSpeed() * 0.1f); attackRange += (tarAc.getSpeed() * 0.1f);
} }
} }
if(specialCaseHitRoll(dpj.getPowerToken())) { if (specialCaseHitRoll(dpj.getPowerToken())) {
if(hitLanded) { if (hitLanded) {
dpj.attack(target, attackRange); dpj.attack(target, attackRange);
} }
}else{ } else {
dpj.attack(target, attackRange); dpj.attack(target, attackRange);
} }
} else } else
((PlayerCharacter) ac).setWeaponPower(null); ((PlayerCharacter) ac).setWeaponPower(null);
} }
} }
}catch(Exception e) {
Logger.error(e.getMessage());
}
try {
if (target.getObjectType() == GameObjectType.Mob) if (target.getObjectType() == GameObjectType.Mob)
((Mob) target).handleDirectAggro(ac); ((Mob) target).handleDirectAggro(ac);
}catch(Exception e){
Logger.error(e.getMessage());
}
errorTrack = 17; errorTrack = 17;
//miss, Send miss message //miss, Send miss message

Loading…
Cancel
Save