mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-09 15:29:32 +07:00
When aa unit that was moving towards somewhere encounters an enemy unit within walking distance, it stops the movement that it had completely
This commit is contained in:
@ -42,7 +42,10 @@ class MapUnit {
|
||||
|
||||
val enemyUnitsInWalkingDistance = getDistanceToTiles().keys
|
||||
.filter { it.militaryUnit!=null && it.militaryUnit!!.civInfo!=civInfo }
|
||||
if(enemyUnitsInWalkingDistance.isNotEmpty()) return // Don't you dare move.
|
||||
if(enemyUnitsInWalkingDistance.isNotEmpty()) {
|
||||
if (action != null && action!!.startsWith("moveTo")) action=null
|
||||
return // Don't you dare move.
|
||||
}
|
||||
|
||||
if (action != null && action!!.startsWith("moveTo")) {
|
||||
val destination = action!!.replace("moveTo ", "").split(",").dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||
|
Reference in New Issue
Block a user