Added Neuschwanstein wonder - part of #245

This commit is contained in:
Yair Morgenstern 2019-04-09 16:27:12 +03:00
parent 472c370c8f
commit 7fa24a8f17
10 changed files with 240 additions and 210 deletions

View File

@ -213,6 +213,7 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
* [Statue of Liberty](https://thenounproject.com/search/?q=statue%20of%20liberty&i=1801199) By 1516 * [Statue of Liberty](https://thenounproject.com/search/?q=statue%20of%20liberty&i=1801199) By 1516
* [Christ the redeemer](https://thenounproject.com/term/christ-the-redeemer/56112/) By Stefan Spieler for Cristo Redentor * [Christ the redeemer](https://thenounproject.com/term/christ-the-redeemer/56112/) By Stefan Spieler for Cristo Redentor
* [St. Petersburg](https://thenounproject.com/search/?q=kremlin&i=1569704) By Carpe Diem for Kremlin * [St. Petersburg](https://thenounproject.com/search/?q=kremlin&i=1569704) By Carpe Diem for Kremlin
* [Neuschwanstein](https://thenounproject.com/search/?q=Neuschwanstein&i=2107683) By Vectors Market
### Information Era ### Information Era

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 953 KiB

After

Width:  |  Height:  |  Size: 955 KiB

View File

@ -630,6 +630,15 @@
uniques:["Defensive buildings in all cities are 25% more effective"], uniques:["Defensive buildings in all cities are 25% more effective"],
requiredTech:"Railroad" requiredTech:"Railroad"
}, },
{
name:"Neuschwanstein",
happiness:2,
culture:4,
gold:6,
isWonder:true,
uniques:["+1 happiness, +2 culture and +3 gold from every Castle"],
requiredTech:"Railroad"
},
// Information Era // Information Era

View File

@ -6049,6 +6049,9 @@
Italian:"+25% efficacia delle strutture difensive in tutte le città" Italian:"+25% efficacia delle strutture difensive in tutte le città"
} }
"Neuschwanstein":{}
"+1 happiness, +2 culture and +3 gold from every Castle":{}
"Military Academy":{ "Military Academy":{
Italian:"Accademia militare" Italian:"Accademia militare"
Russian:"Военная академия" Russian:"Военная академия"

View File

@ -38,7 +38,7 @@ class CityConstructions {
fun getStats(): Stats { fun getStats(): Stats {
val stats = Stats() val stats = Stats()
for (building in getBuiltBuildings()) for (building in getBuiltBuildings())
stats.add(building.getStats(cityInfo.civInfo.policies.adoptedPolicies)) stats.add(building.getStats(cityInfo.civInfo))
stats.science += (cityInfo.getBuildingUniques().count { it == "+1 Science Per 2 Population" } * cityInfo.population.population / 2).toFloat() stats.science += (cityInfo.getBuildingUniques().count { it == "+1 Science Per 2 Population" } * cityInfo.population.population / 2).toFloat()
return stats return stats
} }

View File

@ -2,6 +2,7 @@ package com.unciv.models.gamebasics
import com.unciv.logic.city.CityConstructions import com.unciv.logic.city.CityConstructions
import com.unciv.logic.city.IConstruction import com.unciv.logic.city.IConstruction
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.models.gamebasics.tech.Technology import com.unciv.models.gamebasics.tech.Technology
import com.unciv.models.stats.NamedStats import com.unciv.models.stats.NamedStats
import com.unciv.models.stats.Stats import com.unciv.models.stats.Stats
@ -10,7 +11,7 @@ import com.unciv.ui.utils.getRandom
class Building : NamedStats(), IConstruction{ class Building : NamedStats(), IConstruction{
override val description: String override val description: String
get() = getDescription(false, hashSetOf()) get() = getDescription(false, null)
var requiredTech: String? = null var requiredTech: String? = null
@ -50,7 +51,7 @@ class Building : NamedStats(), IConstruction{
fun getShortDescription(): String { // should fit in one line fun getShortDescription(): String { // should fit in one line
val infoList= mutableListOf<String>() val infoList= mutableListOf<String>()
val str = getStats(hashSetOf()).toString() val str = getStats(null).toString()
if(str.isNotEmpty()) infoList += str if(str.isNotEmpty()) infoList += str
if(percentStatBonus!=null){ if(percentStatBonus!=null){
for(stat in percentStatBonus!!.toHashMap()) for(stat in percentStatBonus!!.toHashMap())
@ -70,8 +71,8 @@ class Building : NamedStats(), IConstruction{
return infoList.joinToString() return infoList.joinToString()
} }
fun getDescription(forBuildingPickerScreen: Boolean, adoptedPolicies: HashSet<String>): String { fun getDescription(forBuildingPickerScreen: Boolean, civInfo: CivilizationInfo?): String {
val stats = getStats(adoptedPolicies) val stats = getStats(civInfo)
val stringBuilder = StringBuilder() val stringBuilder = StringBuilder()
if(uniqueTo!=null) stringBuilder.appendln("Unique to [$uniqueTo], replaces [$replaces]".tr()) if(uniqueTo!=null) stringBuilder.appendln("Unique to [$uniqueTo], replaces [$replaces]".tr())
if (!forBuildingPickerScreen) stringBuilder.appendln("{Cost}: $cost".tr()) if (!forBuildingPickerScreen) stringBuilder.appendln("{Cost}: $cost".tr())
@ -118,8 +119,11 @@ class Building : NamedStats(), IConstruction{
} }
val cultureBuildings = hashSetOf("Monument", "Temple", "Monastery") val cultureBuildings = hashSetOf("Monument", "Temple", "Monastery")
fun getStats(adoptedPolicies: HashSet<String>): Stats {
fun getStats(civInfo: CivilizationInfo?): Stats {
val stats = this.clone() val stats = this.clone()
if(civInfo != null) {
val adoptedPolicies = civInfo.policies.adoptedPolicies
if (adoptedPolicies.contains("Organized Religion") && cultureBuildings.contains(name)) if (adoptedPolicies.contains("Organized Religion") && cultureBuildings.contains(name))
stats.happiness += 1 stats.happiness += 1
@ -133,7 +137,7 @@ class Building : NamedStats(), IConstruction{
stats.happiness += 1f stats.happiness += 1f
if (adoptedPolicies.contains("Theocracy") && name == "Temple") if (adoptedPolicies.contains("Theocracy") && name == "Temple")
percentStatBonus = Stats().apply { gold=10f } percentStatBonus = Stats().apply { gold = 10f }
if (adoptedPolicies.contains("Free Thought") && name == "University") if (adoptedPolicies.contains("Free Thought") && name == "University")
percentStatBonus!!.science = 50f percentStatBonus!!.science = 50f
@ -144,9 +148,15 @@ class Building : NamedStats(), IConstruction{
if (adoptedPolicies.contains("Constitution") && isWonder) if (adoptedPolicies.contains("Constitution") && isWonder)
stats.culture += 2f stats.culture += 2f
if(adoptedPolicies.contains("Autocracy Complete") && cityStrength>0) if (adoptedPolicies.contains("Autocracy Complete") && cityStrength > 0)
stats.happiness+=1 stats.happiness += 1
if (name == "Castle" && civInfo.getBuildingUniques().contains("+1 happiness, +2 culture and +3 gold from every Castle")){
stats.happiness+=1
stats.culture+=2
stats.gold+=3
}
}
return stats return stats
} }

View File

@ -60,7 +60,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
wonderDetailsTable.clear() wonderDetailsTable.clear()
else{ else{
val detailsString = building.getDescription(true, val detailsString = building.getDescription(true,
cityScreen.city.civInfo.policies.adoptedPolicies) cityScreen.city.civInfo)
wonderDetailsTable.add(detailsString.toLabel().apply { setWrap(true)}) wonderDetailsTable.add(detailsString.toLabel().apply { setWrap(true)})
.width(cityScreen.stage.width/4 - 2*pad ).row() // when you set wrap, then you need to manually set the size of the label .width(cityScreen.stage.width/4 - 2*pad ).row() // when you set wrap, then you need to manually set the size of the label
if(!building.isWonder) { if(!building.isWonder) {

View File

@ -170,7 +170,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
if (currentConstruction is BaseUnit) if (currentConstruction is BaseUnit)
description = currentConstruction.getDescription(true) description = currentConstruction.getDescription(true)
else if (currentConstruction is Building) else if (currentConstruction is Building)
description = currentConstruction.getDescription(true, city.civInfo.policies.adoptedPolicies) description = currentConstruction.getDescription(true, city.civInfo)
else description = currentConstruction.description.tr() else description = currentConstruction.description.tr()
val descriptionLabel = description.toLabel() val descriptionLabel = description.toLabel()