From ec1f51dfb8c934850d6a967d3f542daf1153553b Mon Sep 17 00:00:00 2001 From: SeventhM <127357473+SeventhM@users.noreply.github.com> Date: Sat, 17 Feb 2024 11:41:21 -0800 Subject: [PATCH] Allow barb camps to function after giving ruins effects (#11137) * Allow barb camps to function after giving ruins effects * Add comment --- core/src/com/unciv/logic/map/mapunit/MapUnit.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/map/mapunit/MapUnit.kt b/core/src/com/unciv/logic/map/mapunit/MapUnit.kt index 0812aea918..c07783aed8 100644 --- a/core/src/com/unciv/logic/map/mapunit/MapUnit.kt +++ b/core/src/com/unciv/logic/map/mapunit/MapUnit.kt @@ -802,14 +802,16 @@ class MapUnit : IsPartOfGameInfoSerialization { // addPromotion requires currentTile to be valid because it accesses ruleset through it. // getAncientRuinBonus, if it places a new unit, does too currentTile = tile + // The improvement may get removed if it has ruins effects or is a barbarian camp, and will still be needed if removed + val improvement = tile.improvement if (civ.isMajorCiv() - && tile.improvement != null - && tile.getTileImprovement()!!.isAncientRuinsEquivalent() + && improvement != null + && tile.ruleset.tileImprovements[improvement]!!.isAncientRuinsEquivalent() ) { getAncientRuinBonus(tile) } - if (tile.improvement == Constants.barbarianEncampment && !civ.isBarbarian()) + if (improvement == Constants.barbarianEncampment && !civ.isBarbarian()) clearEncampment(tile) // Check whether any civilians without military units are there. // Keep in mind that putInTile(), which calls this method,