diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 62da3a9c..10c1b76d 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -63,12 +63,10 @@ public class Mob extends AbstractIntelligenceAgent { public float spawnRadius; //used by static mobs public int parentZoneUUID; - protected int dbID; //the database ID - - private int currentID; - //TODO implement feared object system public AbstractWorldObject fearedObject = null; + protected int dbID; //the database ID + private int currentID; private long lastAttackTime = 0; private int lastMobPowerToken = 0; private HashMap equip = null; @@ -314,13 +312,13 @@ public class Mob extends AbstractIntelligenceAgent { writer.put((byte) 1); - if ((PlayerCharacter) mob.guardCaptain != null) { + if (mob.guardCaptain != null) { - writer.putInt(((PlayerCharacter) mob.guardCaptain).getObjectType().ordinal()); + writer.putInt(mob.guardCaptain.getObjectType().ordinal()); - writer.putInt(((PlayerCharacter) mob.guardCaptain).getObjectUUID()); + writer.putInt(mob.guardCaptain.getObjectUUID()); } else { writer.putInt(0); //ownerType writer.putInt(0); //ownerID @@ -554,6 +552,7 @@ public class Mob extends AbstractIntelligenceAgent { return petMinion; } + public static Mob getMob(int id) { if (id == 0) @@ -696,7 +695,7 @@ public class Mob extends AbstractIntelligenceAgent { public Vector3fImmutable getBindLoc() { if (this.isPet() && !this.behaviourType.equals(MobBehaviourType.SiegeEngine)) - return (PlayerCharacter) this.guardCaptain != null ? ((PlayerCharacter) this.guardCaptain).getLoc() : this.getLoc(); + return this.guardCaptain != null ? this.guardCaptain.getLoc() : this.getLoc(); else return this.bindLoc; } @@ -1599,8 +1598,8 @@ public class Mob extends AbstractIntelligenceAgent { //TODO set these correctly later this.rangeHandOne = this.mobBase.getAttackRange(); this.rangeHandTwo = -1; - this.minDamageHandOne = (int)this.mobBase.getMinDmg(); - this.maxDamageHandOne = (int)this.mobBase.getMaxDmg(); + this.minDamageHandOne = (int) this.mobBase.getMinDmg(); + this.maxDamageHandOne = (int) this.mobBase.getMaxDmg(); this.minDamageHandTwo = 0; this.maxDamageHandTwo = 0; this.atrHandOne = this.mobBase.getAtr(); @@ -1665,28 +1664,23 @@ public class Mob extends AbstractIntelligenceAgent { this.enemy.addAll(this.getMobBase().enemy); } - try { - NPCManager.applyRuneSetEffects(this); - recalculateStats(); - this.setHealth(this.healthMax); + NPCManager.applyRuneSetEffects(this); + recalculateStats(); + this.setHealth(this.healthMax); - // Set bounds for this mobile + // Set bounds for this mobile - Bounds mobBounds = Bounds.borrow(); - mobBounds.setBounds(this.getLoc()); - this.setBounds(mobBounds); + Bounds mobBounds = Bounds.borrow(); + mobBounds.setBounds(this.getLoc()); + this.setBounds(mobBounds); - //assign 5 random patrol points for regular mobs + //assign 5 random patrol points for regular mobs - if (this.agentType.equals(AIAgentType.MOBILE)) { + if (this.agentType.equals(AIAgentType.MOBILE)) + NPCManager.AssignPatrolPoints(this); - NPCManager.AssignPatrolPoints(this); - } + this.deathTime = 0; - this.deathTime = 0; - } catch (Exception e) { - Logger.error(e.getMessage()); - } } @Override