mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-10 15:59:33 +07:00
Genericized "No Maintenance costs for improvements in [] tiles"
This commit is contained in:
@ -637,7 +637,7 @@
|
|||||||
"uniqueName": "Great Andean Road",
|
"uniqueName": "Great Andean Road",
|
||||||
"uniques": ["Units ignore terrain costs when moving into any tile with Hills",
|
"uniques": ["Units ignore terrain costs when moving into any tile with Hills",
|
||||||
"Maintenance on roads & railroads reduced by [50]%",
|
"Maintenance on roads & railroads reduced by [50]%",
|
||||||
"No Maintenance costs for improvements in Hills"],
|
"No Maintenance costs for improvements in [Hill] tiles"],
|
||||||
"cities": ["Cuzco","Tiwanaku","Machu","Ollantaytambo","Corihuayrachina","Huamanga","Rumicucho","Vilcabamba","Vitcos",
|
"cities": ["Cuzco","Tiwanaku","Machu","Ollantaytambo","Corihuayrachina","Huamanga","Rumicucho","Vilcabamba","Vitcos",
|
||||||
"Andahuaylas","Ica","Arequipa","Nasca","Atico","Juli","Chuito","Chuquiapo","Huanuco Pampa","Tamboccocha",
|
"Andahuaylas","Ica","Arequipa","Nasca","Atico","Juli","Chuito","Chuquiapo","Huanuco Pampa","Tamboccocha",
|
||||||
"Huaras","Riobamba","Caxamalca","Sausa","Tambo Colorado","Huaca","Tumbes","Chan Chan","Sipan","Pachacamac",
|
"Huaras","Riobamba","Caxamalca","Sausa","Tambo Colorado","Huaca","Tumbes","Chan Chan","Sipan","Pachacamac",
|
||||||
|
@ -48,21 +48,14 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
|
|||||||
// we no longer use .flatMap, because there are a lot of tiles and keeping them all in a list
|
// we no longer use .flatMap, because there are a lot of tiles and keeping them all in a list
|
||||||
// just to go over them once is a waste of memory - there are low-end phones who don't have much ram
|
// just to go over them once is a waste of memory - there are low-end phones who don't have much ram
|
||||||
|
|
||||||
val ignoredTileTypes = civInfo.getMatchingUniques("No Maintenance costs for improvements in []")
|
val ignoredTileTypes = civInfo.getMatchingUniques("No Maintenance costs for improvements in [] tiles")
|
||||||
.map { it.params[0] }.toHashSet() // needs to be .toHashSet()ed,
|
.map { it.params[0] }.toHashSet() // needs to be .toHashSet()ed,
|
||||||
// Because we go over every tile in every city and check if it's in this list, which can get real heavy.
|
// Because we go over every tile in every city and check if it's in this list, which can get real heavy.
|
||||||
|
|
||||||
// accounting for both the old way and the new way of doing no maintenance in hills
|
|
||||||
val ignoreHillTiles = civInfo.hasUnique("No Maintenance costs for improvements in Hills") || "Hills" in ignoredTileTypes
|
|
||||||
|
|
||||||
for (city in civInfo.cities) {
|
for (city in civInfo.cities) {
|
||||||
for (tile in city.getTiles()) {
|
for (tile in city.getTiles()) {
|
||||||
if (tile.isCityCenter()) continue
|
if (tile.isCityCenter()) continue
|
||||||
if (ignoreHillTiles && tile.isHill()) continue
|
if (ignoredTileTypes.any { tile.matchesUniqueFilter(it, civInfo) }) continue
|
||||||
|
|
||||||
if (tile.terrainFeatures.any { it in ignoredTileTypes } || tile.baseTerrain in ignoredTileTypes) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
val tileUpkeep =
|
val tileUpkeep =
|
||||||
when (tile.roadStatus) {
|
when (tile.roadStatus) {
|
||||||
@ -103,7 +96,7 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
|
|||||||
val sciencePercentage = civInfo
|
val sciencePercentage = civInfo
|
||||||
.getMatchingUniques("Allied City-States provide Science equal to []% of what they produce for themselves")
|
.getMatchingUniques("Allied City-States provide Science equal to []% of what they produce for themselves")
|
||||||
.sumBy { it.params[0].toInt() }
|
.sumBy { it.params[0].toInt() }
|
||||||
statMap.add("City-States",Stats().apply { science = otherCiv.statsForNextTurn.science * (sciencePercentage/100f) })
|
statMap.add("City-States", Stats().apply { science = otherCiv.statsForNextTurn.science * (sciencePercentage / 100f) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user