Updated TranslationFileWriter to include the new values that filters can have (#4402)

* Updated TranslationFileWriter to include the new values that filters can have

* Implemented requested changes
This commit is contained in:
Xander Lenstra 2021-07-09 08:14:24 +02:00 committed by GitHub
parent ced85fafd1
commit 21eadb39ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 6 deletions

View File

@ -139,7 +139,7 @@
"policies": [
{
"name": "Organized Religion",
"uniques": ["[+1 Happiness] from every [Monument]","[+1 Happiness] from every [Temple]",
"uniques": ["[+1 Happiness] from every [Monument]","[+1 Happiness] from every [Amphitheater]",
"[+1 Happiness] from every [Monastery]"],
"row": 1,
"column": 2
@ -152,7 +152,7 @@
},
{
"name": "Theocracy",
"uniques": ["+[10]% [Gold] from every [Temple]"],
"uniques": ["+[10]% [Gold] from every [Amphitheater]"],
"requires": ["Organized Religion"],
"row": 2,
"column": 1

View File

@ -197,21 +197,50 @@ object TranslationFileWriter {
var parameterName = when {
parameter.toIntOrNull() != null -> "amount"
Stat.values().any { it.name == parameter } -> "stat"
RulesetCache.getBaseRuleset().terrains.containsKey(parameter) -> "terrain"
RulesetCache.getBaseRuleset().terrains.containsKey(parameter)
|| parameter == "Friendly Land"
|| parameter == "Foreign Land"
|| parameter == "Fresh water"
|| parameter == "non-fresh water"
|| parameter == "Open Terrain"
|| parameter == "Rough Terrain"
-> "terrain"
RulesetCache.getBaseRuleset().units.containsKey(parameter) -> "unit"
RulesetCache.getBaseRuleset().tileImprovements.containsKey(parameter) -> "tileImprovement"
RulesetCache.getBaseRuleset().tileImprovements.containsKey(parameter)
|| parameter == "Great Improvement"
-> "tileImprovement"
RulesetCache.getBaseRuleset().tileResources.containsKey(parameter) -> "resource"
RulesetCache.getBaseRuleset().technologies.containsKey(parameter) -> "tech"
RulesetCache.getBaseRuleset().unitPromotions.containsKey(parameter) -> "promotion"
RulesetCache.getBaseRuleset().buildings.containsKey(parameter)
|| parameter == "Wonders" -> "building"
|| parameter == "Wonders"
|| parameter == "Wonder"
|| parameter == "Buildings"
|| parameter == "Building"
-> "building"
UnitType.values().any { it.name == parameter } || parameter == "Military" -> "unitType"
UnitType.values().any { it.name == parameter }
|| parameter == "Military"
|| parameter == "Civilian"
|| parameter == "non-air"
|| parameter == "relevant"
|| parameter == "Nuclear Weapon"
|| parameter == "Submarine"
// These are up for debate
|| parameter == "Air"
|| parameter == "land units"
|| parameter == "water units"
|| parameter == "air units"
|| parameter == "military units"
|| parameter == "submarine units"
// Note: this can't handle combinations of parameters (e.g. [{Military} {Water}])
-> "unitType"
Stats.isStats(parameter) -> "stats"
parameter == "in this city"
|| parameter == "in all cities"
|| parameter == "in all coastal cities"
|| parameter == "in capital"
|| parameter == "in all non-occupied cities"
|| parameter == "in all cities with a world wonder"
|| parameter == "in all cities connected to capital"
|| parameter == "in all cities with a garrison"