From 899c5d48ea34000f28c70a6913094d93a619b2bd Mon Sep 17 00:00:00 2001 From: EmperorPinguin <99119424+EmperorPinguin@users.noreply.github.com> Date: Sun, 13 Oct 2024 21:32:26 +0200 Subject: [PATCH] Update Citizen Assignment and ConsoleLauncher.kt (#12267) * 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 * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update CivilianUnitAutomation.kt * Update ReligionAutomation.kt * Worker prioritization Workers are valuable in expand cities. * Update ConstructionAutomation.kt Food always important, it's rarely good to skip e.g. granary if we're on 6 pop. * Update ConstructionAutomation.kt Should achieve about the same with less lines of code. * Update Automation.kt * Update ConstructionAutomation.kt * Update Policies.json * Update Policies.json * Update Policies.json * Update ConstructionAutomation.kt * Update Policies.json * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Rename Crop Yield to Growth * Update worker usage * Update UnitAutomation.kt * Tutorials update * Update Tutorials.json * Fix spelling error * Update Tutorials.json * Update Tutorials.json * Update Tutorials.json * Update Tutorials.json * Update Tutorials.json * Update Tutorials.json * Update Tutorials.json * Update Tutorials.json * AI tech and policy choices * Update Techs.json * Update Policies.json * Update ConstructionAutomation.kt * Update UnitPromotions.json * Update * Update Policies.json * Update Tutorials.json * ReligionAutomation bugfix * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update ReligionAutomation.kt * Update AI city settling and science game * Update ReligionAutomation.kt * Maybe revert this now the belief picking has improved * Update ReligionAutomation.kt * Remove some if-statements * Update Automation.kt * Update Automation.kt * Update ConsoleLauncher.kt * Update * Update Automation.kt --- core/src/com/unciv/logic/automation/Automation.kt | 6 +++--- .../logic/automation/unit/CityLocationTileRanker.kt | 4 ---- desktop/src/com/unciv/app/desktop/ConsoleLauncher.kt | 9 ++++++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/core/src/com/unciv/logic/automation/Automation.kt b/core/src/com/unciv/logic/automation/Automation.kt index 39c701a8a9..88da18ccf2 100644 --- a/core/src/com/unciv/logic/automation/Automation.kt +++ b/core/src/com/unciv/logic/automation/Automation.kt @@ -82,11 +82,11 @@ object Automation { else if (city.civ.getHappiness() < 1) yieldStats.food /= 4 } else if (!city.avoidGrowth) { - // NoFocus or Food/Growth Focus. Target +10 Food Surplus when happy + // NoFocus or Food/Growth Focus. 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() > -1) + yieldStats.food *= 2 //1.5f is preferred, but 2 provides more protection against badly configured personalities else if (city.civ.getHappiness() < 0) { // 75% of excess food is wasted when in negative happiness yieldStats.food /= 4 diff --git a/core/src/com/unciv/logic/automation/unit/CityLocationTileRanker.kt b/core/src/com/unciv/logic/automation/unit/CityLocationTileRanker.kt index 1c771c5c27..6f40cd5296 100644 --- a/core/src/com/unciv/logic/automation/unit/CityLocationTileRanker.kt +++ b/core/src/com/unciv/logic/automation/unit/CityLocationTileRanker.kt @@ -154,8 +154,6 @@ object CityLocationTileRanker { var locationSpecificTileValue = 0f // Don't settle near but not on the coast if (rankTile.isCoastalTile() && !onCoast) locationSpecificTileValue -= 2 - // Apply the effect of having a lighthouse, since we can probably assume that we will build it - if (onCoast && rankTile.isOcean) locationSpecificTileValue += 1.2f //food is ranked at 1.2 points // Check if there are any new unique luxury resources if (rankTile.resource != null && rankTile.tileResource.resourceType == ResourceType.Luxury && !(civ.hasResource(rankTile.resource!!) || newUniqueLuxuryResources.contains(rankTile.resource))) { @@ -168,8 +166,6 @@ object CityLocationTileRanker { if (rankTile.getOwner() != null && rankTile.getOwner() != civ) return 0f var rankTileValue = Automation.rankStatsValue(rankTile.stats.getTileStats(null, civ, uniqueCache), civ) - // We can't build improvements on water tiles without resources - if (!rankTile.isLand) rankTileValue -= 1 if (rankTile.resource != null) { rankTileValue += when (rankTile.tileResource.resourceType) { diff --git a/desktop/src/com/unciv/app/desktop/ConsoleLauncher.kt b/desktop/src/com/unciv/app/desktop/ConsoleLauncher.kt index 5c4553c51c..0ea2383d0e 100644 --- a/desktop/src/com/unciv/app/desktop/ConsoleLauncher.kt +++ b/desktop/src/com/unciv/app/desktop/ConsoleLauncher.kt @@ -47,7 +47,8 @@ internal object ConsoleLauncher { ruleset.nations[simulationCiv1] = Nation().apply { name = simulationCiv1 } ruleset.nations[simulationCiv2] = Nation().apply { name = simulationCiv2 } - + //These names need PascalCase if applied in-game for testing (e.g. if (civInfo.civName == "SimulationCiv2")) + val gameParameters = getGameParameters(simulationCiv1, simulationCiv2) val mapParameters = getMapParameters() val gameSetupInfo = GameSetupInfo(gameParameters, mapParameters) @@ -56,7 +57,8 @@ internal object ConsoleLauncher { UncivGame.Current.gameInfo = newGame - val simulation = Simulation(newGame, 10, 4) + val simulation = Simulation(newGame, 50, 8) + //Unless the effect size is very large, you'll typically need a large number of games to get a statistically significant result simulation.start() } @@ -71,7 +73,8 @@ internal object ConsoleLauncher { private fun getGameParameters(civilization1: String, civilization2: String): GameParameters { return GameParameters().apply { - difficulty = "Chieftain" + difficulty = "Prince" + numberOfCityStates = 0 speed = Speed.DEFAULT noBarbarians = true players = ArrayList().apply {