Ranged units cannot indirect attack (e.g. if a hill is in the way)

This commit is contained in:
Yair Morgenstern 2018-07-18 17:52:13 +03:00
parent 5ee0c47e22
commit a86460b345

View file

@ -60,7 +60,9 @@ class UnitAutomation{
.map { it.key } .map { it.key }
.filter { unit.canMoveTo(it) || it==unit.getTile() } .filter { unit.canMoveTo(it) || it==unit.getTile() }
for(reachableTile in tilesToAttackFrom){ // tiles we'll still have energy after we reach there for(reachableTile in tilesToAttackFrom){ // tiles we'll still have energy after we reach there
attackableTiles += reachableTile.getTilesInDistance(rangeOfAttack).filter { it in tilesWithEnemies } val tilesInAttackRange = if (unit.hasUnique("Indirect fire")) reachableTile.getTilesInDistance(rangeOfAttack)
else reachableTile.getViewableTiles(rangeOfAttack)
attackableTiles += tilesInAttackRange.filter { it in tilesWithEnemies }
.map { AttackableTile(reachableTile,it) } .map { AttackableTile(reachableTile,it) }
} }
return attackableTiles return attackableTiles