From 7a59cbcbe88417a0ee1d26a4b46a362ff16042d1 Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Tue, 21 Sep 2021 19:18:02 +0200 Subject: [PATCH] Fixed bug where a unit auto-exploring ancient ruins would in some cases disappear after upgrading (#5285) --- core/src/com/unciv/logic/automation/UnitAutomation.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/automation/UnitAutomation.kt b/core/src/com/unciv/logic/automation/UnitAutomation.kt index 14ef3748dc..ba6d2782c7 100644 --- a/core/src/com/unciv/logic/automation/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/UnitAutomation.kt @@ -24,7 +24,7 @@ object UnitAutomation { } internal fun tryExplore(unit: MapUnit): Boolean { - if (tryGoToRuinAndEncampment(unit) && unit.currentMovement == 0f) return true + if (tryGoToRuinAndEncampment(unit) && (unit.currentMovement == 0f || unit.isDestroyed)) return true val explorableTilesThisTurn = unit.movement.getDistanceToTiles().keys.filter { isGoodTileToExplore(unit, it) } @@ -503,8 +503,7 @@ object UnitAutomation { /** This is what a unit with the 'explore' action does. It also explores, but also has other functions, like healing if necessary. */ fun automatedExplore(unit: MapUnit) { - if (tryGoToRuinAndEncampment(unit) && unit.currentMovement == 0f) return - if (unit.isDestroyed) return // Opening ruins _might_ have upgraded us to another unit + if (tryGoToRuinAndEncampment(unit) && (unit.currentMovement == 0f || unit.isDestroyed)) return if (unit.health < 80 && tryHealUnit(unit)) return if (tryExplore(unit)) return unit.civInfo.addNotification("${unit.shortDisplayName()} finished exploring.", unit.currentTile.position, unit.name, "OtherIcons/Sleep")