Added paper maker as first unique building!

This commit is contained in:
Yair Morgenstern 2018-08-23 13:16:41 +03:00
parent 4fd9ac0f38
commit 8978d13cdc
3 changed files with 19 additions and 2 deletions

View File

@ -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"]

View File

@ -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>): 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 {

View File

@ -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())