Resolved #13863 - Inquisitors disrupt religion in other civs as well

This commit is contained in:
yairm210 2025-08-27 18:18:49 +03:00
parent 33c4d9eb12
commit f9c15afbb0
2 changed files with 18 additions and 6 deletions

View File

@ -130,6 +130,7 @@ object ReligiousUnitAutomation {
return null
val holyCity = unit.civ.religionManager.getHolyCity()
// Our own holy city was taken over!
if (holyCity != null && holyCity.religion.getMajorityReligion() != unit.civ.religionManager.religion!!)
return holyCity
@ -137,12 +138,22 @@ object ReligiousUnitAutomation {
if (blockedHolyCity != null)
return blockedHolyCity
return unit.civ.cities.asSequence()
.filter { it.religion.getMajorityReligion() != null }
.filter { it.religion.getMajorityReligion()!! != unit.civ.religionManager.religion }
// Don't go if it takes too long
// Find cities
val relevantCities = unit.civ.gameInfo.getCities()
.filter { it.getCenterTile().isExplored(unit.civ) } // Cities we know about
// Someone else is controlling this city
.filter {
val majorityReligion = it.religion.getMajorityReligion()
majorityReligion != null && majorityReligion != unit.civ.religionManager.religion
}
val closeCity = relevantCities
.filter { it.getCenterTile().aerialDistanceTo(unit.currentTile) <= 20 }
.maxByOrNull { it.religion.getPressureDeficit(unit.civ.religionManager.religion?.name) }
// Find the city that we're the closest to converting
.minByOrNull { it.religion.getPressureDeficit(unit.civ.religionManager.religion?.name) }
if (closeCity != null) return closeCity
return relevantCities.minByOrNull { it.religion.getPressureDeficit(unit.civ.religionManager.religion?.name) }
}

View File

@ -330,7 +330,8 @@ class CityReligionManager : IsPartOfGameInfoSerialization {
return pressure.toInt()
}
/** Calculates how much pressure this religion is lacking compared to the majority religion */
/** Calculates how much pressure this religion is lacking compared to the majority religion
* That is, if we gain more than this, we'll be the majority */
@Readonly
fun getPressureDeficit(otherReligion: String?): Int {
val pressures = getPressures()