Moved AI unit upgrade into "use gold" function, so it is prioritized *over* purchasing new constructions

This commit is contained in:
yairm210
2024-09-07 22:48:04 +03:00
parent 9c0e9131f0
commit eff0a5bebb
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package com.unciv.logic.automation.civilization
import com.unciv.logic.automation.unit.UnitAutomation
import com.unciv.logic.city.City
import com.unciv.logic.civilization.Civilization
import com.unciv.logic.map.BFS
@ -16,6 +17,9 @@ object UseGoldAutomation {
/** allow AI to spend money to purchase city-state friendship, buildings & unit */
fun useGold(civ: Civilization) {
for (unit in civ.units.getCivUnits())
UnitAutomation.tryUpgradeUnit(unit)
if (civ.isMajorCiv())
useGoldForCityStates(civ)

View File

@ -222,8 +222,6 @@ object UnitAutomation {
if (tryGoToRuinAndEncampment(unit) && !unit.hasMovement()) return
if (tryUpgradeUnit(unit)) return
if (unit.health < 50 && (tryRetreat(unit) || tryHealUnit(unit))) return // do nothing but heal
// If there are no enemies nearby and we can heal here, wait until we are at full health