From 099a2385c03150992467b0cde4b172c7f42bc4fb Mon Sep 17 00:00:00 2001 From: EmperorPinguin <99119424+EmperorPinguin@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:42:18 +0200 Subject: [PATCH] AI citizen focus change (#11908) * AI behaviour changes * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update ConstructionAutomation.kt * Update Automation.kt * Reverting some changes * Changes * revert changes * revert changes * revert changes * revert changes * Update CityLocationTileRanker.kt * Citizen assignment for stat conversion * Update CityLocationTileRanker.kt * Reduce AI settling * Avoid AI building units when in negative Supply * Update CityLocationTileRanker.kt * Update CityLocationTileRanker.kt * Update CityLocationTileRanker.kt * Update ConstructionAutomation.kt * Update build.gradle.kts * Update gradle-wrapper.properties * Update CityLocationTileRanker.kt * Update CityLocationTileRanker.kt * Update ConstructionAutomation.kt * Update CityLocationTileRanker.kt * AI changes for humans * Fix puppet focus * Update Automation.kt * Puppet focus * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update Automation.kt * Update Stats.kt * Update CityTurnManager.kt * Remove specialist science modifier --- .../com/unciv/logic/automation/Automation.kt | 39 +++++++++---------- core/src/com/unciv/models/stats/Stats.kt | 8 ++-- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/core/src/com/unciv/logic/automation/Automation.kt b/core/src/com/unciv/logic/automation/Automation.kt index 18d7fc4a55..22cf996004 100644 --- a/core/src/com/unciv/logic/automation/Automation.kt +++ b/core/src/com/unciv/logic/automation/Automation.kt @@ -82,31 +82,30 @@ object Automation { else yieldStats.food /= 2 } else if (!city.avoidGrowth) { - // NoFocus or Food/Growth Focus. Target +2 Food Surplus - if (surplusFood < 2) - yieldStats.food *= 8 - else if (city.population.population < 5) - yieldStats.food *= 3 + // NoFocus or Food/Growth Focus. Target +10 Food Surplus when happy + if (surplusFood < 0) + yieldStats.food *= 8 // Starving, need Food, get to 0 + else if (surplusFood < 10 && city.civ.getHappiness() > -1) + yieldStats.food *= 2 + else if (city.civ.getHappiness() < 0) { + // 75% of excess food is wasted when in negative happiness + yieldStats.food /= 4 + } } - if (city.population.population < 5) { + if (city.population.population < 10) { // "small city" - we care more about food and less about global problems like gold science and culture - // Food already handled above. Science/Culture have low weights in Stats already - yieldStats.gold /= 2 // it's barely worth anything at this point - } else { - if (city.civ.gold < 0 && city.civ.stats.statsForNextTurn.gold <= 0) - yieldStats.gold *= 2 // We have a global problem + // Food already handled above. Gold/Culture have low weights in Stats already + yieldStats.science /= 2 + } - if (city.tiles.size < 12) - yieldStats.culture *= 2 - - if (city.civ.getHappiness() < 0) - yieldStats.happiness *= 2 - } + if (city.civ.stats.statsForNextTurn.gold < 0) { + // We have a global problem, we need to deal with it before it leads to science loss + yieldStats.gold *= 2 + } if (city.civ.getHappiness() < 0) { - // 75% of excess food is wasted when in negative happiness - yieldStats.food /= 4 + yieldStats.happiness *= 2 } if (allTechsAreResearched) { @@ -115,7 +114,7 @@ object Automation { } if (city.cityConstructions.getCurrentConstruction() is PerpetualConstruction) { - // With 4:1 conversion of production to gold, production is overvalued by a factor (12*4)/8 = 6 + // With 4:1 conversion of production to science, production is overvalued by a factor (12*4)/7 = 6.9 yieldStats.production /= 6 } diff --git a/core/src/com/unciv/models/stats/Stats.kt b/core/src/com/unciv/models/stats/Stats.kt index 5f704140c6..2e122edd3d 100644 --- a/core/src/com/unciv/models/stats/Stats.kt +++ b/core/src/com/unciv/models/stats/Stats.kt @@ -148,11 +148,11 @@ open class Stats( fun applyRankingWeights() { food *= 14 production *= 12 - gold *= 8 // 3 gold worth about 2 production - science *= 7 - culture *= 6 + gold *= 6 // 2 gold worth about 1 production + science *= 9 + culture *= 8 happiness *= 10 // base - faith *= 5 + faith *= 7 } /** ***Not*** only a debug helper. It returns a string representing the content, already _translated_.