mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 10:54:19 -04:00
Resolved #13863 - Inquisitors disrupt religion in other civs as well
This commit is contained in:
parent
33c4d9eb12
commit
f9c15afbb0
@ -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) }
|
||||
}
|
||||
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user