From e296604b2480b57a9a253d995f9087149e55aee3 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 18 Apr 2022 11:54:48 +0300 Subject: [PATCH] Resolved #6560 - unpillagable improvements removed entirely on nuke --- core/src/com/unciv/logic/battle/Battle.kt | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 1b55d3ef7d..20bfa3337d 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -733,20 +733,23 @@ object Battle { // Pillage improvements, remove roads, add fallout if (tile.improvement != null && !tile.getTileImprovement()!!.hasUnique(UniqueType.Indestructible)) { - tile.turnsToImprovement = 2 - tile.improvementInProgress = tile.improvement - tile.improvement = null + if (tile.getTileImprovement()!!.hasUnique(UniqueType.Unpillagable)) { + tile.improvement = null + } else { + tile.turnsToImprovement = 2 + tile.improvementInProgress = tile.improvement + tile.improvement = null + } } tile.roadStatus = RoadStatus.None if (tile.isLand && !tile.isImpassible()) { if (tile.hasUnique(UniqueType.DestroyableByNukesChance)) { for (terrainFeature in tile.terrainFeatureObjects) { - for (unique in terrainFeature.getMatchingUniques(UniqueType.DestroyableByNukesChance)) { - if (Random().nextFloat() < unique.params[0].toFloat() / 100f) { - tile.removeTerrainFeature(terrainFeature.name) - if (!tile.terrainFeatures.contains("Fallout") && !tile.hasUnique(UniqueType.Indestructible)) - tile.addTerrainFeature("Fallout") - } + for (unique in terrainFeature.getMatchingUniques(UniqueType.DestroyableByNukesChance)) { + if (Random().nextFloat() >= unique.params[0].toFloat() / 100f) continue + tile.removeTerrainFeature(terrainFeature.name) + if (!tile.terrainFeatures.contains("Fallout") && !tile.hasUnique(UniqueType.Indestructible)) + tile.addTerrainFeature("Fallout") } } } else if (Random().nextFloat() < 0.5f && !tile.terrainFeatures.contains("Fallout") && !tile.hasUnique(UniqueType.Indestructible)) {