mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Show that air units can move to tiles within attack range (#3101)
Previously, only tiles (with a city or carrier) outside the attack range got a white circle. Now all tiles to which the air unit can move get a white circle.
This commit is contained in:
parent
ddc7072b22
commit
f2ddda0a6f
@ -309,28 +309,25 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
val isAirUnit = unit.type.isAirUnit()
|
val isAirUnit = unit.type.isAirUnit()
|
||||||
val tilesInMoveRange =
|
val tilesInMoveRange =
|
||||||
if (isAirUnit)
|
if (isAirUnit)
|
||||||
unit.getTile().getTilesInDistanceRange(IntRange(unit.getRange(), unit.getRange() * 2))
|
unit.getTile().getTilesInDistanceRange(IntRange(1, unit.getRange() * 2))
|
||||||
else
|
else
|
||||||
unit.movement.getDistanceToTiles().keys.asSequence()
|
unit.movement.getDistanceToTiles().keys.asSequence()
|
||||||
|
|
||||||
for (tile in tilesInMoveRange) {
|
for (tile in tilesInMoveRange) {
|
||||||
val tileToColor = tileGroups.getValue(tile)
|
val tileToColor = tileGroups.getValue(tile)
|
||||||
if (isAirUnit)
|
if (isAirUnit)
|
||||||
|
if (tile.aerialDistanceTo(unit.getTile()) <= unit.getRange()) {
|
||||||
|
// The tile is within attack range
|
||||||
|
tileToColor.showCircle(Color.RED, 0.3f)
|
||||||
|
} else {
|
||||||
|
// The tile is within move range
|
||||||
tileToColor.showCircle(Color.BLUE, 0.3f)
|
tileToColor.showCircle(Color.BLUE, 0.3f)
|
||||||
|
}
|
||||||
if (unit.movement.canMoveTo(tile))
|
if (unit.movement.canMoveTo(tile))
|
||||||
tileToColor.showCircle(Color.WHITE,
|
tileToColor.showCircle(Color.WHITE,
|
||||||
if (UncivGame.Current.settings.singleTapMove || isAirUnit) 0.7f else 0.3f)
|
if (UncivGame.Current.settings.singleTapMove || isAirUnit) 0.7f else 0.3f)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark tiles in air units attack range as RED
|
|
||||||
if (isAirUnit) {
|
|
||||||
val tilesInAirAttackRange = unit.getTile().getTilesInDistance(unit.getRange())
|
|
||||||
for (tile in tilesInAirAttackRange) {
|
|
||||||
val tileToColor = tileGroups.getValue(tile)
|
|
||||||
tileToColor.showCircle(Color.RED, 0.3f)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val attackableTiles: List<AttackableTile> = if (unit.type.isCivilian()) listOf()
|
val attackableTiles: List<AttackableTile> = if (unit.type.isCivilian()) listOf()
|
||||||
else {
|
else {
|
||||||
BattleHelper.getAttackableEnemies(unit, unit.movement.getDistanceToTiles())
|
BattleHelper.getAttackableEnemies(unit, unit.movement.getDistanceToTiles())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user