mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-20 20:59:18 +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
|
package com.unciv.logic.automation.civilization
|
||||||
|
|
||||||
|
import com.unciv.logic.automation.unit.UnitAutomation
|
||||||
import com.unciv.logic.city.City
|
import com.unciv.logic.city.City
|
||||||
import com.unciv.logic.civilization.Civilization
|
import com.unciv.logic.civilization.Civilization
|
||||||
import com.unciv.logic.map.BFS
|
import com.unciv.logic.map.BFS
|
||||||
@ -16,6 +17,9 @@ object UseGoldAutomation {
|
|||||||
|
|
||||||
/** allow AI to spend money to purchase city-state friendship, buildings & unit */
|
/** allow AI to spend money to purchase city-state friendship, buildings & unit */
|
||||||
fun useGold(civ: Civilization) {
|
fun useGold(civ: Civilization) {
|
||||||
|
for (unit in civ.units.getCivUnits())
|
||||||
|
UnitAutomation.tryUpgradeUnit(unit)
|
||||||
|
|
||||||
if (civ.isMajorCiv())
|
if (civ.isMajorCiv())
|
||||||
useGoldForCityStates(civ)
|
useGoldForCityStates(civ)
|
||||||
|
|
||||||
|
@ -222,8 +222,6 @@ object UnitAutomation {
|
|||||||
|
|
||||||
if (tryGoToRuinAndEncampment(unit) && !unit.hasMovement()) return
|
if (tryGoToRuinAndEncampment(unit) && !unit.hasMovement()) return
|
||||||
|
|
||||||
if (tryUpgradeUnit(unit)) return
|
|
||||||
|
|
||||||
if (unit.health < 50 && (tryRetreat(unit) || tryHealUnit(unit))) return // do nothing but heal
|
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
|
// 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