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
* [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
* [Neuschwanstein](https://thenounproject.com/search/?q=Neuschwanstein&i=2107683) By Vectors Market
### 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"],
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

View File

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

View File

@ -38,7 +38,7 @@ class CityConstructions {
fun getStats(): Stats {
val stats = Stats()
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()
return stats
}

View File

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

View File

@ -60,7 +60,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
wonderDetailsTable.clear()
else{
val detailsString = building.getDescription(true,
cityScreen.city.civInfo.policies.adoptedPolicies)
cityScreen.city.civInfo)
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
if(!building.isWonder) {

View File

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