Prototype unit cap mechanic

This commit is contained in:
Anuken
2020-05-12 21:34:27 -04:00
parent 2990013b8e
commit 6a22d45320
13 changed files with 84 additions and 145 deletions

View File

@@ -15,6 +15,15 @@ public class Units{
private static float cdist;
private static boolean boolResult;
/** @return whether a new instance of a unit of this team can be created. */
public static boolean canCreate(Team team){
return teamIndex.count(team) < getCap(team);
}
public static int getCap(Team team){
return state.rules.unitCap + indexer.getExtraUnits(team);
}
/** @return whether this player can interact with a specific tile. if either of these are null, returns true.*/
public static boolean canInteract(Playerc player, Tilec tile){
return player == null || tile == null || tile.interactable(player.team());