Hill city-strength bonus genericized

This commit is contained in:
Yair Morgenstern 2021-05-06 14:27:12 +03:00
parent 7686b1ee4a
commit 8d2629088f
3 changed files with 9 additions and 5 deletions

View File

@ -85,7 +85,7 @@
"defenceBonus": 0.25,
"RGB": [105,125,72],
"occursOn": ["Tundra","Plains","Grassland","Desert","Snow"],
"uniques": ["Rough terrain"]
"uniques": ["Rough terrain", "+[5] Strength for cities built on this terrain"]
},
{
"name": "Forest",

View File

@ -4,6 +4,7 @@
"Hill": ["Grassland","Hill"],
"Hill+Forest+Uranium": ["Grassland","Hill","Uranium","HillForest"],
"Grassland+Hill+Forest+Uranium": ["Grassland","Hill","Uranium","HillForest"],
"Grassland+Jungle+Oil": ["Grassland","Oil","GrasslandJungle"],
@ -15,6 +16,9 @@
"Grassland+Forest+Furs": ["Grassland","Furs","GrasslandForest"],
"Hill+Forest+Furs": ["Grassland","Hill","Furs","HillForest"],
"Hill+Forest+Deer": ["Grassland","Hill","Deer","HillForest"],
"Grassland+Hill+Forest+Furs": ["Grassland","Hill","Furs","HillForest"],
"Grassland+Hill+Forest+Deer": ["Grassland","Hill","Deer","HillForest"],
"Tundra+Hill+Forest+Deer": ["Tundra","Hill","Deer","HillForest"],
"Grassland+Hill+Forest": ["Grassland","Hill","HillForest"],
"Plains+Hill+Forest": ["Plains","Hill","HillForest"],
@ -22,13 +26,11 @@
"Desert+Hill+Forest": ["Desert","Hill","HillForest"],
"Snow+Hill+Forest": ["Snow","Hill","HillForest"],
"Hill+Furs+Ancient ruins": ["Grassland","Hill","Ancient ruins","Sheep"],
"Grassland+Jungle+Ancient ruins": ["Grassland","Ancient ruins", "GrasslandJungle"],
"Grassland+Forest+Ancient ruins": ["Grassland","Ancient ruins", "GrasslandForest"],
"Grassland+Cattle+Ancient ruins": ["Grassland","Ancient ruins","Cattle"],
"Grassland+Sheep+Ancient ruins": ["Grassland","Ancient ruins","Sheep"],
"Hill+Sheep+Ancient ruins": ["Grassland","Hill","Ancient ruins","Sheep"],
"Plains+Forest+Deer": ["Plains","Deer","PlainsForest"]
}
}

View File

@ -38,7 +38,9 @@ class CityCombatant(val city: CityInfo) : ICombatant {
var strength = 8f
strength += (city.population.population / 5) * 2 // Each 5 pop gives 2 defence
val cityTile = city.getCenterTile()
if (cityTile.isHill()) strength += 5
for (unique in cityTile.getAllTerrains().flatMap { it.uniqueObjects })
if (unique.placeholderText == "+[] Strength for cities built on this terrain")
strength += unique.params[0].toInt()
// as tech progresses so does city strength
val techCount = getCivInfo().gameInfo.ruleSet.technologies.count()
val techsPercentKnown: Float = if (techCount > 0) city.civInfo.tech.techsResearched.count().toFloat() / techCount else 0.5f // for mods with no tech
@ -63,4 +65,4 @@ class CityCombatant(val city: CityInfo) : ICombatant {
}
override fun toString() = city.name // for debug
}
}