mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Added 'replacementTextForUniques' parameter to buildings and units for custom text
This commit is contained in:
parent
bcab751f7c
commit
8e8215b5c4
@ -59,6 +59,7 @@ class Building : NamedStats(), IConstruction {
|
|||||||
var quote: String = ""
|
var quote: String = ""
|
||||||
private var providesFreeBuilding: String? = null
|
private var providesFreeBuilding: String? = null
|
||||||
var uniques = ArrayList<String>()
|
var uniques = ArrayList<String>()
|
||||||
|
var replacementTextForUniques = ""
|
||||||
val uniqueObjects: List<Unique> by lazy { uniques.map { Unique(it) } }
|
val uniqueObjects: List<Unique> by lazy { uniques.map { Unique(it) } }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,7 +81,10 @@ class Building : NamedStats(), IConstruction {
|
|||||||
}
|
}
|
||||||
if (requiredNearbyImprovedResources != null)
|
if (requiredNearbyImprovedResources != null)
|
||||||
infoList += ("Requires worked [" + requiredNearbyImprovedResources!!.joinToString("/") { it.tr() } + "] near city").tr()
|
infoList += ("Requires worked [" + requiredNearbyImprovedResources!!.joinToString("/") { it.tr() } + "] near city").tr()
|
||||||
if (uniques.isNotEmpty()) infoList += uniques.joinToString { it.tr() }
|
if (uniques.isNotEmpty()) {
|
||||||
|
if (replacementTextForUniques != "") infoList += replacementTextForUniques
|
||||||
|
else infoList += uniques.joinToString { it.tr() }
|
||||||
|
}
|
||||||
if (cityStrength != 0) infoList += "{City strength} +".tr() + cityStrength
|
if (cityStrength != 0) infoList += "{City strength} +".tr() + cityStrength
|
||||||
if (cityHealth != 0) infoList += "{City health} +".tr() + cityHealth
|
if (cityHealth != 0) infoList += "{City health} +".tr() + cityHealth
|
||||||
if (xpForNewUnits != 0) infoList += "+$xpForNewUnits {XP for new units}".tr()
|
if (xpForNewUnits != 0) infoList += "+$xpForNewUnits {XP for new units}".tr()
|
||||||
@ -104,7 +108,10 @@ class Building : NamedStats(), IConstruction {
|
|||||||
stringBuilder.appendln("Consumes 1 [$requiredResource]".tr())
|
stringBuilder.appendln("Consumes 1 [$requiredResource]".tr())
|
||||||
if (providesFreeBuilding != null)
|
if (providesFreeBuilding != null)
|
||||||
stringBuilder.appendln("Provides a free [$providesFreeBuilding] in the city".tr())
|
stringBuilder.appendln("Provides a free [$providesFreeBuilding] in the city".tr())
|
||||||
if (uniques.isNotEmpty()) stringBuilder.appendln(uniques.asSequence().map { it.tr() }.joinToString("\n"))
|
if (uniques.isNotEmpty()){
|
||||||
|
if (replacementTextForUniques != "") stringBuilder.appendln(replacementTextForUniques)
|
||||||
|
else stringBuilder.appendln(uniques.asSequence().map { it.tr() }.joinToString("\n"))
|
||||||
|
}
|
||||||
if (!stats.isEmpty())
|
if (!stats.isEmpty())
|
||||||
stringBuilder.appendln(stats)
|
stringBuilder.appendln(stats)
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ class BaseUnit : INamed, IConstruction {
|
|||||||
var requiredResource: String? = null
|
var requiredResource: String? = null
|
||||||
var uniques = HashSet<String>()
|
var uniques = HashSet<String>()
|
||||||
val uniqueObjects: List<Unique> by lazy { uniques.map { Unique(it) } }
|
val uniqueObjects: List<Unique> by lazy { uniques.map { Unique(it) } }
|
||||||
|
var replacementTextForUniques = ""
|
||||||
var promotions = HashSet<String>()
|
var promotions = HashSet<String>()
|
||||||
var obsoleteTech: String? = null
|
var obsoleteTech: String? = null
|
||||||
var upgradesTo: String? = null
|
var upgradesTo: String? = null
|
||||||
@ -46,7 +47,8 @@ class BaseUnit : INamed, IConstruction {
|
|||||||
if (movement != 2) infoList += "$movement${Fonts.movement}"
|
if (movement != 2) infoList += "$movement${Fonts.movement}"
|
||||||
for (promotion in promotions)
|
for (promotion in promotions)
|
||||||
infoList += promotion.tr()
|
infoList += promotion.tr()
|
||||||
for (unique in uniques)
|
if (replacementTextForUniques != "") infoList += replacementTextForUniques
|
||||||
|
else for (unique in uniques)
|
||||||
infoList += Translations.translateBonusOrPenalty(unique)
|
infoList += Translations.translateBonusOrPenalty(unique)
|
||||||
return infoList.joinToString()
|
return infoList.joinToString()
|
||||||
}
|
}
|
||||||
@ -68,7 +70,8 @@ class BaseUnit : INamed, IConstruction {
|
|||||||
}
|
}
|
||||||
sb.appendln("$movement${Fonts.movement}")
|
sb.appendln("$movement${Fonts.movement}")
|
||||||
|
|
||||||
for (unique in uniques)
|
if (replacementTextForUniques != "") sb.appendln(replacementTextForUniques)
|
||||||
|
else for (unique in uniques)
|
||||||
sb.appendln(Translations.translateBonusOrPenalty(unique))
|
sb.appendln(Translations.translateBonusOrPenalty(unique))
|
||||||
|
|
||||||
if (promotions.isNotEmpty()) {
|
if (promotions.isNotEmpty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user