Browse Source

mines to set random cap size at server boot 5/10/20

lakebane-master
FatBoy-DOTC 11 months ago
parent
commit
4fd737e3ec
  1. 15
      src/engine/objects/Mine.java

15
src/engine/objects/Mine.java

@ -26,6 +26,7 @@ import java.sql.SQLException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
import static engine.gameManager.DbManager.MineQueries; import static engine.gameManager.DbManager.MineQueries;
import static engine.gameManager.DbManager.getObject; import static engine.gameManager.DbManager.getObject;
@ -51,6 +52,8 @@ public class Mine extends AbstractGameObject {
private int buildingID; private int buildingID;
private MineProduction mineType; private MineProduction mineType;
public int capSize;
/** /**
* ResultSet Constructor * ResultSet Constructor
*/ */
@ -91,6 +94,16 @@ public class Mine extends AbstractGameObject {
this.production = Resource.valueOf(rs.getString("mine_resource")); this.production = Resource.valueOf(rs.getString("mine_resource"));
this.lastClaimer = null; this.lastClaimer = null;
int capRoll = ThreadLocalRandom.current().nextInt(0,100);
if(capRoll >= 0 && capRoll <= 33){
this.capSize = 5;
}
if(capRoll >= 34 && capRoll <= 66){
this.capSize = 10;
}
if(capRoll >= 67 && capRoll <= 100){
this.capSize = 20;
}
} }
public static void releaseMineClaims(PlayerCharacter playerCharacter) { public static void releaseMineClaims(PlayerCharacter playerCharacter) {
@ -165,7 +178,7 @@ public class Mine extends AbstractGameObject {
writer.putInt(mine.getObjectUUID()); writer.putInt(mine.getObjectUUID());
writer.putInt(mine.getObjectUUID()); //actually a hash of mine writer.putInt(mine.getObjectUUID()); //actually a hash of mine
writer.putString(mine.mineType.name); writer.putString(mine.mineType.name);
writer.putString(mine.zoneName); writer.putString(mine.zoneName + " " + mine.capSize + " Man ");
writer.putInt(mine.production.hash); writer.putInt(mine.production.hash);
writer.putInt(mine.production.baseProduction); writer.putInt(mine.production.baseProduction);
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here

Loading…
Cancel
Save