forked from MagicBane/Server
Mine Changes
This commit is contained in:
@@ -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;
|
if(this.production.UUID == 7)
|
||||||
totalModded += baseProduction;
|
amount *= 0.5f;
|
||||||
//skip distance check for expansion.
|
else
|
||||||
if (this.isExpansion())
|
amount = amount / value;
|
||||||
return (int) totalModded;
|
return (int) amount;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
public void onEnter() {
|
public void onEnter() {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user