Update ReligiousUnitAutomation.kt (#12444)

This commit is contained in:
EmperorPinguin 2024-11-13 14:50:49 +01:00 committed by GitHub
parent 08378cb3c8
commit ba4003bb30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,17 +105,11 @@ object ReligiousUnitAutomation {
}
if (destinationCity == null) return
var destinationTile = destinationCity.getCenterTile()
if (!unit.movement.canReach(destinationTile)
// Wait for the addInCapital units to go to the city!
|| CivilianUnitAutomation.shouldClearTileForAddInCapitalUnits(unit, destinationTile)) {
destinationTile = destinationTile.neighbors
val destinationTile = destinationCity.getCenterTile().neighbors
.filter { unit.movement.canMoveTo(it) || it == unit.getTile() }
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
.firstOrNull { unit.movement.canReach(it) }
?: return
}
unit.movement.headTowards(destinationTile)