Minor style updates (#11154)

* Properly Calculate Population based on Food Conversion to Prod
Trigger properly when Queue is changed

* Remove triggers

* Missed a trigger

* Add triggers in CityConstructionsTable so we can call cityScreen.update()

* Properly Calculate Population based on Food Conversion to Prod
Trigger properly when Queue is changed

* Remove triggers

* Missed a trigger

* Add triggers in CityConstructionsTable so we can call cityScreen.update()

* Minor style cleanups

* Properly Calculate Population based on Food Conversion to Prod
Trigger properly when Queue is changed

* Remove triggers

* Missed a trigger

* Properly Calculate Population based on Food Conversion to Prod
Trigger properly when Queue is changed

* Remove triggers

* Missed a trigger

* Minor style cleanups
This commit is contained in:
itanasi 2024-02-19 11:46:57 -08:00 committed by GitHub
parent 6c87bef1cf
commit d3356c94fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -63,7 +63,7 @@ object Automation {
val surplusFood = cityStats[Stat.Food]
// If current Production converts Food into Production, then calculate increased Production Yield
if(cityStatsObj.canConvertFoodToProduction(surplusFood, city.cityConstructions.getCurrentConstruction())) {
if (cityStatsObj.canConvertFoodToProduction(surplusFood, city.cityConstructions.getCurrentConstruction())) {
// calculate delta increase of food->prod. This isn't linear
yieldStats.production += cityStatsObj.getProductionFromExcessiveFood(surplusFood+yieldStats.food) - cityStatsObj.getProductionFromExcessiveFood(surplusFood)
yieldStats.food = 0f // all food goes to 0

View File

@ -606,8 +606,13 @@ class CityStats(val city: City) {
&& currentConstruction.hasUnique(UniqueType.ConvertFoodToProductionWhenConstructed))
}
// calculate the conversion of the excessive food to the production
// See for details: https://civilization.fandom.com/wiki/Settler_(Civ5)
/**
* Calculate the conversion of the excessive food to production when
* [UniqueType.ConvertFoodToProductionWhenConstructed] is at front of the build queue
* @param food is amount of excess Food generates this turn
* See for details: https://civilization.fandom.com/wiki/Settler_(Civ5)
* @see calcFoodEaten as well for Food consumed this turn
*/
fun getProductionFromExcessiveFood(food : Float): Float {
return if (food >= 4.0f ) 2.0f + (food / 4.0f).toInt()
else if (food >= 2.0f ) 2.0f