AI: Don't choose one-time-action promotions

This commit is contained in:
yairm210 2025-05-11 17:06:31 +03:00
parent 900d81f48b
commit a9b8596e87

View File

@ -183,9 +183,10 @@ object UnitAutomation {
// Restrict Human automated units from promotions via setting
(UncivGame.Current.settings.automatedUnitsChoosePromotions || unit.civ.isAI())) {
val availablePromotions = unit.promotions.getAvailablePromotions()
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) }
// It can be assumed that "heal + skip promotion" is a bad choice - the cases where we WOULD want it are slim
.filterNot { it.hasUnique(UniqueType.SkipPromotion) }
if (availablePromotions.none()) break
val freePromotions = availablePromotions.filter { it.hasUnique(UniqueType.FreePromotion) }.toList()
val stateForConditionals = unit.cache.state