Add iHasUniques.techColumn() (#10595)

* Update IHasUniques.kt

* Update IHasUniques.kt

* Update IConstruction.kt

* Update IHasUniques.kt

* Update CivInfoTransientCache.kt

* Update UnitUpgradeManager.kt

* Update WonderOverviewTab.kt

* Update IHasUniques.kt

* Update IHasUniques.kt

* Update Ruleset.kt

* Update IHasUniques.kt

* Update IHasUniques.kt

* Update IHasUniques.kt

* Update IHasUniques.kt
This commit is contained in:
dHannasch 2023-12-03 13:14:28 -07:00 committed by GitHub
parent b9dd32597d
commit c142d1508c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -406,7 +406,7 @@ class Ruleset {
fun updateBuildingCosts() {
for (building in buildings.values) {
if (building.cost == -1 && building.getMatchingUniques(UniqueType.Unbuildable).none { it.conditionals.isEmpty() }) {
val column = technologies[building.requiredTech]?.column
val column = building.techColumn(this)
if (column != null) {
building.cost = if (building.isAnyWonder()) column.wonderCost else column.buildingCost
}

View File

@ -2,6 +2,7 @@ package com.unciv.models.ruleset.unique
import com.unciv.models.ruleset.Ruleset
import com.unciv.models.ruleset.tech.Era
import com.unciv.models.ruleset.tech.TechColumn
import com.unciv.models.ruleset.tech.Technology
import com.unciv.models.stats.INamed
@ -68,6 +69,10 @@ interface IHasUniques : INamed {
requiredTechnologies(ruleset).map{ it.era() }.map{ ruleset.eras[it]!! }.maxByOrNull{ it.eraNumber }
// This will return null only if requiredTechnologies() is empty.
fun techColumn(ruleset: Ruleset): TechColumn? =
requiredTechnologies(ruleset).map{ it.column }.filterNotNull().maxByOrNull{ it.columnNumber }
// This will return null only if *all* required techs have null TechColumn.
fun availableInEra(ruleset: Ruleset, requestedEra: String): Boolean {
val eraAvailable: Era? = era(ruleset)
if (eraAvailable == null)