mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-10 02:47:24 +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 }
|
val types = unitTypes.partition { it in ruleset.units }
|
||||||
if (unitTypes.size == 1) {
|
if (unitTypes.size == 1) {
|
||||||
if (types.first.isNotEmpty())
|
if (types.first.isNotEmpty())
|
||||||
types.first.first().let {
|
unitTypes.first().let {
|
||||||
textList += FormattedLine("Available for [${it.tr()}]", link = "Unit/$it")
|
textList += FormattedLine("Available for [$it]", link = "Unit/$it")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
textList += FormattedLine("Available for [${types.second.first().tr()}]")
|
unitTypes.first().let {
|
||||||
|
textList += FormattedLine("Available for [$it]", link = "UnitType/$it")
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
textList += FormattedLine("Available for:")
|
textList += FormattedLine("Available for:")
|
||||||
types.first.forEach {
|
types.first.forEach {
|
||||||
textList += FormattedLine(it, indent = 1, link = "Unit/$it")
|
textList += FormattedLine(it, indent = 1, link = "Unit/$it")
|
||||||
}
|
}
|
||||||
types.second.forEach {
|
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
|
if (unit.unitType != name) continue
|
||||||
yield(FormattedLine(unit.name, unit.makeLink()))
|
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()) {
|
if (uniqueObjects.isNotEmpty()) {
|
||||||
yield(FormattedLine(separator = true))
|
yield(FormattedLine(separator = true))
|
||||||
for (unique in uniqueObjects) {
|
for (unique in uniqueObjects) {
|
||||||
|
Loading…
Reference in New Issue
Block a user