diff --git a/android/assets/jsons/Civ V - Vanilla/Buildings.json b/android/assets/jsons/Civ V - Vanilla/Buildings.json index 84c33765e9..2cb2702ba4 100644 --- a/android/assets/jsons/Civ V - Vanilla/Buildings.json +++ b/android/assets/jsons/Civ V - Vanilla/Buildings.json @@ -325,7 +325,7 @@ "name": "Aqueduct", "maintenance": 1, "hurryCostModifier": 25, - "uniques": ["40% of food is carried over after a new citizen is born"], + "uniques": ["[40]% of food is carried over after population increases"], "requiredTech": "Engineering" }, { @@ -845,7 +845,7 @@ "requiredBuilding": "Hospital", "maintenance": 3, "requiredTech": "Pharmaceuticals", - "uniques": ["25% of food is carried over after a new citizen is born"] + "uniques": ["[25]% of food is carried over after population increases"] }, { "name": "Nuclear Plant", diff --git a/core/src/com/unciv/logic/city/PopulationManager.kt b/core/src/com/unciv/logic/city/PopulationManager.kt index af50e83466..852d027cc5 100644 --- a/core/src/com/unciv/logic/city/PopulationManager.kt +++ b/core/src/com/unciv/logic/city/PopulationManager.kt @@ -47,12 +47,12 @@ class PopulationManager { fun nextTurn(food: Int) { foodStored += food - if(food < 0) - cityInfo.civInfo.addNotification("["+cityInfo.name + "] is starving!", cityInfo.location, Color.RED) + if (food < 0) + cityInfo.civInfo.addNotification("[" + cityInfo.name + "] is starving!", cityInfo.location, Color.RED) if (foodStored < 0) // starvation! { - if(population>1){ + if (population > 1) { population-- } foodStored = 0 @@ -61,11 +61,13 @@ class PopulationManager { // growth! { foodStored -= getFoodToNextPopulation() - if (cityInfo.containsBuildingUnique("40% of food is carried over after a new citizen is born")) foodStored += (0.4f * getFoodToNextPopulation()).toInt() // Aqueduct special - if (cityInfo.containsBuildingUnique("25% of food is carried over after a new citizen is born")) foodStored += (0.25f * getFoodToNextPopulation()).toInt() // Medical Lab special + val percentOfFoodCarriedOver = cityInfo.cityConstructions.builtBuildingUniqueMap + .getUniques("[]% of food is carried over after population increases") + .sumBy { it.params[0].toInt() } + foodStored += (getFoodToNextPopulation() * percentOfFoodCarriedOver / 100f).toInt() population++ autoAssignPopulation() - cityInfo.civInfo.addNotification("["+cityInfo.name + "] has grown!", cityInfo.location, Color.GREEN) + cityInfo.civInfo.addNotification("[" + cityInfo.name + "] has grown!", cityInfo.location, Color.GREEN) } }