Air units can attack!

This commit is contained in:
Yair Morgenstern 2019-07-05 14:46:04 +03:00
parent 070d780e18
commit f42cfd8b25
2 changed files with 6 additions and 5 deletions

View File

@ -199,7 +199,7 @@ class UnitAutomation{
for(reachableTile in tilesToAttackFrom){ // tiles we'll still have energy after we reach there
val tilesInAttackRange =
if (unit.hasUnique("Indirect Fire")) reachableTile.getTilesInDistance(rangeOfAttack)
if (unit.hasUnique("Indirect Fire") || unit.type.isAirUnit()) reachableTile.getTilesInDistance(rangeOfAttack)
else reachableTile.getViewableTiles(rangeOfAttack, unit.type.isWaterUnit())
attackableTiles += tilesInAttackRange.asSequence().filter { it in tilesWithEnemies }

View File

@ -295,11 +295,12 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
if (UnCivGame.Current.settings.singleTapMove || isAirUnit) 0.7f else 0.3f)
val unitType = unit.type
val attackableTiles: List<TileInfo> = when {
unitType.isCivilian() -> listOf()
else -> UnitAutomation().getAttackableEnemies(unit, unit.getDistanceToTiles()).map { it.tileToAttack }
.filter { (UnCivGame.Current.viewEntireMapForDebug || playerViewableTilePositions.contains(it.position)) }
val attackableTiles: List<TileInfo> = if (unitType.isCivilian()) listOf()
else {
val tiles = UnitAutomation().getAttackableEnemies(unit, unit.getDistanceToTiles()).map { it.tileToAttack }
tiles.filter { (UnCivGame.Current.viewEntireMapForDebug || playerViewableTilePositions.contains(it.position)) }
}
for (attackableTile in attackableTiles) {
tileGroups[attackableTile]!!.showCircle(colorFromRGB(237, 41, 57))
tileGroups[attackableTile]!!.showCrosshair()