From 65f884cb54767b799214c907aea76d0d11c17510 Mon Sep 17 00:00:00 2001 From: Oskar Niesen Date: Wed, 16 Aug 2023 09:59:30 -0500 Subject: [PATCH] Nuke blast simulation no longer shows invisible units. (#9913) * Nuke blast simulation no longer shows invisible units. * Changed code to look better. * Improved readability. --- core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt index 66d601e6eb..c5a4721c82 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt @@ -695,7 +695,9 @@ class WorldMapHolder( val attackableTiles: List = if (nukeBlastRadius >= 0) selectedTile!!.getTilesInDistance(nukeBlastRadius) - .filter { it.getFirstUnit() != null } + // Should not display invisible submarine units even if the tile is visible. + .filter { targetTile -> (targetTile.isVisible(unit.civ) && targetTile.getUnits().any { !it.isInvisible(unit.civ) }) + || (targetTile.isCityCenter() && unit.civ.hasExplored(targetTile)) } .map { AttackableTile(unit.getTile(), it, 1f, null) } .toList() else BattleHelper.getAttackableEnemies(unit, unit.movement.getDistanceToTiles())