Ranged units cannot indirect attack (e.g. if a hill is in the way)
This commit is contained in:
parent
5ee0c47e22
commit
a86460b345
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue