From 37b4bcbda8951202ada93d6fbc580afa4e468af9 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Fri, 19 Jul 2024 17:49:23 +0300 Subject: [PATCH] Okay that was dumb --- core/src/com/unciv/logic/city/CityConstructions.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index 0cc63c93b9..46cad12644 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -699,13 +699,15 @@ class CityConstructions : IsPartOfGameInfoSerialization { } - /** This tests whether the buy button should be _enabled_ */ + /** This is the *one true test* of "can we buty this construction" + * This tests whether the buy button should be _enabled_ */ fun isConstructionPurchaseAllowed(construction: INonPerpetualConstruction, stat: Stat, constructionBuyCost: Int): Boolean { return when { city.isPuppet && !city.getMatchingUniques(UniqueType.MayBuyConstructionsInPuppets).any() -> false city.isInResistance() -> false !construction.isPurchasable(city.cityConstructions) -> false // checks via 'rejection reason' construction is BaseUnit && !city.canPlaceNewUnit(construction) -> false + !construction.canBePurchasedWithStat(city, stat) -> false city.civ.gameInfo.gameParameters.godMode -> true constructionBuyCost == 0 -> true else -> city.getStatReserve(stat) >= constructionBuyCost