mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
AI missionaries avoid cities with inquisitors (#7218)
This commit is contained in:
parent
18b91bba1e
commit
954d0e4fe0
@ -299,10 +299,10 @@ object SpecificUnitAutomation {
|
||||
|
||||
val city = unit.civInfo.gameInfo.getCities().asSequence()
|
||||
.filter { it.religion.getMajorityReligion()?.name != unit.getReligionDisplayName() }
|
||||
.filterNot { it.civInfo.isAtWarWith(unit.civInfo) }
|
||||
.filter { it.civInfo.knows(unit.civInfo) && !it.civInfo.isAtWarWith(unit.civInfo) }
|
||||
.filterNot { it.religion.isProtectedByInquisitor() }
|
||||
.minByOrNull { it.getCenterTile().aerialDistanceTo(unit.currentTile) } ?: return
|
||||
|
||||
|
||||
val destination = city.getTiles().asSequence()
|
||||
.filter { unit.movement.canMoveTo(it) || it == unit.getTile() }
|
||||
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
|
||||
|
@ -283,10 +283,9 @@ class CityInfoReligionManager {
|
||||
}
|
||||
|
||||
fun isProtectedByInquisitor(): Boolean {
|
||||
for (tile in cityInfo.getCenterTile().neighbors)
|
||||
for (tile in cityInfo.getCenterTile().getTilesInDistance(1))
|
||||
if (tile.civilianUnit?.hasUnique(UniqueType.PreventSpreadingReligion) == true)
|
||||
return true
|
||||
if (cityInfo.getCenterTile().civilianUnit?.name == "Inquisitor") return true
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -333,6 +333,7 @@ class ReligionManager {
|
||||
if (missionary.getTile().getOwner() == null) return false
|
||||
if (missionary.currentTile.owningCity?.religion?.getMajorityReligion()?.name == missionary.religion)
|
||||
return false
|
||||
if (missionary.getTile().getCity()!!.religion.isProtectedByInquisitor()) return false
|
||||
return true
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user