mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-09 23:39:40 +07:00
All resource stats from buildings converted to building uniques
This commit is contained in:
@ -20,9 +20,11 @@
|
||||
{
|
||||
"name": "Granary",
|
||||
"food": 2,
|
||||
"resourceBonusStats": {"food": 1},
|
||||
"maintenance": 1,
|
||||
"hurryCostModifier": 25,
|
||||
"uniques": ["[+1 Food] from [Deer] tiles in this city",
|
||||
"[+1 Food] from [Bananas] tiles in this city",
|
||||
"[+1 Food] from [Wheat] tiles in this city"]
|
||||
"requiredTech": "Pottery"
|
||||
},
|
||||
{
|
||||
@ -30,10 +32,11 @@
|
||||
"happiness": 1,
|
||||
"production": 1,
|
||||
"requiredNearbyImprovedResources": ["Marble", "Stone"],
|
||||
"resourceBonusStats": {"production": 1},
|
||||
"maintenance": 1,
|
||||
"hurryCostModifier": 0,
|
||||
"uniques": ["Must not be on [Plains]"],
|
||||
"uniques": ["Must not be on [Plains]",
|
||||
"[+1 Production] from [Stone] tiles in this city",
|
||||
"[+1 Production] from [Marble] tiles in this city"],
|
||||
"requiredTech": "Calendar"
|
||||
},
|
||||
{
|
||||
@ -189,8 +192,8 @@
|
||||
"name": "Lighthouse",
|
||||
"hurryCostModifier": 25,
|
||||
"maintenance": 1,
|
||||
"resourceBonusStats": {"food": 1},
|
||||
"uniques": ["Must be next to [Coast]", "[+1 Food] from [Ocean] tiles in this city", "[+1 Food] from [Coast] tiles in this city"],
|
||||
"uniques": ["Must be next to [Coast]", "[+1 Food] from [Ocean] tiles in this city",
|
||||
"[+1 Food] from [Coast] tiles in this city", "[+1 Food] from [Fish] tiles in this city" ],
|
||||
"requiredTech": "Optics"
|
||||
},
|
||||
{
|
||||
@ -207,9 +210,11 @@
|
||||
"name": "Stable",
|
||||
"maintenance": 1,
|
||||
"requiredNearbyImprovedResources": ["Horses","Sheep","Cattle"],
|
||||
"resourceBonusStats": {"production": 1},
|
||||
"hurryCostModifier": 25,
|
||||
"uniques": ["+[15]% Production when constructing [Mounted] units [in this city]"]
|
||||
"uniques": ["+[15]% Production when constructing [Mounted] units [in this city]",
|
||||
"[+1 Production] from [Cattle] tiles in this city",
|
||||
"[+1 Production] from [Horses] tiles in this city",
|
||||
"[+1 Production] from [Sheep] tiles in this city"]
|
||||
"requiredTech": "Horseback Riding"
|
||||
},
|
||||
{
|
||||
@ -335,9 +340,9 @@
|
||||
{
|
||||
"name": "Mint",
|
||||
"maintenance": 0,
|
||||
"requiredNearbyImprovedResources": ["Gold","Silver"],
|
||||
"resourceBonusStats": {"gold": 2},
|
||||
"requiredNearbyImprovedResources": ["Gold", "Silver"]
|
||||
"hurryCostModifier": 25,
|
||||
"uniques": ["[+2 Gold] from [Gold] tiles in this city", "[+2 Gold] from [Silver] tiles in this city"],
|
||||
"requiredTech": "Currency"
|
||||
},
|
||||
/*
|
||||
@ -392,7 +397,7 @@
|
||||
"name": "Monastery",
|
||||
"maintenance": 0,
|
||||
"requiredNearbyImprovedResources": ["Wine","Incense"],
|
||||
"resourceBonusStats": {"culture": 2},
|
||||
"uniques": ["[+2 Culture] from [Wine] tiles in this city", "[+2 Culture] from [Incense] tiles in this city"],
|
||||
"hurryCostModifier": 25,
|
||||
"requiredTech": "Theology"
|
||||
},
|
||||
@ -461,10 +466,10 @@
|
||||
"maintenance": 1,
|
||||
"hurryCostModifier": 25,
|
||||
"requiredNearbyImprovedResources": ["Iron"],
|
||||
"resourceBonusStats": {"production": 1},
|
||||
"requiredTech": "Metal Casting",
|
||||
"uniques": ["+[15]% Production when constructing [Spaceship part] units [in this city]",
|
||||
"+[15]% Production when constructing [Land] units [in this city]"]
|
||||
"+[15]% Production when constructing [Land] units [in this city]",
|
||||
"[+1 Production] from [Iron] tiles in this city"]
|
||||
},
|
||||
{
|
||||
"name": "Harbor",
|
||||
|
@ -7,7 +7,6 @@
|
||||
"food": 1,
|
||||
"improvement": "Pasture",
|
||||
"improvementStats": {"production": 1},
|
||||
"building": "Stable"
|
||||
},
|
||||
{
|
||||
"name": "Sheep",
|
||||
@ -15,8 +14,7 @@
|
||||
"terrainsCanBeFoundOn": ["Plains","Hill"],
|
||||
"food": 1,
|
||||
"improvement": "Pasture",
|
||||
"improvementStats": {"food": 1},
|
||||
"building": "Stable"
|
||||
"improvementStats": {"food": 1}
|
||||
},
|
||||
{
|
||||
"name": "Deer",
|
||||
@ -24,8 +22,7 @@
|
||||
"terrainsCanBeFoundOn": ["Forest","Tundra"],
|
||||
"food": 1,
|
||||
"improvement": "Camp",
|
||||
"improvementStats": {"production": 1},
|
||||
"building": "Granary"
|
||||
"improvementStats": {"production": 1}
|
||||
},
|
||||
{
|
||||
"name": "Bananas",
|
||||
@ -33,8 +30,7 @@
|
||||
"terrainsCanBeFoundOn": ["Jungle"],
|
||||
"food": 1,
|
||||
"improvement": "Plantation",
|
||||
"improvementStats": {"food": 2,"production": -1},
|
||||
"building": "Granary"
|
||||
"improvementStats": {"food": 2,"production": -1}
|
||||
},
|
||||
{
|
||||
"name": "Wheat",
|
||||
@ -42,8 +38,7 @@
|
||||
"terrainsCanBeFoundOn": ["Plains","Flood plains","Desert"],
|
||||
"food": 1,
|
||||
"improvement": "Farm",
|
||||
"improvementStats": {"food": 1},
|
||||
"building": "Granary"
|
||||
"improvementStats": {"food": 1}
|
||||
},
|
||||
{
|
||||
"name": "Stone",
|
||||
@ -52,7 +47,6 @@
|
||||
"production": 1,
|
||||
"improvement": "Quarry",
|
||||
"improvementStats": {"production": 1},
|
||||
"building": "Stone Works"
|
||||
},
|
||||
{
|
||||
"name": "Fish",
|
||||
@ -60,8 +54,7 @@
|
||||
"terrainsCanBeFoundOn": ["Coast"],
|
||||
"food": 1,
|
||||
"improvement": "Fishing Boats",
|
||||
"improvementStats": {"food": 1},
|
||||
"building": "Lighthouse"
|
||||
"improvementStats": {"food": 1}
|
||||
},
|
||||
/*
|
||||
{
|
||||
@ -70,8 +63,7 @@
|
||||
"terrainsCanBeFoundOn": ["Plains","Grassland"],
|
||||
"food": 1,
|
||||
"improvement": "Camp",
|
||||
"improvementStats": {"food": 1},
|
||||
"building": "Granary"
|
||||
"improvementStats": {"food": 1}
|
||||
},
|
||||
*/
|
||||
|
||||
@ -83,8 +75,7 @@
|
||||
"terrainsCanBeFoundOn": ["Plains","Grassland","Hill","Desert"],
|
||||
"production": 1,
|
||||
"improvement": "Pasture",
|
||||
"improvementStats": {"production": 1},
|
||||
"building": "Stable"
|
||||
"improvementStats": {"production": 1}
|
||||
},
|
||||
{
|
||||
"name": "Iron",
|
||||
@ -93,8 +84,7 @@
|
||||
"terrainsCanBeFoundOn": ["Grassland","Plains","Desert","Tundra","Snow","Hill"],
|
||||
"production": 1,
|
||||
"improvement": "Mine",
|
||||
"improvementStats": {"production": 1},
|
||||
"building": "Forge"
|
||||
"improvementStats": {"production": 1}
|
||||
},
|
||||
{
|
||||
"name": "Coal",
|
||||
@ -172,8 +162,7 @@
|
||||
"terrainsCanBeFoundOn": ["Grassland","Plains","Desert","Hill"],
|
||||
"gold": 2,
|
||||
"improvement": "Mine",
|
||||
"improvementStats": {"gold": 1},
|
||||
"building": "Mint"
|
||||
"improvementStats": {"gold": 1}
|
||||
},
|
||||
{
|
||||
"name": "Silver",
|
||||
@ -181,8 +170,7 @@
|
||||
"terrainsCanBeFoundOn": ["Desert","Tundra","Hill"],
|
||||
"gold": 2,
|
||||
"improvement": "Mine",
|
||||
"improvementStats": {"gold": 1},
|
||||
"building": "Mint"
|
||||
"improvementStats": {"gold": 1}
|
||||
},
|
||||
{
|
||||
"name": "Incense",
|
||||
@ -190,8 +178,7 @@
|
||||
"terrainsCanBeFoundOn": ["Plains","Desert"],
|
||||
"gold": 2,
|
||||
"improvement": "Plantation",
|
||||
"improvementStats": {"gold": 1},
|
||||
"building": "Monastery"
|
||||
"improvementStats": {"gold": 1}
|
||||
},
|
||||
{
|
||||
"name": "Ivory",
|
||||
@ -223,8 +210,7 @@
|
||||
"terrainsCanBeFoundOn": ["Grassland","Plains"],
|
||||
"gold": 2,
|
||||
"improvement": "Plantation",
|
||||
"improvementStats": {"gold": 1},
|
||||
"building": "Monastery"
|
||||
"improvementStats": {"gold": 1}
|
||||
},
|
||||
{
|
||||
"name": "Sugar",
|
||||
@ -241,8 +227,7 @@
|
||||
"gold": 2,
|
||||
"improvement": "Quarry",
|
||||
"improvementStats": {"gold": 1,"production": 1},
|
||||
"unique": "+15% production towards Wonder construction",
|
||||
"building": "Stone Works"
|
||||
"unique": "+15% production towards Wonder construction"
|
||||
},
|
||||
{
|
||||
"name": "Whales",
|
||||
@ -270,7 +255,6 @@
|
||||
"gold": 1,
|
||||
"improvement": "Plantation",
|
||||
"improvementStats": {"food": 1,"gold": 1},
|
||||
"building": "Granary"
|
||||
},
|
||||
{
|
||||
"name": "Copper",
|
||||
|
@ -8,6 +8,7 @@ import com.unciv.models.ruleset.tile.TileImprovement
|
||||
import com.unciv.models.stats.NamedStats
|
||||
import com.unciv.models.stats.Stat
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.models.translations.fillPlaceholders
|
||||
import com.unciv.models.translations.tr
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
@ -66,6 +67,7 @@ class Building : NamedStats(), IConstruction {
|
||||
/**
|
||||
* The bonus stats that a resource gets when this building is built
|
||||
*/
|
||||
@Deprecated("Since 3.13.3 - replaced with '[stats] from [resource] tiles in this city'")
|
||||
var resourceBonusStats: Stats? = null
|
||||
|
||||
fun getShortDescription(ruleset: Ruleset): String { // should fit in one line
|
||||
@ -75,21 +77,35 @@ class Building : NamedStats(), IConstruction {
|
||||
for (stat in getStatPercentageBonuses(null).toHashMap())
|
||||
if (stat.value != 0f) infoList += "+${stat.value.toInt()}% ${stat.key.toString().tr()}"
|
||||
|
||||
val improvedResources = ruleset.tileResources.values.filter { it.building == name }.map { it.name.tr() }
|
||||
if (improvedResources.isNotEmpty()) {
|
||||
val improvedResources = ruleset.tileResources.values.asSequence().filter { it.building == name }.map { it.name.tr() }
|
||||
if (improvedResources.any()) {
|
||||
// buildings that improve resources
|
||||
infoList += improvedResources.joinToString() + " {provide} ".tr() + resourceBonusStats.toString()
|
||||
infoList += improvedResources.joinToString() + " {provide} " + resourceBonusStats.toString()
|
||||
}
|
||||
if (requiredNearbyImprovedResources != null)
|
||||
infoList += ("Requires worked [" + requiredNearbyImprovedResources!!.joinToString("/") { it.tr() } + "] near city").tr()
|
||||
infoList += "Requires worked [" + requiredNearbyImprovedResources!!.joinToString("/") { it.tr() } + "] near city"
|
||||
if (uniques.isNotEmpty()) {
|
||||
if (replacementTextForUniques != "") infoList += replacementTextForUniques
|
||||
else infoList += uniques.joinToString { it.tr() }
|
||||
else infoList += getUniquesStrings()
|
||||
}
|
||||
if (cityStrength != 0) infoList += "{City strength} +".tr() + cityStrength
|
||||
if (cityHealth != 0) infoList += "{City health} +".tr() + cityHealth
|
||||
if (xpForNewUnits != 0) infoList += "+$xpForNewUnits {XP for new units}".tr()
|
||||
return infoList.joinToString()
|
||||
if (cityStrength != 0) infoList += "{City strength} +$cityStrength"
|
||||
if (cityHealth != 0) infoList += "{City health} +$cityHealth"
|
||||
if (xpForNewUnits != 0) infoList += "+$xpForNewUnits {XP for new units}"
|
||||
return infoList.joinToString("; ") { it.tr() }
|
||||
}
|
||||
|
||||
fun getUniquesStrings(): ArrayList<String> {
|
||||
val tileBonusHashmap = HashMap<String, ArrayList<String>>()
|
||||
val finalUniques = ArrayList<String>()
|
||||
for (unique in uniqueObjects)
|
||||
if (unique.placeholderText == "[] from [] tiles in this city") {
|
||||
val stats = unique.params[0]
|
||||
if (!tileBonusHashmap.containsKey(stats)) tileBonusHashmap[stats] = ArrayList()
|
||||
tileBonusHashmap[stats]!!.add(unique.params[1])
|
||||
} else finalUniques += unique.text
|
||||
for ((key, value) in tileBonusHashmap)
|
||||
finalUniques += "[stats] from [tileFilter] tiles in this city".fillPlaceholders(key, value.joinToString { it.tr() })
|
||||
return finalUniques
|
||||
}
|
||||
|
||||
fun getDescription(forBuildingPickerScreen: Boolean, civInfo: CivilizationInfo?, ruleset: Ruleset): String {
|
||||
@ -113,10 +129,10 @@ class Building : NamedStats(), IConstruction {
|
||||
stringBuilder.appendLine("Provides a free [$providesFreeBuilding] in the city".tr())
|
||||
if (uniques.isNotEmpty()) {
|
||||
if (replacementTextForUniques != "") stringBuilder.appendLine(replacementTextForUniques)
|
||||
else stringBuilder.appendLine(uniques.asSequence().map { it.tr() }.joinToString("\n"))
|
||||
else stringBuilder.appendLine(getUniquesStrings().asSequence().map { it.tr() }.joinToString("\n"))
|
||||
}
|
||||
if (!stats.isEmpty())
|
||||
stringBuilder.appendln(stats)
|
||||
stringBuilder.appendLine(stats.toString())
|
||||
|
||||
val percentStats = getStatPercentageBonuses(civInfo)
|
||||
if (percentStats.production != 0f) stringBuilder.append("+" + percentStats.production.toInt() + "% {Production}\n".tr())
|
||||
|
@ -15,7 +15,9 @@ class TileResource : NamedStats() {
|
||||
|
||||
/**
|
||||
* The building that improves this resource, if any. E.G.: Granary for wheat, Stable for cattle.
|
||||
*
|
||||
*/
|
||||
@Deprecated("Since 3.13.3 - replaced with '[stats] from [resource] tiles in this city' unique in the building")
|
||||
var building: String? = null
|
||||
var revealedBy: String? = null
|
||||
var unique: String? = null
|
||||
|
Reference in New Issue
Block a user