diff --git a/android/assets/jsons/translations/template.properties b/android/assets/jsons/translations/template.properties index 83285f1d21..bc6082c215 100644 --- a/android/assets/jsons/translations/template.properties +++ b/android/assets/jsons/translations/template.properties @@ -924,6 +924,7 @@ Are you SURE you want to delete this mod? = [stats] from every [param] = [stats] from [param] tiles in this city = +[stats] from every [param] on [tileFilter] tiles = [stats] for each adjacent [param] = Must be next to [terrain] = Must be on [terrain] = diff --git a/core/src/com/unciv/models/ruleset/tech/Technology.kt b/core/src/com/unciv/models/ruleset/tech/Technology.kt index 0f8a4a6c0c..3848cca736 100644 --- a/core/src/com/unciv/models/ruleset/tech/Technology.kt +++ b/core/src/com/unciv/models/ruleset/tech/Technology.kt @@ -26,43 +26,37 @@ class Technology { val lineList = ArrayList() // more readable than StringBuilder, with same performance for our use-case for (unique in uniques) lineList += unique.tr() - val mapOfImprovedImprovements = HashMap>() - for (improvement in ruleset.tileImprovements.values) for ( unique in improvement.uniqueObjects - .filter { it.placeholderText in setOf("[] once [] is discovered", "[] on [] tiles once [] is discovered") - && it.params.last() == name }) { - val key = if (unique.params.size == 2 ) "The following improvements [${unique.params[0]}]:" else "The following improvements on [${unique.params[1]}] tiles [${unique.params[0]}]:" - if (!mapOfImprovedImprovements.containsKey(key)) mapOfImprovedImprovements[key] = ArrayList() - mapOfImprovedImprovements[key]!!.add(improvement.name) - } - for (improvements in mapOfImprovedImprovements) { - val impimpString = improvements.key.tr() + improvements.value.joinToString(", "," ") { it.tr() } - lineList += impimpString - } + for (improvement in ruleset.tileImprovements.values) + for (unique in improvement.uniqueObjects) { + if (unique.placeholderText == "[] once [] is discovered" && unique.params.last() == name) + lineList += "[${unique.params[0]}] from every [${improvement.name}]" + else if (unique.placeholderText == "[] on [] tiles once [] is discovered" && unique.params.last() == name) + lineList += "[${unique.params[0]}] from every [${improvement.name}] on [${unique.params[1]}] tiles" + } val viewingCiv = UncivGame.Current.worldScreen.viewingCiv - val enabledUnits = getEnabledUnits(viewingCiv) - if (enabledUnits.any { "Will not be displayed in Civilopedia" !in it.uniques}) { + val enabledUnits = getEnabledUnits(viewingCiv).filter { "Will not be displayed in Civilopedia" !in it.uniques } + if (enabledUnits.isNotEmpty()) { lineList += "{Units enabled}: " - for (unit in enabledUnits - .filter { "Will not be displayed in Civilopedia" !in it.uniques}) + for (unit in enabledUnits) lineList += " * " + unit.name.tr() + " (" + unit.getShortDescription() + ")" } val enabledBuildings = getEnabledBuildings(viewingCiv) - val regularBuildings = enabledBuildings.filter { !it.isWonder && !it.isNationalWonder } - if (regularBuildings.any { "Will not be displayed in Civilopedia" !in it.uniques}) { + val regularBuildings = enabledBuildings.filter { !it.isWonder && !it.isNationalWonder + && "Will not be displayed in Civilopedia" !in it.uniques } + if (regularBuildings.isNotEmpty()) { lineList += "{Buildings enabled}: " - for (building in regularBuildings - .filter { "Will not be displayed in Civilopedia" !in it.uniques}) + for (building in regularBuildings) lineList += "* " + building.name.tr() + " (" + building.getShortDescription(ruleset) + ")" } - val wonders = enabledBuildings.filter { it.isWonder || it.isNationalWonder } - if (wonders.any { "Will not be displayed in Civilopedia" !in it.uniques }) { + val wonders = enabledBuildings.filter { (it.isWonder || it.isNationalWonder) + && "Will not be displayed in Civilopedia" !in it.uniques } + if (wonders.isNotEmpty()) { lineList += "{Wonders enabled}: " - for (wonder in wonders - .filter { "Will not be displayed in Civilopedia" !in it.uniques}) + for (wonder in wonders) lineList += " * " + wonder.name.tr() + " (" + wonder.getShortDescription(ruleset) + ")" }