Add owned tiles countable (#12423)

* Added owned tiles countable

* Applied yairm210's suggestions

* Added template.properties key
This commit is contained in:
PLynx 2024-11-10 13:25:48 +01:00 committed by GitHub
parent c1e52d9073
commit bdcc0bb0d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 0 deletions

View File

@ -1973,6 +1973,7 @@ Gain a free [building] [cityFilter] =
# Countables
Remaining [civFilter] Civilizations =
Owned [tileFilter] Tiles =
# Unused Resources

View File

@ -36,6 +36,9 @@ object Countables {
if (countable.equalsPlaceholderText("Remaining [] Civilizations"))
return gameInfo.civilizations.filter { !it.isDefeated() }
.count { it.matchesFilter(placeholderParameters[0]) }
if (countable.equalsPlaceholderText("Owned [] Tiles"))
return civInfo.cities.sumOf { it.getTiles().count { it.matchesFilter(placeholderParameters[0]) } }
if (gameInfo.ruleset.tileResources.containsKey(countable))
return stateForConditionals.getResourceAmount(countable)

View File

@ -76,6 +76,7 @@ enum class UniqueParameterType(
parameterText.equalsPlaceholderText("[] Cities") -> true
parameterText.equalsPlaceholderText("[] Units") -> true
parameterText.equalsPlaceholderText("Remaining [] Civilizations") -> true
parameterText.equalsPlaceholderText("Owned [] Tiles") -> true
else -> super.isKnownValue(parameterText, ruleset)
}

View File

@ -313,6 +313,7 @@ Allowed values:
- `Units`, `[mapUnitFilter] Units`
- `[buildingFilter] Buildings`
- `Remaining [civFilter] Civilizations`
- `[tileFilter] Tiles`
- Stat name - gets the stat *reserve*, not the amount per turn (can be city stats or civilization stats, depending on where the unique is used)
- Resource name (can be city stats or civilization stats, depending on where the unique is used)