Don't random-walk to tiles that have units in them!

This commit is contained in:
Yair Morgenstern 2018-04-09 11:04:13 +03:00
parent b59e235df5
commit af47880f48

View File

@ -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())
}
}