mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 22:00:24 +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
|
val enemyUnitsInWalkingDistance = getDistanceToTiles().keys
|
||||||
.filter { it.militaryUnit!=null && it.militaryUnit!!.civInfo!=civInfo }
|
.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")) {
|
if (action != null && action!!.startsWith("moveTo")) {
|
||||||
val destination = action!!.replace("moveTo ", "").split(",").dropLastWhile { it.isEmpty() }.toTypedArray()
|
val destination = action!!.replace("moveTo ", "").split(",").dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||||
|
Reference in New Issue
Block a user