From 3ec16d04d62f02f6c0ba35589c9db43b1011ce6a Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 20 Jan 2023 12:18:11 -0500 Subject: [PATCH] Prior claims are released upon a new claim. --- src/engine/objects/Mine.java | 13 +++++++++++-- .../powers/poweractions/ClaimMinePowerAction.java | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 8b54170e..b2892410 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -128,6 +128,17 @@ public class Mine extends AbstractGameObject { } + public static void releaseMineClaims(PlayerCharacter playerCharacter) { + + for (Mine mine : Mine.getMines()) { + + if (mine.lastClaimer.equals(playerCharacter)) { + mine.lastClaimer = null; + mine.updateGuildOwner(null); + } + + } + } public static void SendMineAttackMessage(Building mine) { if (mine.getBlueprint() == null) @@ -561,7 +572,6 @@ public class Mine extends AbstractGameObject { return true; } - public boolean depositMineResources() { if (this.owningGuild.isErrant()) @@ -664,7 +674,6 @@ public class Mine extends AbstractGameObject { } } return (int) totalModded; - } } diff --git a/src/engine/powers/poweractions/ClaimMinePowerAction.java b/src/engine/powers/poweractions/ClaimMinePowerAction.java index c0aad48d..1189cb7e 100644 --- a/src/engine/powers/poweractions/ClaimMinePowerAction.java +++ b/src/engine/powers/poweractions/ClaimMinePowerAction.java @@ -50,6 +50,10 @@ public class ClaimMinePowerAction extends AbstractPowerAction { if (mine == null) return; + // Release prior claims + + Mine.releaseMineClaims(playerCharacter); + if (mine.claimMine(playerCharacter) == true) ChatManager.sendSystemMessage( (PlayerCharacter) source, "You successfully claimed this mine.."); }