From 8826c4e84f3b2969169f6daf1f9dd6ea16a860e3 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 27 Nov 2019 21:15:16 +0200 Subject: [PATCH] Resolved #1372 - AI should now build spaceship parts and be able to win a scientific victory =) --- .../unciv/logic/automation/ConstructionAutomation.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt index adb9cfa653..002287e64c 100644 --- a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt +++ b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt @@ -58,6 +58,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){ addDefenceBuildingChoice() addUnitTrainingBuildingChoice() addCultureBuildingChoice() + addSpaceshipPartChoice() if(!cityInfo.isPuppet) { addWondersChoice() @@ -136,6 +137,17 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){ } } + private fun addSpaceshipPartChoice() { + val spaceshipPart = buildableNotWonders.firstOrNull { it.uniques.contains("Spaceship part") } + if (spaceshipPart != null) { + var modifier = 1.5f + if(cityInfo.cityStats.currentCityStats.culture==0f) // It won't grow if we don't help it + modifier=0.8f + if (preferredVictoryType == VictoryType.Scientific) modifier = 2f + addChoice(relativeCostEffectiveness, spaceshipPart.name, modifier) + } + } + private fun addWondersChoice() { if (buildableWonders.isNotEmpty()) { fun getWonderPriority(wonder: Building): Float {