Browse Source

R8 bonus application moved to City

combat-2
MagicBot 1 year ago
parent
commit
5858fa4de4
  1. 29
      src/engine/objects/Building.java
  2. 35
      src/engine/objects/City.java

29
src/engine/objects/Building.java

@ -994,34 +994,6 @@ public class Building extends AbstractWorldObject { @@ -994,34 +994,6 @@ public class Building extends AbstractWorldObject {
}
}
// Apply health bonus and special mesh for realm if applicable
if ((this.getCity() != null) && this.getCity().getTOL() != null && (this.getCity().getTOL().rank == 8)) {
// Update mesh accordingly
if (this.getBlueprint() != null && this.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)
this.meshUUID = Realm.getRealmMesh(this.getCity());
// Apply realm capital health bonus.
// Do not apply bonus to banestones or TOL's. *** Refactor:
// Possibly only protected buildings? Needs some thought.
float missingHealth = 0;
if (this.health.get() != 0)
missingHealth = this.healthMax - this.health.get();
if ((this.getBlueprint() != null && this.getBlueprint().getBuildingGroup() != BuildingGroup.TOL)
&& (this.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE)) {
this.healthMax += (this.healthMax * Realm.getRealmHealthMod(this.getCity()));
if (this.health.get() != 0)
this.health.set(this.healthMax - missingHealth);
if (this.health.get() > this.healthMax)
this.health.set(this.healthMax);
}
}
// Set bounds for this building
Bounds buildingBounds = Bounds.borrow();
@ -1043,6 +1015,7 @@ public class Building extends AbstractWorldObject { @@ -1043,6 +1015,7 @@ public class Building extends AbstractWorldObject {
//add furniture to region cache. floor and level are reversed in database, //TODO Fix
Regions region = BuildingManager.GetRegion(parent, this.level, this.floor, this.getLoc().x, this.getLoc().z);
if (region != null)
Regions.FurnitureRegionMap.put(this.getObjectUUID(), region);
}

35
src/engine/objects/City.java

@ -761,6 +761,41 @@ public class City extends AbstractWorldObject { @@ -761,6 +761,41 @@ public class City extends AbstractWorldObject {
}
}
// Apply health bonus and special mesh for realm if applicable
if (this.getTOL().rank == 8) {
// Update mesh accordingly
this.getTOL().meshUUID = Realm.getRealmMesh(this);
// Apply realm capital health bonus.
// Do not apply bonus to banestones or TOL's. *** Refactor:
// Possibly only protected buildings? Needs some thought.
float missingHealth = 0;
if (this.health.get() != 0)
missingHealth = this.healthMax - this.health.get();
for (Building building : this.parentZone.zoneBuildingSet) {
if (building.getBlueprint() != null &&
building.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE &&
building.getBlueprint().getBuildingGroup() != BuildingGroup.TOL) {
building.healthMax += (building.healthMax * Realm.getRealmHealthMod(this));
if (this.health.get() != 0)
this.health.set(this.healthMax - missingHealth);
if (this.health.get() > this.healthMax)
this.health.set(this.healthMax);
}
}
}
// Banes are loaded for this city from the database at this point
if (this.getBane() == null)

Loading…
Cancel
Save