Civ-wide uniques for city-wide resources

This commit is contained in:
Yair Morgenstern 2024-02-27 19:38:14 +02:00
parent 04528696f7
commit 4f5fdf1727
2 changed files with 9 additions and 5 deletions

View File

@ -21,7 +21,7 @@ object CityResources {
manageCityResourcesRequiredByBuildings(city, cityResources)
getCityResourcesFromUniqueBuildings(city, cityResources, resourceModifer)
getCityResourcesFromCiv(city, cityResources, resourceModifer)
if (city.civ.isCityState() && city.isCapital() && city.civ.cityStateResource != null) {
cityResources.add(
@ -33,7 +33,6 @@ object CityResources {
return cityResources
}
/** Gets the number of resources available to this city
* Accommodates both city-wide and civ-wide resources */
fun getResourceAmount(city: City, resourceName: String): Int {
@ -82,9 +81,9 @@ object CityResources {
}
}
private fun getCityResourcesFromUniqueBuildings(city: City, cityResources: ResourceSupplyList, resourceModifer: HashMap<String, Float>) {
for (unique in city.cityConstructions.builtBuildingUniqueMap
.getMatchingUniques(UniqueType.ProvidesResources, StateForConditionals(city.civ, city))) { // E.G "Provides [1] [Iron]"
private fun getCityResourcesFromCiv(city: City, cityResources: ResourceSupplyList, resourceModifer: HashMap<String, Float>) {
// This includes the uniques from buildings, from this and all other cities
for (unique in city.civ.getMatchingUniques(UniqueType.ProvidesResources, StateForConditionals(city.civ, city))) { // E.G "Provides [1] [Iron]"
val resource = city.getRuleset().tileResources[unique.params[1]]
?: continue
cityResources.add(

View File

@ -2084,6 +2084,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
Applicable to: Conditional
??? example "&lt;in cities with [amount] [populationFilter]&gt;"
Example: "&lt;in cities with [3] [Followers of this Religion]&gt;"
Applicable to: Conditional
??? example "&lt;with a garrison&gt;"
Applicable to: Conditional