|
|
|
@ -342,26 +342,8 @@ public class Mine extends AbstractGameObject {
@@ -342,26 +342,8 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
this.production = resource; |
|
|
|
|
this.hasProduced = true; |
|
|
|
|
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, amount); |
|
|
|
|
return this.owningGuild.getOwnedCity().getWarehouse().depositFromMine(this, resourceIB, this.getModifiedProductionAmount()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public MineProduction getMineType() { |
|
|
|
@ -581,41 +563,24 @@ public class Mine extends AbstractGameObject {
@@ -581,41 +563,24 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public int getModifiedProductionAmount() { |
|
|
|
|
//TODO Calculate Distance modifications.
|
|
|
|
|
|
|
|
|
|
//calculate base values.
|
|
|
|
|
int baseProduction = this.production.baseProduction; |
|
|
|
|
float baseModValue = this.production.baseProduction * .1f; |
|
|
|
|
float rankModValue = this.production.baseProduction * .0143f; |
|
|
|
|
float totalModded = 0; |
|
|
|
|
|
|
|
|
|
//get Mine Building.
|
|
|
|
|
Building mineBuilding = BuildingManager.getBuilding(this.buildingID); |
|
|
|
|
if (mineBuilding == null) |
|
|
|
|
return this.production.baseProduction; |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
return (int) totalModded; |
|
|
|
|
if(this.production.UUID == 7) |
|
|
|
|
amount *= 0.5f; |
|
|
|
|
else |
|
|
|
|
amount = amount / value; |
|
|
|
|
return (int) amount; |
|
|
|
|
} |
|
|
|
|
public void onEnter() { |
|
|
|
|
|
|
|
|
|