Added 'upon gaining/losing [promotionName] promotion' unit trigger uniques - see #3242

This commit is contained in:
yairm210 2024-09-23 23:21:04 +03:00
parent 916317a048
commit 980126ff06
2 changed files with 10 additions and 0 deletions

View File

@ -75,6 +75,10 @@ class UnitPromotions : IsPartOfGameInfoSerialization {
for (unique in unit.getTriggeredUniques(UniqueType.TriggerUponPromotion))
UniqueTriggerActivation.triggerUnique(unique, unit)
for (unique in promotion.getMatchingUniques(UniqueType.TriggerUponPromotionGain))
if (unique.params[0] == promotionName)
UniqueTriggerActivation.triggerUnique(unique, unit)
}
if (!promotion.hasUnique(UniqueType.SkipPromotion))
@ -100,6 +104,10 @@ class UnitPromotions : IsPartOfGameInfoSerialization {
promotions.remove(promotionName)
unit.updateUniques()
unit.updateVisibleTiles()
for (unique in unit.getMatchingUniques(UniqueType.TriggerUponPromotionLoss))
if (unique.params[0] == promotionName)
UniqueTriggerActivation.triggerUnique(unique, unit)
}
}

View File

@ -918,6 +918,8 @@ enum class UniqueType(
TriggerUponExpendingUnit("upon expending a [mapUnitFilter] unit", UniqueTarget.UnitTriggerCondition),
TriggerUponDefeat("upon being defeated", UniqueTarget.UnitTriggerCondition),
TriggerUponPromotion("upon being promoted", UniqueTarget.UnitTriggerCondition),
TriggerUponPromotionGain("upon gaining the [promotion] promotion", UniqueTarget.UnitTriggerCondition),
TriggerUponPromotionLoss("upon losing the [promotion] promotion", UniqueTarget.UnitTriggerCondition),
TriggerUponLosingHealth("upon losing at least [amount] HP in a single attack", UniqueTarget.UnitTriggerCondition),
TriggerUponEndingTurnInTile("upon ending a turn in a [tileFilter] tile", UniqueTarget.UnitTriggerCondition),
TriggerUponDiscoveringTile("upon discovering a [tileFilter] tile", UniqueTarget.UnitTriggerCondition),