mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
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
@ -139,7 +139,7 @@
|
|||||||
"gold": 5,
|
"gold": 5,
|
||||||
"greatPersonPoints": {"gold": 1},
|
"greatPersonPoints": {"gold": 1},
|
||||||
"isWonder": true,
|
"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",
|
"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"
|
"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",
|
"name": "Harbor",
|
||||||
"maintenance": 2,
|
"maintenance": 2,
|
||||||
"hurryCostModifier": 25,
|
"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"],
|
"Connects trade routes over water","Can only be built in coastal cities"],
|
||||||
"requiredTech": "Compass"
|
"requiredTech": "Compass"
|
||||||
},
|
},
|
||||||
@ -658,7 +658,7 @@
|
|||||||
"hurryCostModifier": 25,
|
"hurryCostModifier": 25,
|
||||||
"maintenance": 2,
|
"maintenance": 2,
|
||||||
"requiredBuilding": "Harbor",
|
"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"],
|
"Can only be built in coastal cities", "+[15]% production when building [naval units] in this city"],
|
||||||
"requiredTech": "Navigation"
|
"requiredTech": "Navigation"
|
||||||
},
|
},
|
||||||
|
@ -195,7 +195,6 @@ Sun Never Sets =
|
|||||||
Ancien Régime =
|
Ancien Régime =
|
||||||
|
|
||||||
Strategic Resources provide +1 Production, and Horses, Iron and Uranium Resources provide double quantity =
|
Strategic Resources provide +1 Production, and Horses, Iron and Uranium Resources provide double quantity =
|
||||||
Strategic resources =
|
|
||||||
Siberian Riches =
|
Siberian Riches =
|
||||||
|
|
||||||
+25% Production towards any buildings that already exist in the Capital =
|
+25% Production towards any buildings that already exist in the Capital =
|
||||||
@ -682,6 +681,7 @@ Policies =
|
|||||||
Base happiness =
|
Base happiness =
|
||||||
Occupied City =
|
Occupied City =
|
||||||
Buildings =
|
Buildings =
|
||||||
|
|
||||||
# For the "when constructing [military units]" translation
|
# For the "when constructing [military units]" translation
|
||||||
military units =
|
military units =
|
||||||
melee units =
|
melee units =
|
||||||
@ -689,6 +689,11 @@ mounted units =
|
|||||||
naval units =
|
naval units =
|
||||||
# For the All "newly-trained [relevant] units in this city receive the [] promotion" translation. Relevant as in 'units that can receive'
|
# For the All "newly-trained [relevant] units in this city receive the [] promotion" translation. Relevant as in 'units that can receive'
|
||||||
relevant =
|
relevant =
|
||||||
|
# For '[stats] from [Water] tiles in this city'
|
||||||
|
Water =
|
||||||
|
# For [stats] from [Water resource] tiles in this city
|
||||||
|
Water resource =
|
||||||
|
|
||||||
Wonders =
|
Wonders =
|
||||||
Base values =
|
Base values =
|
||||||
Bonuses =
|
Bonuses =
|
||||||
|
@ -177,20 +177,19 @@ open class TileInfo {
|
|||||||
stats.add(terrainFeatureBase)
|
stats.add(terrainFeatureBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
// City-specific bonuses
|
if (city != null) {
|
||||||
if(city!=null) for(unique in city.cityConstructions.builtBuildingUniqueMap.getUniques("[] from [] tiles in this city")) {
|
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]
|
val tileType = unique.params[1]
|
||||||
if (baseTerrain == tileType || terrainFeature == tileType
|
if (baseTerrain == tileType || terrainFeature == tileType
|
||||||
|| resource == tileType || improvement == 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]))
|
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 (naturalWonder != null) {
|
if (naturalWonder != null) {
|
||||||
@ -210,23 +209,12 @@ open class TileInfo {
|
|||||||
val resourceBuilding = tileMap.gameInfo.ruleSet.buildings[resource.building!!]!!
|
val resourceBuilding = tileMap.gameInfo.ruleSet.buildings[resource.building!!]!!
|
||||||
stats.add(resourceBuilding.resourceBonusStats!!) // resource-specific building (eg forge, stable) bonus
|
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()
|
val improvement = getTileImprovement()
|
||||||
if (improvement != null)
|
if (improvement != null)
|
||||||
stats.add(getImprovementStats(improvement, observingCiv, city))
|
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 (isCityCenter()) {
|
||||||
if (stats.food < 2) stats.food = 2f
|
if (stats.food < 2) stats.food = 2f
|
||||||
if (stats.production < 1) stats.production = 1f
|
if (stats.production < 1) stats.production = 1f
|
||||||
@ -250,11 +238,16 @@ open class TileInfo {
|
|||||||
if (improvement.improvingTech != null && observingCiv.tech.isResearched(improvement.improvingTech!!))
|
if (improvement.improvingTech != null && observingCiv.tech.isResearched(improvement.improvingTech!!))
|
||||||
stats.add(improvement.improvingTechStats!!) // eg Chemistry for mines
|
stats.add(improvement.improvingTechStats!!) // eg Chemistry for mines
|
||||||
|
|
||||||
if(city!=null)
|
|
||||||
for(unique in city.civInfo.getMatchingUniques("[] from every []")) {
|
if(city!=null) {
|
||||||
if (improvement.name == unique.params[1] || (unique.params[1]=="Great Improvement" && improvement.isGreatImprovement()))
|
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]))
|
stats.add(Stats.parse(unique.params[0]))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (containsGreatImprovement()
|
if (containsGreatImprovement()
|
||||||
&& observingCiv.hasUnique("Tile yield from Great Improvements +100%"))
|
&& observingCiv.hasUnique("Tile yield from Great Improvements +100%"))
|
||||||
|
@ -17,7 +17,7 @@ class UniqueMap:HashMap<String, ArrayList<Unique>>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getUniques(placeholderText: String): List<Unique> {
|
fun getUniques(placeholderText: String): List<Unique> {
|
||||||
val result = this.get(placeholderText)
|
val result = this[placeholderText]
|
||||||
if (result == null) return listOf()
|
if (result == null) return listOf()
|
||||||
else return result
|
else return result
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user