From 22f44d328b7163ab1017b81159a65e0bf8216004 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 14 Jun 2019 14:59:36 +0300 Subject: [PATCH] Building resource requirements now appear in Civilopedia --- core/src/com/unciv/logic/city/CityConstructions.kt | 2 +- core/src/com/unciv/models/gamebasics/Building.kt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index 2bf9f41e83..1c02b011fe 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -182,7 +182,7 @@ class CityConstructions { construction.postBuildEvent(this) inProgressConstructions.remove(currentConstruction) - if (construction is Building && construction.requiredBuildingInAllCities == null) { + if (construction is Building && construction.isWonder) { for (civ in cityInfo.civInfo.gameInfo.civilizations) { if (civ.exploredTiles.contains(cityInfo.location)) civ.addNotification("[$currentConstruction] has been built in [${cityInfo.name}]", cityInfo.location, Color.BROWN) diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index 26d286244d..fd64b92b5f 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -86,6 +86,8 @@ class Building : NamedStats(), IConstruction{ stringBuilder.appendln("Requires [$requiredBuilding] to be built in the city".tr()) if (!forBuildingPickerScreen && requiredBuildingInAllCities != null) stringBuilder.appendln("Requires [$requiredBuildingInAllCities] to be built in all cities".tr()) + if(requiredResource!=null) + stringBuilder.appendln("Requires [$requiredResource]".tr()) if (providesFreeBuilding != null) stringBuilder.appendln("Provides a free [$providesFreeBuilding] in the city".tr()) if(uniques.isNotEmpty()) stringBuilder.appendln(uniques.asSequence().map { it.tr() }.joinToString("\n")) @@ -238,7 +240,9 @@ class Building : NamedStats(), IConstruction{ if(isNationalWonder) { if (civInfo.cities.any {it.cityConstructions.isBuilt(name) }) return "National Wonder is already built" - if (civInfo.cities.any { !it.cityConstructions.containsBuildingOrEquivalent(requiredBuildingInAllCities!!) }) + if (requiredBuildingInAllCities!=null + && civInfo.cities.any { !it.cityConstructions + .containsBuildingOrEquivalent(requiredBuildingInAllCities!!) }) return "Requires a [$requiredBuildingInAllCities] in all cities" if (civInfo.cities.any {it!=construction.cityInfo && it.cityConstructions.isBeingConstructed(name) }) return "National Wonder is being built elsewhere"