Resolved #1372 - AI should now build spaceship parts and be able to win a scientific victory =)

This commit is contained in:
Yair Morgenstern
2019-11-27 21:15:16 +02:00
parent 8854cafc96
commit 8826c4e84f

View File

@ -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 {