From c5d81569f7a7545ad694fe314f613c685dc89fd9 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 3 Jun 2021 22:44:13 +0300 Subject: [PATCH] Removed some by-name references in construction automation --- .../com/unciv/logic/automation/ConstructionAutomation.kt | 9 +++------ core/src/com/unciv/models/ruleset/Building.kt | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt index 0f23dd392c..8af89c4cbd 100644 --- a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt +++ b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt @@ -259,7 +259,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){ private fun addScienceBuildingChoice() { if (allTechsAreResearched) return val scienceBuilding = buildableNotWonders.asSequence() - .filter { it.isStatRelated(Stat.Science) || it.name == "Library" } // only stat related in unique + .filter { it.isStatRelated(Stat.Science) } .minByOrNull { it.cost } if (scienceBuilding != null) { var modifier = 1.1f @@ -282,10 +282,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){ val hasWaterResource = cityInfo.tilesInRange .any { it.isWater && it.resource!=null && it.position in cityInfo.tiles } val productionBuilding = buildableNotWonders.asSequence() - .filter { it.isStatRelated(Stat.Production) - || (hasWaterResource && (it.uniques.contains("+1 production and gold from all sea resources worked by the city") - || it.uniques.contains("+1 production from all sea resources worked by the city")) ) - } + .filter { it.isStatRelated(Stat.Production) } .minByOrNull { it.cost } if (productionBuilding != null) { addChoice(relativeCostEffectiveness, productionBuilding.name, 1.5f) @@ -294,7 +291,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){ private fun addFoodBuildingChoice() { val foodBuilding = buildableNotWonders.asSequence().filter { it.isStatRelated(Stat.Food) - || it.getBaseBuilding(civInfo.gameInfo.ruleSet).name == "Aqueduct" || it.getBaseBuilding(civInfo.gameInfo.ruleSet).name == "Medical Lab"} // only stat related in unique + || it.uniqueObjects.any { it.placeholderText=="[]% of food is carried over after population increases" }} .minByOrNull { it.cost } if (foodBuilding != null) { var modifier = 1f diff --git a/core/src/com/unciv/models/ruleset/Building.kt b/core/src/com/unciv/models/ruleset/Building.kt index 9f1854483e..f030940f9b 100644 --- a/core/src/com/unciv/models/ruleset/Building.kt +++ b/core/src/com/unciv/models/ruleset/Building.kt @@ -458,6 +458,7 @@ class Building : NamedStats(), IConstruction { if (get(stat) > 0) return true if (getStatPercentageBonuses(null).get(stat) > 0) return true if (resourceBonusStats != null && resourceBonusStats!!.get(stat) > 0) return true + if (uniqueObjects.any { it.placeholderText == "[] Per [] Population in this city" && it.stats.get(stat) > 0 }) return true return false }