mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
Add TechManager.isObsolete(unit) (#10659)
* Update TechManager.kt * Update CityStateFunctions.kt
This commit is contained in:
parent
8a03f9df12
commit
47e6b788af
@ -94,7 +94,7 @@ class CityStateFunctions(val civInfo: Civilization) {
|
||||
?: return null
|
||||
if (!receivingCiv.tech.isResearched(uniqueUnit))
|
||||
return null
|
||||
if (uniqueUnit.obsoleteTech != null && receivingCiv.tech.isResearched(uniqueUnit.obsoleteTech!!))
|
||||
if (receivingCiv.tech.isObsolete(uniqueUnit))
|
||||
return null
|
||||
return uniqueUnit
|
||||
}
|
||||
|
@ -157,6 +157,8 @@ class TechManager : IsPartOfGameInfoSerialization {
|
||||
|
||||
fun isResearched(construction: INonPerpetualConstruction): Boolean = construction.requiredTechs().all{ requiredTech -> isResearched(requiredTech) }
|
||||
|
||||
fun isObsolete(unit: BaseUnit): Boolean = unit.techsThatObsoleteThis().any{ obsoleteTech -> isResearched(obsoleteTech) }
|
||||
|
||||
fun canBeResearched(techName: String): Boolean {
|
||||
val tech = getRuleset().technologies[techName]!!
|
||||
if (tech.uniqueObjects.any { it.type == UniqueType.OnlyAvailableWhen && !it.conditionalsApply(civInfo) })
|
||||
|
Loading…
Reference in New Issue
Block a user