mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-16 10:49:17 +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 {
|
internal fun tryUpgradeUnit(unit: MapUnit): Boolean {
|
||||||
val upgradesTo = unit.baseUnit().upgradesTo
|
if (unit.baseUnit.upgradesTo == null) return false
|
||||||
if (upgradesTo == null) return false
|
val upgradedUnit = unit.getUnitToUpgradeTo()
|
||||||
|
if (!upgradedUnit.isBuildable(unit.civInfo)) return false // for resource reasons, usually
|
||||||
val upgradedUnit = unit.civInfo.gameInfo.ruleSet.units.getValue(upgradesTo)
|
|
||||||
if (!upgradedUnit.isBuildable(unit.civInfo)) return false
|
|
||||||
|
|
||||||
val upgradeAction = UnitActions.getUpgradeAction(unit)
|
val upgradeAction = UnitActions.getUpgradeAction(unit)
|
||||||
if (upgradeAction == null) return false
|
if (upgradeAction == null) return false
|
||||||
|
Reference in New Issue
Block a user