mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
@Interdice even after all that there was still a bug - we didn't check if the tiles we were sending the missionary/inquisitor to was actually reachable :)
This commit is contained in:
parent
a7b880c033
commit
9d38ce75c4
@ -300,7 +300,8 @@ object SpecificUnitAutomation {
|
||||
val destination = cities.getTiles().asSequence()
|
||||
.filterNot { unit.getTile().owningCity == it.owningCity } // to prevent the ai from moving around randomly
|
||||
.filter { unit.movement.canMoveTo(it) }
|
||||
.minByOrNull { it.aerialDistanceTo(unit.currentTile) }
|
||||
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
|
||||
.firstOrNull { unit.movement.canReach(it) }
|
||||
|
||||
|
||||
if (destination != null) {
|
||||
@ -328,14 +329,16 @@ object SpecificUnitAutomation {
|
||||
destination = cityToProtect.getCenterTile().neighbors.asSequence()
|
||||
.filterNot { unit.getTile().owningCity == it.owningCity } // to prevent the ai from moving around randomly
|
||||
.filter { unit.movement.canMoveTo(it) }
|
||||
.minByOrNull { it.aerialDistanceTo(unit.currentTile) }
|
||||
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
|
||||
.firstOrNull { unit.movement.canReach(it) }
|
||||
}
|
||||
if (destination == null) {
|
||||
if (cityToConvert == null) return
|
||||
destination = cityToConvert.getCenterTile().neighbors.asSequence()
|
||||
.filterNot { unit.getTile().owningCity == it.owningCity } // to prevent the ai from moving around randomly
|
||||
.filter { unit.movement.canMoveTo(it) }
|
||||
.minByOrNull { it.aerialDistanceTo(unit.currentTile) }
|
||||
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
|
||||
.firstOrNull { unit.movement.canReach(it) }
|
||||
}
|
||||
|
||||
if (destination != null)
|
||||
@ -346,7 +349,6 @@ object SpecificUnitAutomation {
|
||||
doReligiousAction(unit, destination)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun isInquisitorInTheCity(city: CityInfo, unit: MapUnit): Boolean {
|
||||
|
Loading…
x
Reference in New Issue
Block a user