Skip to content

Commit

Permalink
Let AI choose healing promotions (#12728)
Browse files Browse the repository at this point in the history
* Update UnitAutomation.kt

* Update UnitAutomation.kt

* Update UnitAutomation.kt
  • Loading branch information
EmperorPinguin authored Jan 1, 2025
1 parent 8d70606 commit 5e5a9d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/com/unciv/logic/automation/unit/UnitAutomation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ object UnitAutomation {
// Restrict Human automated units from promotions via setting
(UncivGame.Current.settings.automatedUnitsChoosePromotions || unit.civ.isAI())) {
val availablePromotions = unit.promotions.getAvailablePromotions()
.filterNot { it.hasUnique(UniqueType.SkipPromotion) }
if (unit.health < 60 && !(unit.baseUnit.isAirUnit() || unit.baseUnit.hasUnique(UniqueType.CanMoveAfterAttacking)) && availablePromotions.any { it.hasUnique(UniqueType.OneTimeUnitHeal) })
availablePromotions.filter { it.hasUnique(UniqueType.OneTimeUnitHeal) } //choose healing promotions only when beneficial
else availablePromotions.filterNot { it.hasUnique(UniqueType.SkipPromotion) }
if (availablePromotions.none()) break
val freePromotions = availablePromotions.filter { it.hasUnique(UniqueType.FreePromotion) }.toList()
val stateForConditionals = unit.cache.state
Expand Down

0 comments on commit 5e5a9d7

Please sign in to comment.