mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-01 02:14:51 +07:00
Civilopedia quickie: Units show other direction of upgrade path (#5209)
* Civilopedia quickie: Units show other direction of upgrade path * Civilopedia quickie: Units show other direction of upgrade path - spacing
This commit is contained in:
parent
fe60c100fa
commit
86bbf54cc0
@ -953,6 +953,8 @@ Tutorials =
|
||||
Cost =
|
||||
May contain [listOfResources] =
|
||||
May contain: =
|
||||
Can upgrade from [unit] =
|
||||
Can upgrade from: =
|
||||
Upgrades to [upgradedUnit] =
|
||||
Obsolete with [obsoleteTech] =
|
||||
Occurs on [listOfTerrains] =
|
||||
|
@ -154,6 +154,24 @@ class BaseUnit : INamed, INonPerpetualConstruction, ICivilopediaText {
|
||||
|
||||
if (requiredTech != null || upgradesTo != null || obsoleteTech != null) textList += FormattedLine()
|
||||
if (requiredTech != null) textList += FormattedLine("Required tech: [$requiredTech]", link="Technology/$requiredTech")
|
||||
|
||||
val canUpgradeFrom = ruleset.units
|
||||
.filterValues {
|
||||
(it.upgradesTo == name || it.upgradesTo != null && it.upgradesTo == replaces)
|
||||
&& (it.uniqueTo == uniqueTo || it.uniqueTo == null)
|
||||
}.keys
|
||||
if (canUpgradeFrom.isNotEmpty()) {
|
||||
if (canUpgradeFrom.size == 1)
|
||||
textList += FormattedLine("Can upgrade from [${canUpgradeFrom.first()}]", link = "Unit/${canUpgradeFrom.first()}")
|
||||
else {
|
||||
textList += FormattedLine()
|
||||
textList += FormattedLine("Can upgrade from:")
|
||||
for (unitName in canUpgradeFrom.sorted())
|
||||
textList += FormattedLine(unitName, indent = 2, link = "Unit/$unitName")
|
||||
textList += FormattedLine()
|
||||
}
|
||||
}
|
||||
|
||||
if (upgradesTo != null) textList += FormattedLine("Upgrades to [$upgradesTo]", link="Unit/$upgradesTo")
|
||||
if (obsoleteTech != null) textList += FormattedLine("Obsolete with [$obsoleteTech]", link="Technology/$obsoleteTech")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user