From a9c367907d14ad8fcbe6160731b18bc40e9cdcfb Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 9 Feb 2024 12:44:56 +0200 Subject: [PATCH] Allow combatantFilter for cities to use cityFilter --- core/src/com/unciv/logic/battle/CityCombatant.kt | 2 +- .../src/com/unciv/models/ruleset/unique/UniqueParameterType.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/battle/CityCombatant.kt b/core/src/com/unciv/logic/battle/CityCombatant.kt index 62fe3db67f..84dc6fd9e6 100644 --- a/core/src/com/unciv/logic/battle/CityCombatant.kt +++ b/core/src/com/unciv/logic/battle/CityCombatant.kt @@ -24,7 +24,7 @@ class CityCombatant(val city: City) : ICombatant { override fun isDefeated(): Boolean = city.health == 1 override fun isInvisible(to: Civilization): Boolean = false override fun canAttack(): Boolean = city.canBombard() - override fun matchesFilter(filter: String) = MultiFilter.multiFilter(filter, {it == "City" || it == "All" || city.civ.matchesFilter(it)}) + override fun matchesFilter(filter: String) = MultiFilter.multiFilter(filter, {it == "City" || it == "All" || city.matchesFilter(it)}) override fun getAttackSound() = UncivSound.Bombard override fun takeDamage(damage: Int) { diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt index 7a92caa76c..c94c07fb1a 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt @@ -86,8 +86,9 @@ enum class UniqueParameterType( UniqueType.UniqueParameterErrorSeverity? = getErrorSeverityForFilter(parameterText, ruleset) override fun isKnownValue(parameterText: String, ruleset: Ruleset): Boolean { - if (parameterText == "City") return true // MapUnitFilter covers CivFilter + if (parameterText == "City") return true if (MapUnitFilter.isKnownValue(parameterText, ruleset)) return true + if (CityFilter.isKnownValue(parameterText, ruleset)) return true return false } },