mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-19 20:28:56 +07:00
Moved AI unit upgrade into "use gold" function, so it is prioritized *over* purchasing new constructions
This commit is contained in:
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user