Generified more building uniques and merged functionality of global and city uniques when alculating tile stats
This commit is contained in:
parent
42b5b3f16c
commit
270c50afd6
4 changed files with 31 additions and 33 deletions
|
@ -139,7 +139,7 @@
|
|||
"gold": 5,
|
||||
"greatPersonPoints": {"gold": 1},
|
||||
"isWonder": true,
|
||||
"uniques": ["Can only be built in coastal cities", "+1 gold from worked water tiles in city"],
|
||||
"uniques": ["Can only be built in coastal cities", "[+1 Gold] from [Water] tiles in this city"],
|
||||
"requiredTech": "Iron Working",
|
||||
"quote": "'Why man, he doth bestride the narrow world like a colossus, and we petty men walk under his huge legs, and peep about to find ourselves dishonorable graves.' - William Shakespeare, Julius Caesar"
|
||||
},
|
||||
|
@ -427,7 +427,7 @@
|
|||
"name": "Harbor",
|
||||
"maintenance": 2,
|
||||
"hurryCostModifier": 25,
|
||||
"uniques": ["+1 production from all sea resources worked by the city",
|
||||
"uniques": ["[+1 Production] from [Water resource] tiles in this city",
|
||||
"Connects trade routes over water","Can only be built in coastal cities"],
|
||||
"requiredTech": "Compass"
|
||||
},
|
||||
|
@ -658,7 +658,7 @@
|
|||
"hurryCostModifier": 25,
|
||||
"maintenance": 2,
|
||||
"requiredBuilding": "Harbor",
|
||||
"uniques": ["+1 production and gold from all sea resources worked by the city",
|
||||
"uniques": ["[+1 Production, +1 Gold] from [Water resource] tiles in this city",
|
||||
"Can only be built in coastal cities", "+[15]% production when building [naval units] in this city"],
|
||||
"requiredTech": "Navigation"
|
||||
},
|
||||
|
|
|
@ -195,7 +195,6 @@ Sun Never Sets =
|
|||
Ancien Régime =
|
||||
|
||||
Strategic Resources provide +1 Production, and Horses, Iron and Uranium Resources provide double quantity =
|
||||
Strategic resources =
|
||||
Siberian Riches =
|
||||
|
||||
+25% Production towards any buildings that already exist in the Capital =
|
||||
|
@ -682,6 +681,7 @@ Policies =
|
|||
Base happiness =
|
||||
Occupied City =
|
||||
Buildings =
|
||||
|
||||
# For the "when constructing [military units]" translation
|
||||
military units =
|
||||
melee units =
|
||||
|
@ -689,6 +689,11 @@ mounted units =
|
|||
naval units =
|
||||
# For the All "newly-trained [relevant] units in this city receive the [] promotion" translation. Relevant as in 'units that can receive'
|
||||
relevant =
|
||||
# For '[stats] from [Water] tiles in this city'
|
||||
Water =
|
||||
# For [stats] from [Water resource] tiles in this city
|
||||
Water resource =
|
||||
|
||||
Wonders =
|
||||
Base values =
|
||||
Bonuses =
|
||||
|
|
|
@ -177,20 +177,19 @@ open class TileInfo {
|
|||
stats.add(terrainFeatureBase)
|
||||
}
|
||||
|
||||
// City-specific bonuses
|
||||
if(city!=null) for(unique in city.cityConstructions.builtBuildingUniqueMap.getUniques("[] from [] tiles in this city")) {
|
||||
val tileType = unique.params[1]
|
||||
if (baseTerrain == tileType || terrainFeature == tileType
|
||||
|| resource == tileType || improvement == tileType)
|
||||
stats.add(Stats.parse(unique.params[0]))
|
||||
}
|
||||
|
||||
// Civ-wide bonuses
|
||||
if(city!=null) for(unique in city.civInfo.getMatchingUniques("[] from every []")) {
|
||||
val tileType = unique.params[1]
|
||||
if (baseTerrain == tileType || terrainFeature == tileType
|
||||
|| (tileType == "Strategic resource" && hasViewableResource(observingCiv) && getTileResource().resourceType == ResourceType.Strategic))
|
||||
stats.add(Stats.parse(unique.params[0]))
|
||||
if (city != null) {
|
||||
val cityWideUniques = city.cityConstructions.builtBuildingUniqueMap.getUniques("[] from [] tiles in this city")
|
||||
val civWideUniques = city.civInfo.getMatchingUniques("[] from every []")
|
||||
for (unique in cityWideUniques + civWideUniques) {
|
||||
val tileType = unique.params[1]
|
||||
if (baseTerrain == tileType || terrainFeature == tileType
|
||||
|| resource == tileType
|
||||
|| (tileType == "Water" && isWater)
|
||||
|| (tileType == "Strategic resource" && hasViewableResource(observingCiv) && getTileResource().resourceType == ResourceType.Strategic)
|
||||
|| (tileType == "Water resource" && isWater && hasViewableResource(observingCiv))
|
||||
)
|
||||
stats.add(Stats.parse(unique.params[0]))
|
||||
}
|
||||
}
|
||||
|
||||
if (naturalWonder != null) {
|
||||
|
@ -210,23 +209,12 @@ open class TileInfo {
|
|||
val resourceBuilding = tileMap.gameInfo.ruleSet.buildings[resource.building!!]!!
|
||||
stats.add(resourceBuilding.resourceBonusStats!!) // resource-specific building (eg forge, stable) bonus
|
||||
}
|
||||
if (city != null && isWater) {
|
||||
if (city.containsBuildingUnique("+1 production from all sea resources worked by the city"))
|
||||
stats.production += 1
|
||||
if (city.containsBuildingUnique("+1 production and gold from all sea resources worked by the city")) {
|
||||
stats.production += 1
|
||||
stats.gold += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val improvement = getTileImprovement()
|
||||
if (improvement != null)
|
||||
stats.add(getImprovementStats(improvement, observingCiv, city))
|
||||
|
||||
if (city != null && isWater && city.containsBuildingUnique("+1 gold from worked water tiles in city"))
|
||||
stats.gold += 1
|
||||
|
||||
if (isCityCenter()) {
|
||||
if (stats.food < 2) stats.food = 2f
|
||||
if (stats.production < 1) stats.production = 1f
|
||||
|
@ -250,11 +238,16 @@ open class TileInfo {
|
|||
if (improvement.improvingTech != null && observingCiv.tech.isResearched(improvement.improvingTech!!))
|
||||
stats.add(improvement.improvingTechStats!!) // eg Chemistry for mines
|
||||
|
||||
if(city!=null)
|
||||
for(unique in city.civInfo.getMatchingUniques("[] from every []")) {
|
||||
if (improvement.name == unique.params[1] || (unique.params[1]=="Great Improvement" && improvement.isGreatImprovement()))
|
||||
|
||||
if(city!=null) {
|
||||
val cityWideUniques = city.cityConstructions.builtBuildingUniqueMap.getUniques("[] from [] tiles in this city")
|
||||
val civWideUniques = city.civInfo.getMatchingUniques("[] from every []")
|
||||
for (unique in cityWideUniques + civWideUniques) {
|
||||
if (improvement.name == unique.params[1]
|
||||
|| (unique.params[1] == "Great Improvement" && improvement.isGreatImprovement()))
|
||||
stats.add(Stats.parse(unique.params[0]))
|
||||
}
|
||||
}
|
||||
|
||||
if (containsGreatImprovement()
|
||||
&& observingCiv.hasUnique("Tile yield from Great Improvements +100%"))
|
||||
|
|
|
@ -17,7 +17,7 @@ class UniqueMap:HashMap<String, ArrayList<Unique>>() {
|
|||
}
|
||||
|
||||
fun getUniques(placeholderText: String): List<Unique> {
|
||||
val result = this.get(placeholderText)
|
||||
val result = this[placeholderText]
|
||||
if (result == null) return listOf()
|
||||
else return result
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue