mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-12 19:10:12 +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:
parent
4593bed7dc
commit
67b9b7ea7a
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user