Fixed _very_ old inconsitency that broke my game :( (#4442)

This commit is contained in:
Xander Lenstra 2021-07-09 18:15:16 +02:00 committed by GitHub
parent d262c1a6ea
commit 0c916e85fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -441,7 +441,7 @@ class CityStats {
for (entry in newFinalStatList.values) { for (entry in newFinalStatList.values) {
entry.gold *= 1 + statPercentBonusesSum.gold / 100 entry.gold *= 1 + statPercentBonusesSum.gold / 100
entry.culture *= 1 + statPercentBonusesSum.culture / 100 entry.culture *= 1 + statPercentBonusesSum.culture / 100
if (!isUnhappy) entry.food *= 1 + statPercentBonusesSum.food / 100 // Regular food bonus revoked when unhappy per https://forums.civfanatics.com/resources/complete-guide-to-happiness-vanilla.25584/ entry.food *= 1 + statPercentBonusesSum.food / 100
} }
// AFTER we've gotten all the gold stats figured out, only THEN do we plonk that gold into Science // AFTER we've gotten all the gold stats figured out, only THEN do we plonk that gold into Science
@ -479,9 +479,9 @@ class CityStats {
totalFood = newFinalStatList.values.map { it.food }.sum() // recalculate because of previous change totalFood = newFinalStatList.values.map { it.food }.sum() // recalculate because of previous change
// Since growth bonuses are special, (applied afterwards) they will be displayed separately in the user interface as well. // Since growth bonuses are special, (applied afterwards) they will be displayed separately in the user interface as well.
if (totalFood > 0) { if (totalFood > 0 && !isUnhappy) { // Percentage Growth bonus revoked when unhappy per https://forums.civfanatics.com/resources/complete-guide-to-happiness-vanilla.25584/
val foodFromGrowthBonuses = getGrowthBonusFromPoliciesAndWonders() * totalFood val foodFromGrowthBonuses = getGrowthBonusFromPoliciesAndWonders() * totalFood
newFinalStatList["Policies"]!!.food += foodFromGrowthBonuses newFinalStatList["Policies"]!!.food += foodFromGrowthBonuses // Why Policies? Wonders can also provide this?
totalFood = newFinalStatList.values.map { it.food }.sum() // recalculate again totalFood = newFinalStatList.values.map { it.food }.sum() // recalculate again
} }