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

This commit is contained in:
2024-02-11 22:47:22 -06:00
parent e891d353ba
commit 4fd737e3ec
+14 -1
View File
@@ -26,6 +26,7 @@ import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
import static engine.gameManager.DbManager.MineQueries;
import static engine.gameManager.DbManager.getObject;
@@ -51,6 +52,8 @@ public class Mine extends AbstractGameObject {
private int buildingID;
private MineProduction mineType;
public int capSize;
/**
* ResultSet Constructor
*/
@@ -91,6 +94,16 @@ public class Mine extends AbstractGameObject {
this.production = Resource.valueOf(rs.getString("mine_resource"));
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) {
@@ -165,7 +178,7 @@ public class Mine extends AbstractGameObject {
writer.putInt(mine.getObjectUUID());
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
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.baseProduction);
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here