String.getConditionals() -> String.getModifiers()

This commit is contained in:
yairm210 2024-08-04 17:15:36 +03:00
parent 8d2ebc69f1
commit e21da50c52
2 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ import com.unciv.models.ruleset.GlobalUniques
import com.unciv.models.ruleset.Ruleset
import com.unciv.models.ruleset.validation.UniqueValidator
import com.unciv.models.stats.Stats
import com.unciv.models.translations.getConditionals
import com.unciv.models.translations.getModifiers
import com.unciv.models.translations.getPlaceholderParameters
import com.unciv.models.translations.getPlaceholderText
import com.unciv.models.translations.removeConditionals
@ -27,7 +27,7 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
if (firstStatParam == null) Stats() // So badly-defined stats don't crash the entire game
else Stats.parse(firstStatParam)
}
val modifiers: List<Unique> = text.getConditionals()
val modifiers: List<Unique> = text.getModifiers()
val isTimedTriggerable = hasModifier(UniqueType.ConditionalTimedUnique)

View File

@ -380,10 +380,10 @@ private fun String.translateConditionals(hideIcons: Boolean, language: String):
var translatedBaseUnique = this.removeConditionals().tr(hideIcons)
val conditionals = this.getConditionals().map { it.placeholderText }
val conditionals = this.getModifiers().map { it.placeholderText }
val conditionsWithTranslation: LinkedHashMap<String, String> = linkedMapOf()
for (conditional in this.getConditionals())
for (conditional in this.getModifiers())
conditionsWithTranslation[conditional.placeholderText] = conditional.text.tr(hideIcons)
val translatedConditionals: MutableList<String> = mutableListOf()
@ -546,7 +546,7 @@ fun String.fillPlaceholders(vararg strings: String): String {
return filledString
}
fun String.getConditionals(): List<Unique> {
fun String.getModifiers(): List<Unique> {
if (!this.contains('<')) return emptyList()
return pointyBraceRegex.findAll(this).map { Unique(it.groups[1]!!.value) }.toList()
}