Fixed AI unit upgrading - can now 'skip' over intermediate units, the way the "promote unit" action works. #3115
This commit is contained in:
parent
10b0d498c6
commit
9ba9dd6fcf
1 changed files with 3 additions and 5 deletions
|
@ -73,11 +73,9 @@ object UnitAutomation {
|
|||
}
|
||||
|
||||
internal fun tryUpgradeUnit(unit: MapUnit): Boolean {
|
||||
val upgradesTo = unit.baseUnit().upgradesTo
|
||||
if (upgradesTo == null) return false
|
||||
|
||||
val upgradedUnit = unit.civInfo.gameInfo.ruleSet.units.getValue(upgradesTo)
|
||||
if (!upgradedUnit.isBuildable(unit.civInfo)) return false
|
||||
if (unit.baseUnit.upgradesTo == null) return false
|
||||
val upgradedUnit = unit.getUnitToUpgradeTo()
|
||||
if (!upgradedUnit.isBuildable(unit.civInfo)) return false // for resource reasons, usually
|
||||
|
||||
val upgradeAction = UnitActions.getUpgradeAction(unit)
|
||||
if (upgradeAction == null) return false
|
||||
|
|
Loading…
Reference in a new issue