More field deprecation

This commit is contained in:
yairm210
2021-11-04 22:43:15 +02:00
parent bad6692207
commit 6e6192c369
3 changed files with 2 additions and 16 deletions

View File

@ -256,7 +256,7 @@ class Nation : RulesetObject() {
unique.text.tr(), indent = 1)
}
for (promotion in unit.promotions.filter { it !in originalUnit.promotions }) {
val effect = ruleset.unitPromotions[promotion]!!.uniquesWithEffect()
val effect = ruleset.unitPromotions[promotion]!!.uniques
// "{$promotion} ({$effect})" won't work as effect may contain [] and tr() does not support that kind of nesting
textList += FormattedLine(
"${promotion.tr()} (${effect.joinToString(",") { it.tr() }})",

View File

@ -409,12 +409,6 @@ class Ruleset {
}
for (promotion in unitPromotions.values) {
if (promotion.effect != "")
lines.add(
"`Promotion.effect` used in ${promotion.name} is deprecated, please use `uniques` instead",
RulesetErrorSeverity.WarningOptionsOnly
)
checkUniques(promotion, lines, UniqueType.UniqueComplianceErrorSeverity.RulesetInvariant)
}

View File

@ -12,16 +12,8 @@ import com.unciv.ui.civilopedia.FormattedLine
class Promotion : RulesetObject() {
var prerequisites = listOf<String>()
@Deprecated("As of 3.16.12", ReplaceWith("uniques"))
var effect = ""
var unitTypes = listOf<String>() // The json parser wouldn't agree to deserialize this as a list of UnitTypes. =(
fun uniquesWithEffect() = sequence {
if (effect.isNotEmpty()) yield(effect)
yieldAll(uniques)
}
override fun getUniqueTarget() = UniqueTarget.Promotion
@ -29,7 +21,7 @@ class Promotion : RulesetObject() {
fun getDescription(promotionsForUnitType: Collection<Promotion>):String {
val textList = ArrayList<String>()
for (unique in uniquesWithEffect()) {
for (unique in uniques) {
textList += unique.tr()
}