diff --git a/core/src/com/unciv/logic/automation/UnitAutomation.kt b/core/src/com/unciv/logic/automation/UnitAutomation.kt index 90eacfe581..37dc8d7194 100644 --- a/core/src/com/unciv/logic/automation/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/UnitAutomation.kt @@ -115,7 +115,6 @@ class UnitAutomation{ unit.moveToTile(distanceToTiles.keys.filter { it.unit == null }.toList().getRandom()) } - fun rankTileAsCityCenter(tileInfo: TileInfo, nearbyTileRankings: Map): Float { val bestTilesFromOuterLayer = tileInfo.tileMap.getTilesAtDistance(tileInfo.position,2) .sortedByDescending { nearbyTileRankings[it] }.take(2) diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 527c1e7d62..f169fb4f6c 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -32,6 +32,11 @@ class MapUnit { fun doPreTurnAction() { val currentTile = getTile() if (currentMovement == 0f) return // We've already done stuff this turn, and can't do any more stuff + + val enemyUnitsInWalkingDistance = getDistanceToTiles().keys + .filter { it.unit!=null && it.unit!!.civInfo!=civInfo } + if(enemyUnitsInWalkingDistance.isNotEmpty()) return // Don't you dare move. + if (action != null && action!!.startsWith("moveTo")) { val destination = action!!.replace("moveTo ", "").split(",").dropLastWhile { it.isEmpty() }.toTypedArray() val destinationVector = Vector2(Integer.parseInt(destination[0]).toFloat(), Integer.parseInt(destination[1]).toFloat())