diff --git a/android/assets/jsons/Buildings.json b/android/assets/jsons/Buildings.json index cabb1b00b0..e73d883e3f 100644 --- a/android/assets/jsons/Buildings.json +++ b/android/assets/jsons/Buildings.json @@ -61,6 +61,15 @@ unique:"+1 Science Per 2 Population", requiredTech:"Writing" }, + { + name:"Paper Maker", + replaces:"Library", + uniqueTo:"China", + hurryCostModifier:25, + gold:2, + unique:"+1 Science Per 2 Population", + requiredTech:"Writing" + }, { name:"Circus", requiredNearbyImprovedResources:["Ivory","Horses"] diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index 0547dfc6ad..3d01ea6623 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -32,6 +32,8 @@ class Building : NamedStats(), IConstruction{ var cityStrength=0 var cityHealth=0 var xpForNewUnits=0 + var replaces:String?=null + var uniqueTo:String?=null // Uniques var providesFreeBuilding: String? = null @@ -99,6 +101,7 @@ class Building : NamedStats(), IConstruction{ fun getDescription(forBuildingPickerScreen: Boolean, adoptedPolicies: HashSet): String { val stats = getStats(adoptedPolicies) val stringBuilder = StringBuilder() + if(uniqueTo!=null) stringBuilder.appendln("Unique to $uniqueTo, replaces $replaces") if (!forBuildingPickerScreen) stringBuilder.appendln("{Cost}: $cost".tr()) if (isWonder) stringBuilder.appendln("Wonder".tr()) if (!forBuildingPickerScreen && requiredTech != null) @@ -159,7 +162,10 @@ class Building : NamedStats(), IConstruction{ it.cityConstructions.isBuilding(name) || it.cityConstructions.isBuilt(name) }) return false - if (requiredBuilding != null && !construction.isBuilt(requiredBuilding!!)) return false + if (uniqueTo!=null && uniqueTo!=civInfo.civName) return false + if (GameBasics.Buildings.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return false + if (requiredBuilding != null && !construction.isBuilt(requiredBuilding!!) + && construction.getBuiltBuildings().none{it.replaces==requiredBuilding}) return false if (requiredBuildingInAllCities != null && civInfo.cities.any { !it.cityConstructions.isBuilt(requiredBuildingInAllCities!!) }) return false if(requiredBuildingInAllCities!=null && civInfo.cities.any { diff --git a/core/src/com/unciv/models/gamebasics/tech/Technology.kt b/core/src/com/unciv/models/gamebasics/tech/Technology.kt index e000a6f1b0..65f84de1bf 100644 --- a/core/src/com/unciv/models/gamebasics/tech/Technology.kt +++ b/core/src/com/unciv/models/gamebasics/tech/Technology.kt @@ -24,7 +24,9 @@ class Technology : ICivilopedia { enabledUnits = enabledUnits.filter { it.name !in replacedUnits} if(enabledUnits.isNotEmpty()) SB.appendln("{Units enabled}: "+enabledUnits.map { it.name.tr() + " ("+it.getShortDescription()+")" }.joinToString()) - val enabledBuildings = GameBasics.Buildings.values.filter { it.requiredTech==name } + var enabledBuildings = GameBasics.Buildings.values.filter { it.requiredTech==name && (it.uniqueTo==null || it.uniqueTo==UnCivGame.Current.gameInfo.getPlayerCivilization().civName) } + val replacedBuildings = enabledBuildings.map { it.replaces }.filterNotNull() + enabledBuildings = enabledBuildings.filter { it.name !in replacedBuildings } val regularBuildings = enabledBuildings.filter { !it.isWonder } if(regularBuildings.isNotEmpty()) SB.appendln("{Buildings enabled}: "+regularBuildings.map { "\n * "+it.name.tr() + " ("+it.getShortDescription()+")" }.joinToString())