mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-09 10:29:02 +07:00
Linked Unit Types and Promotions in Civilopedia
This commit is contained in:
parent
e987bbbaad
commit
c0e5f9d736
@ -88,18 +88,21 @@ class Promotion : RulesetObject() {
|
||||
val types = unitTypes.partition { it in ruleset.units }
|
||||
if (unitTypes.size == 1) {
|
||||
if (types.first.isNotEmpty())
|
||||
types.first.first().let {
|
||||
textList += FormattedLine("Available for [${it.tr()}]", link = "Unit/$it")
|
||||
unitTypes.first().let {
|
||||
textList += FormattedLine("Available for [$it]", link = "Unit/$it")
|
||||
}
|
||||
else
|
||||
textList += FormattedLine("Available for [${types.second.first().tr()}]")
|
||||
unitTypes.first().let {
|
||||
textList += FormattedLine("Available for [$it]", link = "UnitType/$it")
|
||||
}
|
||||
|
||||
} else {
|
||||
textList += FormattedLine("Available for:")
|
||||
types.first.forEach {
|
||||
textList += FormattedLine(it, indent = 1, link = "Unit/$it")
|
||||
}
|
||||
types.second.forEach {
|
||||
textList += FormattedLine(it, indent = 1)
|
||||
textList += FormattedLine(it, indent = 1, link = "UnitType/$it")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -227,6 +227,13 @@ object BaseUnitDescriptions {
|
||||
if (unit.unitType != name) continue
|
||||
yield(FormattedLine(unit.name, unit.makeLink()))
|
||||
}
|
||||
|
||||
val relevantPromotions = ruleset.unitPromotions.values.filter { it.unitTypes.contains(name) }
|
||||
if (relevantPromotions.isNotEmpty()) {
|
||||
yield(FormattedLine("Promotions", header = 4))
|
||||
for (promotion in relevantPromotions)
|
||||
yield(FormattedLine(promotion.name, promotion.makeLink()))
|
||||
}
|
||||
if (uniqueObjects.isNotEmpty()) {
|
||||
yield(FormattedLine(separator = true))
|
||||
for (unique in uniqueObjects) {
|
||||
|
Loading…
Reference in New Issue
Block a user