From 3cec1b44668eb62da52273208d7cde87cc00b999 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 21 Jan 2023 09:39:53 -0500 Subject: [PATCH] Class cleanup. --- src/engine/objects/Mine.java | 13 ++++++++----- .../powers/poweractions/ClaimMinePowerAction.java | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 26b54f28..ec26a50d 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -401,18 +401,17 @@ public class Mine extends AbstractGameObject { playerGuild = playerCharacter.getGuild(); + // Can't claim something if you don't have a guild! + if (playerGuild.isEmptyGuild()) return false; if (playerGuild.getNation().isEmptyGuild()) return false; - //Get a count of nation mines, can't go over capital tol rank. - City nationCapitol = playerGuild.getNation().getOwnedCity(); - City guildCity = playerGuild.getOwnedCity(); + // Guild must own a city to hold a mine. - if (nationCapitol == null) - return false; + City guildCity = playerGuild.getOwnedCity(); if (guildCity == null) return false; @@ -422,6 +421,10 @@ public class Mine extends AbstractGameObject { return false; } + // Number of mines is based on the rank of the nation's tree. + + City nationCapitol = playerGuild.getNation().getOwnedCity(); + Building nationCapitolTOL = nationCapitol.getTOL(); if (nationCapitolTOL == null) diff --git a/src/engine/powers/poweractions/ClaimMinePowerAction.java b/src/engine/powers/poweractions/ClaimMinePowerAction.java index 1189cb7e..20929f6e 100644 --- a/src/engine/powers/poweractions/ClaimMinePowerAction.java +++ b/src/engine/powers/poweractions/ClaimMinePowerAction.java @@ -27,9 +27,9 @@ public class ClaimMinePowerAction extends AbstractPowerAction { } @Override - protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) { + protected void _startAction(AbstractCharacter source, AbstractWorldObject worldObject, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) { - if (source == null || awo == null) + if (source == null || worldObject == null) return; if (!(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))) @@ -37,10 +37,10 @@ public class ClaimMinePowerAction extends AbstractPowerAction { PlayerCharacter playerCharacter = (PlayerCharacter) source; - if (!(awo.getObjectType().equals(Enum.GameObjectType.Building))) + if (!(worldObject.getObjectType().equals(Enum.GameObjectType.Building))) return; - Building mineBuilding = (Building)awo; + Building mineBuilding = (Building)worldObject; if (mineBuilding.getRank() > 0) return;