mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-29 00:50:43 +07:00
Air units can attack!
This commit is contained in:
parent
070d780e18
commit
f42cfd8b25
@ -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 }
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user