From b669c2ab1bb68f66b0cfacf92b8bfb3d39c1c335 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 8 Jan 2023 11:45:08 +0200 Subject: [PATCH] Units are not displaced to enemy land when kicked out of borders --- core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 0a1f0d820b..790628b0e0 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -404,8 +404,8 @@ class UnitMovementAlgorithms(val unit: MapUnit) { while (allowedTile == null && distance < 5) { distance++ allowedTile = unit.getTile().getTilesAtDistance(distance) - // can the unit be placed safely there? - .filter { canMoveTo(it) } + // can the unit be placed safely there? Is tile either unowned or friendly? + .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? .firstOrNull { getPathBetweenTiles(unit.currentTile, it).contains(it) } }