mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 10:54:19 -04:00
Fix Faith Healers healing enemies (#8522)
* Fix faith healers belief and add Friendly/Enemy mapUnitFilter support * Use Ally instead of Friendly since Ally denotes the ally of a CS and not necessarily a friendly civ * Fewer words * Remove mapFilter implementation * Remove nullability
This commit is contained in:
parent
03d5ba0f07
commit
913cb3cf00
@ -612,7 +612,7 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
||||
}?.getCity()
|
||||
if (healingCity != null) {
|
||||
for (unique in healingCity.getMatchingUniques(UniqueType.CityHealingUnits)) {
|
||||
if (!matchesFilter(unique.params[0])) continue
|
||||
if (!matchesFilter(unique.params[0]) || !isAlly(healingCity.civInfo)) continue // only heal our units or allied units
|
||||
healing += unique.params[1].toInt()
|
||||
}
|
||||
}
|
||||
@ -876,6 +876,12 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
||||
}
|
||||
|
||||
|
||||
private fun isAlly(otherCiv: Civilization): Boolean {
|
||||
return otherCiv == civInfo
|
||||
|| (otherCiv.isCityState() && otherCiv.getAllyCiv() == civInfo.civName)
|
||||
|| (civInfo.isCityState() && civInfo.getAllyCiv() == otherCiv.civName)
|
||||
}
|
||||
|
||||
/** Implements [UniqueParameterType.MapUnitFilter][com.unciv.models.ruleset.unique.UniqueParameterType.MapUnitFilter] */
|
||||
fun matchesFilter(filter: String): Boolean {
|
||||
return filter.filterAndLogic { matchesFilter(it) } // multiple types at once - AND logic. Looks like:"{Military} {Land}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user