From e11a32bb41ea533b52621190dd1d126ee4b822ca Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Sun, 17 Apr 2022 17:06:39 +0200 Subject: [PATCH] Fixed two small bugs (#6558) --- core/src/com/unciv/logic/civilization/CivilizationInfo.kt | 3 ++- core/src/com/unciv/logic/map/UnitPromotions.kt | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index ce57799ee4..4ce037ed8e 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -549,7 +549,8 @@ class CivilizationInfo { for ((key, value) in giftAmount) otherCiv.addStat(key, value.toInt()) - otherCiv.exploredTiles = otherCiv.exploredTiles.withItem(getCapital().location) + if (cities.isNotEmpty()) + otherCiv.exploredTiles = otherCiv.exploredTiles.withItem(getCapital().location) questManager.justMet(otherCiv) // Include them in war with major pseudo-quest } diff --git a/core/src/com/unciv/logic/map/UnitPromotions.kt b/core/src/com/unciv/logic/map/UnitPromotions.kt index 40e8a414d5..eaced7fc16 100644 --- a/core/src/com/unciv/logic/map/UnitPromotions.kt +++ b/core/src/com/unciv/logic/map/UnitPromotions.kt @@ -66,11 +66,14 @@ class UnitPromotions { val ruleset = unit.civInfo.gameInfo.ruleSet val promotion = ruleset.unitPromotions[promotionName]!! - doDirectPromotionEffects(promotion) if (!promotion.hasUnique("Doing so will consume this opportunity to choose a Promotion")) promotions.add(promotionName) + // If we upgrade this unit to its new version, we already need to have this promotion added, + // so this has to go after the `promotions.add(promotionname)` line. + doDirectPromotionEffects(promotion) + unit.updateUniques(ruleset) // Since some units get promotions upon construction, they will get the addPromotion from the unit.postBuildEvent