diff --git a/src/engine/objects/Building.java b/src/engine/objects/Building.java index 7ccfbb42..ba135dbd 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -166,6 +166,13 @@ public class Building extends AbstractWorldObject { if (this.blueprintUUID != 0) this.meshUUID = blueprint.getMeshForRank(rank); + this.healthMax = blueprint.getMaxHealth(this.rank); + + } else { + this.healthMax = 100000; // Structures with no blueprint mesh + this.setHealth(healthMax); + } + if(this.getBlueprint() != null && this.getBlueprint().getBuildingGroup() != null && this.getBlueprint().isWallPiece()){ City cityObject = ZoneManager.getCityAtLocation(this.loc); if(cityObject.getTOL().getRank() == 8) { @@ -173,12 +180,9 @@ public class Building extends AbstractWorldObject { float newMax = this.healthMax * 1.1f; this.setMaxHitPoints(newMax); this.setHealth(this.healthMax * currentHealthRatio); - }else { - this.healthMax = blueprint.getMaxHealth(this.rank); } - } else { - this.healthMax = blueprint.getMaxHealth(this.rank); } + // If this object has no blueprint but is a blueprint // mesh then set it's current health to max health @@ -188,10 +192,6 @@ public class Building extends AbstractWorldObject { if (blueprint.getBuildingGroup().equals(BuildingGroup.BARRACK)) this.patrolPoints = DbManager.BuildingQueries.LOAD_PATROL_POINTS(this); - } else { - this.healthMax = 100000; // Structures with no blueprint mesh - this.setHealth(healthMax); - } if(!this.ownerIsNPC){ //add extra HP for city walls of R8 trees