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 {
playerGuild = playerCharacter.getGuild(); playerGuild = playerCharacter.getGuild();
// Can't claim something if you don't have a guild!
if (playerGuild.isEmptyGuild()) if (playerGuild.isEmptyGuild())
return false; return false;
if (playerGuild.getNation().isEmptyGuild()) if (playerGuild.getNation().isEmptyGuild())
return false; return false;
//Get a count of nation mines, can't go over capital tol rank. // Guild must own a city to hold a mine.
City nationCapitol = playerGuild.getNation().getOwnedCity();
City guildCity = playerGuild.getOwnedCity();
if (nationCapitol == null) City guildCity = playerGuild.getOwnedCity();
return false;
if (guildCity == null) if (guildCity == null)
return false; return false;
@ -422,6 +421,10 @@ public class Mine extends AbstractGameObject {
return false; return false;
} }
// Number of mines is based on the rank of the nation's tree.
City nationCapitol = playerGuild.getNation().getOwnedCity();
Building nationCapitolTOL = nationCapitol.getTOL(); Building nationCapitolTOL = nationCapitol.getTOL();
if (nationCapitolTOL == null) if (nationCapitolTOL == null)

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

@ -27,9 +27,9 @@ public class ClaimMinePowerAction extends AbstractPowerAction {
} }
@Override @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; return;
if (!(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))) if (!(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
@ -37,10 +37,10 @@ public class ClaimMinePowerAction extends AbstractPowerAction {
PlayerCharacter playerCharacter = (PlayerCharacter) source; PlayerCharacter playerCharacter = (PlayerCharacter) source;
if (!(awo.getObjectType().equals(Enum.GameObjectType.Building))) if (!(worldObject.getObjectType().equals(Enum.GameObjectType.Building)))
return; return;
Building mineBuilding = (Building)awo; Building mineBuilding = (Building)worldObject;
if (mineBuilding.getRank() > 0) if (mineBuilding.getRank() > 0)
return; return;

Loading…
Cancel
Save