Browse Source

Mine Changes

lakebane-master
FatBoy-DOTC 9 months ago
parent
commit
9909216e27
  1. 71
      src/engine/objects/Mine.java

71
src/engine/objects/Mine.java

@ -342,26 +342,8 @@ public class Mine extends AbstractGameObject {
this.production = resource; this.production = resource;
this.hasProduced = true; this.hasProduced = true;
ItemBase resourceIB = ItemBase.getItemBase(this.production.UUID); ItemBase resourceIB = ItemBase.getItemBase(this.production.UUID);
int value = Warehouse.getCostForResource(this.production.UUID);
int amount = 0;
switch(this.capSize){
case 5:
amount = 3000000;
break;
case 10:
amount = 6000000;
break;
case 20:
amount = 9000000;
break;
}
if(this.production.UUID == 7)
amount *= 0.5f;
else
amount = amount / value;
return this.owningGuild.getOwnedCity().getWarehouse().depositFromMine(this, resourceIB, this.getModifiedProductionAmount());
return this.owningGuild.getOwnedCity().getWarehouse().depositFromMine(this, resourceIB, amount);
} }
public MineProduction getMineType() { public MineProduction getMineType() {
@ -581,41 +563,24 @@ public class Mine extends AbstractGameObject {
} }
public int getModifiedProductionAmount() { public int getModifiedProductionAmount() {
//TODO Calculate Distance modifications. int value = Warehouse.getCostForResource(this.production.UUID);
int amount = 0;
//calculate base values. switch(this.capSize){
int baseProduction = this.production.baseProduction; case 5:
float baseModValue = this.production.baseProduction * .1f; amount = 3000000;
float rankModValue = this.production.baseProduction * .0143f; break;
float totalModded = 0; case 10:
amount = 6000000;
//get Mine Building. break;
Building mineBuilding = BuildingManager.getBuilding(this.buildingID); case 20:
if (mineBuilding == null) amount = 9000000;
return this.production.baseProduction; break;
for (AbstractCharacter harvester : mineBuilding.getHirelings().keySet()) {
totalModded += baseModValue;
totalModded += rankModValue * harvester.getRank();
}
//add base production on top;
totalModded += baseProduction;
//skip distance check for expansion.
if (this.isExpansion())
return (int) totalModded;
if (this.owningGuild.isEmptyGuild() == false) {
if (this.owningGuild.getOwnedCity() != null) {
float distanceSquared = this.owningGuild.getOwnedCity().getLoc().distanceSquared2D(mineBuilding.getLoc());
if (distanceSquared > sqr(10000 * 3))
totalModded *= .25f;
else if (distanceSquared > sqr(10000 * 2))
totalModded *= .50f;
else if (distanceSquared > sqr(10000))
totalModded *= .75f;
}
} }
return (int) totalModded; if(this.production.UUID == 7)
amount *= 0.5f;
else
amount = amount / value;
return (int) amount;
} }
public void onEnter() { public void onEnter() {

Loading…
Cancel
Save