mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Fixed bug where effects of all aquaducts nationwide stacked in each city (#4487)
* Fixed bug where effects of all aquaducts nationwide stacked in each city * Implemented requested changes * Implemented requested changes better
This commit is contained in:
parent
573eacb8c9
commit
07e3a2228e
@ -393,7 +393,7 @@
|
|||||||
"name": "Aqueduct",
|
"name": "Aqueduct",
|
||||||
"maintenance": 1,
|
"maintenance": 1,
|
||||||
"hurryCostModifier": 0,
|
"hurryCostModifier": 0,
|
||||||
"uniques": ["[40]% of food is carried over after population increases"],
|
"uniques": ["[40]% of food is carried over [in this city] after population increases"],
|
||||||
"requiredTech": "Engineering"
|
"requiredTech": "Engineering"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -978,7 +978,7 @@
|
|||||||
"requiredBuilding": "Hospital",
|
"requiredBuilding": "Hospital",
|
||||||
"maintenance": 3,
|
"maintenance": 3,
|
||||||
"requiredTech": "Pharmaceuticals",
|
"requiredTech": "Pharmaceuticals",
|
||||||
"uniques": ["[25]% of food is carried over after population increases"]
|
"uniques": ["[25]% of food is carried over [in this city] after population increases"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Manhattan Project",
|
"name": "Manhattan Project",
|
||||||
|
@ -60,9 +60,15 @@ class PopulationManager {
|
|||||||
if (foodStored >= getFoodToNextPopulation()) { // growth!
|
if (foodStored >= getFoodToNextPopulation()) { // growth!
|
||||||
foodStored -= getFoodToNextPopulation()
|
foodStored -= getFoodToNextPopulation()
|
||||||
var percentOfFoodCarriedOver = cityInfo
|
var percentOfFoodCarriedOver = cityInfo
|
||||||
.getMatchingUniques("[]% of food is carried over after population increases")
|
.getMatchingUniques("[]% of food is carried over [] after population increases")
|
||||||
|
.filter { cityInfo.matchesFilter(it.params[1]) }
|
||||||
|
.sumBy { it.params[0].toInt() }
|
||||||
|
// Deprecated since 3.15.11
|
||||||
|
percentOfFoodCarriedOver += cityInfo
|
||||||
|
.getLocalMatchingUniques("[]% of food is carried over after population increases")
|
||||||
.sumBy { it.params[0].toInt() }
|
.sumBy { it.params[0].toInt() }
|
||||||
// Try to avoid runaway food gain in mods, just in case mod makes don't notice it
|
//
|
||||||
|
// Try to avoid runaway food gain in mods, just in case
|
||||||
if (percentOfFoodCarriedOver > 95) percentOfFoodCarriedOver = 95
|
if (percentOfFoodCarriedOver > 95) percentOfFoodCarriedOver = 95
|
||||||
foodStored += (getFoodToNextPopulation() * percentOfFoodCarriedOver / 100f).toInt()
|
foodStored += (getFoodToNextPopulation() * percentOfFoodCarriedOver / 100f).toInt()
|
||||||
population++
|
population++
|
||||||
|
Loading…
x
Reference in New Issue
Block a user