* Add unit caps as a map setting.

* Use int and add maximum and minimum handling.

* Put a lower limit of 0 for unit cap
This commit is contained in:
TranquillyUnpleasant
2021-02-16 06:15:56 +05:00
committed by GitHub
parent 957583071d
commit 631e4d9eef
4 changed files with 18 additions and 1 deletions

View File

@@ -76,7 +76,7 @@ public class Units{
if((team == state.rules.waveTeam && !state.rules.pvp) || (state.isCampaign() && team == state.rules.waveTeam)){
return Integer.MAX_VALUE;
}
return state.rules.unitCap + indexer.getExtraUnits(team);
return Math.max(0, state.rules.unitCapVariable ? state.rules.unitCap + indexer.getExtraUnits(team) : state.rules.unitCap);
}
/** @return whether this player can interact with a specific tile. if either of these are null, returns true.*/