From 4fd737e3ecad20217167bbeb20c2bb83bf39f1ea Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 11 Feb 2024 22:47:22 -0600 Subject: [PATCH] mines to set random cap size at server boot 5/10/20 --- src/engine/objects/Mine.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 7a2a4b56..685a7601 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -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