mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -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()
|
val city = unit.civInfo.gameInfo.getCities().asSequence()
|
||||||
.filter { it.religion.getMajorityReligion()?.name != unit.getReligionDisplayName() }
|
.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
|
.minByOrNull { it.getCenterTile().aerialDistanceTo(unit.currentTile) } ?: return
|
||||||
|
|
||||||
|
|
||||||
val destination = city.getTiles().asSequence()
|
val destination = city.getTiles().asSequence()
|
||||||
.filter { unit.movement.canMoveTo(it) || it == unit.getTile() }
|
.filter { unit.movement.canMoveTo(it) || it == unit.getTile() }
|
||||||
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
|
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
|
||||||
|
@ -283,10 +283,9 @@ class CityInfoReligionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isProtectedByInquisitor(): Boolean {
|
fun isProtectedByInquisitor(): Boolean {
|
||||||
for (tile in cityInfo.getCenterTile().neighbors)
|
for (tile in cityInfo.getCenterTile().getTilesInDistance(1))
|
||||||
if (tile.civilianUnit?.hasUnique(UniqueType.PreventSpreadingReligion) == true)
|
if (tile.civilianUnit?.hasUnique(UniqueType.PreventSpreadingReligion) == true)
|
||||||
return true
|
return true
|
||||||
if (cityInfo.getCenterTile().civilianUnit?.name == "Inquisitor") return true
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,6 +333,7 @@ class ReligionManager {
|
|||||||
if (missionary.getTile().getOwner() == null) return false
|
if (missionary.getTile().getOwner() == null) return false
|
||||||
if (missionary.currentTile.owningCity?.religion?.getMajorityReligion()?.name == missionary.religion)
|
if (missionary.currentTile.owningCity?.religion?.getMajorityReligion()?.name == missionary.religion)
|
||||||
return false
|
return false
|
||||||
|
if (missionary.getTile().getCity()!!.religion.isProtectedByInquisitor()) return false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user