mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -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
|
return null
|
||||||
|
|
||||||
val holyCity = unit.civ.religionManager.getHolyCity()
|
val holyCity = unit.civ.religionManager.getHolyCity()
|
||||||
|
// Our own holy city was taken over!
|
||||||
if (holyCity != null && holyCity.religion.getMajorityReligion() != unit.civ.religionManager.religion!!)
|
if (holyCity != null && holyCity.religion.getMajorityReligion() != unit.civ.religionManager.religion!!)
|
||||||
return holyCity
|
return holyCity
|
||||||
|
|
||||||
@ -137,12 +138,22 @@ object ReligiousUnitAutomation {
|
|||||||
if (blockedHolyCity != null)
|
if (blockedHolyCity != null)
|
||||||
return blockedHolyCity
|
return blockedHolyCity
|
||||||
|
|
||||||
return unit.civ.cities.asSequence()
|
// Find cities
|
||||||
.filter { it.religion.getMajorityReligion() != null }
|
val relevantCities = unit.civ.gameInfo.getCities()
|
||||||
.filter { it.religion.getMajorityReligion()!! != unit.civ.religionManager.religion }
|
.filter { it.getCenterTile().isExplored(unit.civ) } // Cities we know about
|
||||||
// Don't go if it takes too long
|
// 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 }
|
.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()
|
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
|
@Readonly
|
||||||
fun getPressureDeficit(otherReligion: String?): Int {
|
fun getPressureDeficit(otherReligion: String?): Int {
|
||||||
val pressures = getPressures()
|
val pressures = getPressures()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user