From 421cce0a4372d58b078707b308256b04e7a29afa Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Mon, 9 Aug 2021 12:57:13 +0200 Subject: [PATCH] Fixed crash when selecting certain buildings in the civilopedia (#4819) (cherry picked from commit 6d04bf424bbfcf2ee940a248e1ee8f01dc997858) --- android/assets/jsons/Civ V - Vanilla/Buildings.json | 8 ++++---- core/src/com/unciv/models/ruleset/Building.kt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/android/assets/jsons/Civ V - Vanilla/Buildings.json b/android/assets/jsons/Civ V - Vanilla/Buildings.json index 8c6e9e1157..f7d472202c 100644 --- a/android/assets/jsons/Civ V - Vanilla/Buildings.json +++ b/android/assets/jsons/Civ V - Vanilla/Buildings.json @@ -1125,14 +1125,14 @@ "culture": 3, "happiness": 1, "specialistSlots": {"Artist": 1}, - "uniques": ["Unbuildable"] + "uniques": ["Unbuildable", "Hidden when religion is disabled"] }, { "name": "Monastery", "cost": 0, "culture": 2, "faith": 2, - "uniques": ["[+1 Culture, +1 Faith] from [Wine] tiles [in this city]", + "uniques": ["[+1 Culture, +1 Faith] from [Wine] tiles [in this city]", "Hidden when religion is disabled", "[+1 Culture, +1 Faith] from [Incense] tiles [in this city]","Unbuildable"] }, { @@ -1141,7 +1141,7 @@ "culture": 2, "faith": 3, "happiness": 1, - "uniques": ["Unbuildable"] + "uniques": ["Unbuildable", "Hidden when religion is disabled"] }, { "name": "Pagoda", @@ -1149,6 +1149,6 @@ "culture": 2, "faith": 2, "happiness": 2, - "uniques": ["Unbuildable"] + "uniques": ["Unbuildable", "Hidden when religion is disabled"] }, ] diff --git a/core/src/com/unciv/models/ruleset/Building.kt b/core/src/com/unciv/models/ruleset/Building.kt index 8fa82946b2..28163dfd65 100644 --- a/core/src/com/unciv/models/ruleset/Building.kt +++ b/core/src/com/unciv/models/ruleset/Building.kt @@ -203,7 +203,7 @@ class Building : NamedStats(), INonPerpetualConstruction, ICivilopediaText { override fun canBePurchasedWithStat(cityInfo: CityInfo, stat: Stat, ignoreCityRequirements: Boolean): Boolean { if (stat == Stat.Gold && isAnyWonder()) return false // May buy [buildingFilter] buildings for [amount] [Stat] [cityFilter] - if (cityInfo.getMatchingUniques("May buy [] buildings for [] [] []") + if (!ignoreCityRequirements && cityInfo.getMatchingUniques("May buy [] buildings for [] [] []") .any { it.params[2] == stat.name && matchesFilter(it.params[0]) && cityInfo.matchesFilter(it.params[3]) } ) return true return super.canBePurchasedWithStat(cityInfo, stat, ignoreCityRequirements)