Browse Source

Class cleanup.

master
MagicBot 2 years ago
parent
commit
3cec1b4466
  1. 13
      src/engine/objects/Mine.java
  2. 8
      src/engine/powers/poweractions/ClaimMinePowerAction.java

13
src/engine/objects/Mine.java

@ -401,18 +401,17 @@ public class Mine extends AbstractGameObject { @@ -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 { @@ -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)

8
src/engine/powers/poweractions/ClaimMinePowerAction.java

@ -27,9 +27,9 @@ public class ClaimMinePowerAction extends AbstractPowerAction { @@ -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 { @@ -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;

Loading…
Cancel
Save