mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Update ReligiousUnitAutomation.kt (#12444)
This commit is contained in:
parent
08378cb3c8
commit
ba4003bb30
@ -105,17 +105,11 @@ object ReligiousUnitAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (destinationCity == null) return
|
if (destinationCity == null) return
|
||||||
var destinationTile = destinationCity.getCenterTile()
|
val destinationTile = destinationCity.getCenterTile().neighbors
|
||||||
|
|
||||||
if (!unit.movement.canReach(destinationTile)
|
|
||||||
// Wait for the addInCapital units to go to the city!
|
|
||||||
|| CivilianUnitAutomation.shouldClearTileForAddInCapitalUnits(unit, destinationTile)) {
|
|
||||||
destinationTile = destinationTile.neighbors
|
|
||||||
.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) }
|
||||||
.firstOrNull { unit.movement.canReach(it) }
|
.firstOrNull { unit.movement.canReach(it) }
|
||||||
?: return
|
?: return
|
||||||
}
|
|
||||||
|
|
||||||
unit.movement.headTowards(destinationTile)
|
unit.movement.headTowards(destinationTile)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user