mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-08 23:08:35 +07:00
Fix AI getting stuck when it can't promote with enough xp (#10089)
* Fix AI getting stuck when it can't promote with enough xp * Reverse the check for promotions * Forgot to remove extra break
This commit is contained in:
@ -164,7 +164,7 @@ object UnitAutomation {
|
|||||||
(UncivGame.Current.settings.automatedUnitsChoosePromotions || unit.civ.isAI())) {
|
(UncivGame.Current.settings.automatedUnitsChoosePromotions || unit.civ.isAI())) {
|
||||||
val availablePromotions = unit.promotions.getAvailablePromotions()
|
val availablePromotions = unit.promotions.getAvailablePromotions()
|
||||||
.filterNot { it.hasUnique(UniqueType.SkipPromotion) }
|
.filterNot { it.hasUnique(UniqueType.SkipPromotion) }
|
||||||
if (availablePromotions.any())
|
if (availablePromotions.none()) break
|
||||||
unit.promotions.addPromotion(
|
unit.promotions.addPromotion(
|
||||||
availablePromotions.filter { it.hasUnique(UniqueType.FreePromotion) }.toList().randomOrNull()?.name
|
availablePromotions.filter { it.hasUnique(UniqueType.FreePromotion) }.toList().randomOrNull()?.name
|
||||||
?: availablePromotions.toList().random().name)
|
?: availablePromotions.toList().random().name)
|
||||||
|
Reference in New Issue
Block a user