diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 3809c1f5f3..e902e20bd2 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -40,7 +40,7 @@ class MapUnit { lateinit var baseUnit: BaseUnit @Transient - internal lateinit var currentTile: TileInfo + lateinit var currentTile: TileInfo @Transient val movement = UnitMovementAlgorithms(this) diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 86ba5f22fb..c8ab5348f5 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -630,8 +630,10 @@ class UnitMovementAlgorithms(val unit:MapUnit) { val firstUnit = tile.getFirstUnit() // Moving to non-empty tile if (firstUnit != null && unit.civInfo != firstUnit.civInfo) { - // Allow movement through unguarded, at-war Civilian Unit. Capture on the way - if (tile.getUnguardedCivilian() != null && unit.civInfo.isAtWarWith(tile.civilianUnit!!.civInfo)) + // Allow movement through unguarded, at-war Civilian Unit. Capture on the way + // But not for Embarked Units capturing on Water + if (!(unit.isEmbarked() && tile.isWater) + && tile.getUnguardedCivilian() != null && unit.civInfo.isAtWarWith(tile.civilianUnit!!.civInfo)) return true // Cannot enter hostile tile with any unit in there if (unit.civInfo.isAtWarWith(firstUnit.civInfo)) diff --git a/tests/src/com/unciv/logic/map/UnitMovementAlgorithmsTests.kt b/tests/src/com/unciv/logic/map/UnitMovementAlgorithmsTests.kt index a97148c7ba..78ce5e2418 100644 --- a/tests/src/com/unciv/logic/map/UnitMovementAlgorithmsTests.kt +++ b/tests/src/com/unciv/logic/map/UnitMovementAlgorithmsTests.kt @@ -208,6 +208,8 @@ class UnitMovementAlgorithmsTests { fun canNOTPassThroughTileWithEnemyUnits() { tile.baseTerrain = Constants.grassland tile.setTransients() + + unit.currentTile = tile val otherCiv = CivilizationInfo() otherCiv.civName = Constants.barbarians // they are always enemies