mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-14 01:39:40 +07:00
Units are not displaced to enemy land when kicked out of borders
This commit is contained in:
@ -404,8 +404,8 @@ class UnitMovementAlgorithms(val unit: MapUnit) {
|
|||||||
while (allowedTile == null && distance < 5) {
|
while (allowedTile == null && distance < 5) {
|
||||||
distance++
|
distance++
|
||||||
allowedTile = unit.getTile().getTilesAtDistance(distance)
|
allowedTile = unit.getTile().getTilesAtDistance(distance)
|
||||||
// can the unit be placed safely there?
|
// can the unit be placed safely there? Is tile either unowned or friendly?
|
||||||
.filter { canMoveTo(it) }
|
.filter { canMoveTo(it) && it.getOwner()?.isAtWarWith(unit.civInfo) != true }
|
||||||
// out of those where it can be placed, can it reach them in any meaningful way?
|
// out of those where it can be placed, can it reach them in any meaningful way?
|
||||||
.firstOrNull { getPathBetweenTiles(unit.currentTile, it).contains(it) }
|
.firstOrNull { getPathBetweenTiles(unit.currentTile, it).contains(it) }
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user