From f49662b22ed50aca9f1383a539caef016df8e658 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 3 Jun 2019 20:50:58 +0300 Subject: [PATCH] Resolved #836 - bug where ranged units could shoot above forests+jungles --- core/src/com/unciv/logic/automation/UnitAutomation.kt | 5 +++-- core/src/com/unciv/logic/map/TileInfo.kt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/automation/UnitAutomation.kt b/core/src/com/unciv/logic/automation/UnitAutomation.kt index 7b8b539c7f..0a230aa1b8 100644 --- a/core/src/com/unciv/logic/automation/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/UnitAutomation.kt @@ -180,8 +180,9 @@ class UnitAutomation{ .filter { unit.canMoveTo(it) || it==unit.getTile() } for(reachableTile in tilesToAttackFrom){ // tiles we'll still have energy after we reach there - val tilesInAttackRange = if (unit.hasUnique("Indirect Fire")) reachableTile.getTilesInDistance(rangeOfAttack) - else reachableTile.getViewableTiles(rangeOfAttack, unit.type.isWaterUnit()) + val tilesInAttackRange = + if (unit.hasUnique("Indirect Fire")) reachableTile.getTilesInDistance(rangeOfAttack) + else reachableTile.getViewableTiles(rangeOfAttack, unit.type.isWaterUnit()) attackableTiles += tilesInAttackRange.asSequence().filter { it in tilesWithEnemies } .map { AttackableTile(reachableTile,it) } diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index 1d18152466..415fc92b30 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -95,7 +95,7 @@ open class TileInfo { fun getHeight(): Int { if (baseTerrain==Constants.mountain) return 4 if (baseTerrain == Constants.hill) return 2 - if (baseTerrain==Constants.forest || baseTerrain==Constants.jungle) return 1 + if (terrainFeature==Constants.forest || terrainFeature==Constants.jungle) return 1 return 0 }