Display infinity symbol for "unlimited" unit cap

This commit is contained in:
Anuken
2021-11-01 12:27:00 -04:00
parent 779bab0344
commit 8cabae1d46
3 changed files with 8 additions and 2 deletions

View File

@@ -81,6 +81,12 @@ public class Units{
return Math.max(0, state.rules.unitCapVariable ? state.rules.unitCap + team.data().unitCap : state.rules.unitCap);
}
/** @return unit cap as a string, substituting the infinity symbol instead of MAX_VALUE */
public static String getStringCap(Team team){
int cap = getCap(team);
return cap >= Integer.MAX_VALUE - 1 ? "" : cap + "";
}
/** @return whether this player can interact with a specific tile. if either of these are null, returns true.*/
public static boolean canInteract(Player player, Building tile){
return player == null || tile == null || tile.interactable(player.team());

View File

@@ -78,7 +78,7 @@ public class UnitFactory extends UnitBlock{
Core.bundle.format("bar.unitcap",
Fonts.getUnicodeStr(e.unit().name),
e.team.data().countType(e.unit()),
Units.getCap(e.team)
Units.getStringCap(e.team)
),
() -> Pal.power,
() -> e.unit() == null ? 0f : (float)e.team.data().countType(e.unit()) / Units.getCap(e.team)