mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
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:
parent
b9dd32597d
commit
c142d1508c
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user