mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-15 10:18:26 +07:00
Fixed AI unit upgrading - can now 'skip' over intermediate units, the way the "promote unit" action works. #3115
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user