From af47880f48056e887a5eefec47bee09577171b02 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 9 Apr 2018 11:04:13 +0300 Subject: [PATCH] Don't random-walk to tiles that have units in them! --- core/src/com/unciv/logic/GameInfo.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index 12d87c3c15..bdb3e24c92 100644 --- a/core/src/com/unciv/logic/GameInfo.kt +++ b/core/src/com/unciv/logic/GameInfo.kt @@ -150,8 +150,13 @@ class GameInfo { continue } + if(unit.health < 100){ + healUnit() + continue + } + // else, go to a random space - unit.moveToTile(distanceToTiles.keys.toList().getRandom()) + unit.moveToTile(distanceToTiles.keys.filter { it.unit==null }.toList().getRandom()) } }