Added "unit loses status" trigger unique

This commit is contained in:
yairm210 2024-08-21 23:16:41 +03:00
parent db5b0057bd
commit 93cb098edf
2 changed files with 26 additions and 12 deletions

View File

@ -970,6 +970,14 @@ object UniqueTriggerActivation {
true
}
}
UniqueType.OneTimeUnitLoseStatus -> {
if (unit == null) return null
val unitStatus = unit.statuses.firstOrNull { it.name == unique.params[1] } ?: return null
return {
unit.statuses.remove(unitStatus)
true
}
}
UniqueType.OneTimeUnitUpgrade, UniqueType.OneTimeUnitSpecialUpgrade -> {
if (unit == null) return null
val upgradeAction =

View File

@ -828,18 +828,7 @@ enum class UniqueType(
OneTimeSpiesLevelUp("Promotes all spies [amount] time(s)", UniqueTarget.Triggerable), // used in Policies, Buildings
OneTimeGainSpy("Gain an extra spy", UniqueTarget.Triggerable), // used in Wonders
OneTimeUnitHeal("Heal this unit by [positiveAmount] HP", UniqueTarget.UnitTriggerable),
OneTimeUnitDamage("This Unit takes [positiveAmount] damage", UniqueTarget.UnitTriggerable),
OneTimeUnitGainXP("This Unit gains [amount] XP", UniqueTarget.UnitTriggerable),
OneTimeUnitUpgrade("This Unit upgrades for free", UniqueTarget.UnitTriggerable), // Not used in Vanilla
OneTimeUnitSpecialUpgrade("This Unit upgrades for free including special upgrades", UniqueTarget.UnitTriggerable),
OneTimeUnitGainPromotion("This Unit gains the [promotion] promotion", UniqueTarget.UnitTriggerable), // Not used in Vanilla
OneTimeUnitRemovePromotion("This Unit loses the [promotion] promotion", UniqueTarget.UnitTriggerable),
OneTimeUnitGainMovement("This Unit gains [amount] movement", UniqueTarget.UnitTriggerable),
OneTimeUnitLoseMovement("This Unit loses [amount] movement", UniqueTarget.UnitTriggerable),
OneTimeUnitGainStatus("[unitTriggerTarget] gains the [promotion] status for [positiveAmount] turn(s)", UniqueTarget.UnitTriggerable,
docDescription = "Statuses are temporary promotions. They do not stack, and reapplying a specific status take the highest number - so reapplying a 3-turn on a 1-turn makes it 3, but doing the opposite will have no effect. " +
"Turns left on the status decrease at the *start of turn*, so bonuses applied for 1 turn are stll applied during other civ's turns."),
SkipPromotion("Doing so will consume this opportunity to choose a Promotion", UniqueTarget.Promotion),
FreePromotion("This Promotion is free", UniqueTarget.Promotion),
@ -854,6 +843,23 @@ enum class UniqueType(
//endregion
///////////////////////////////////////// region 09 UNIT TRIGGERABLES /////////////////////////////////////////
OneTimeUnitHeal("Heal this unit by [positiveAmount] HP", UniqueTarget.UnitTriggerable),
OneTimeUnitDamage("This Unit takes [positiveAmount] damage", UniqueTarget.UnitTriggerable),
OneTimeUnitGainXP("This Unit gains [amount] XP", UniqueTarget.UnitTriggerable),
OneTimeUnitUpgrade("This Unit upgrades for free", UniqueTarget.UnitTriggerable), // Not used in Vanilla
OneTimeUnitSpecialUpgrade("This Unit upgrades for free including special upgrades", UniqueTarget.UnitTriggerable),
OneTimeUnitGainPromotion("This Unit gains the [promotion] promotion", UniqueTarget.UnitTriggerable), // Not used in Vanilla
OneTimeUnitRemovePromotion("This Unit loses the [promotion] promotion", UniqueTarget.UnitTriggerable),
OneTimeUnitGainMovement("This Unit gains [amount] movement", UniqueTarget.UnitTriggerable),
OneTimeUnitLoseMovement("This Unit loses [amount] movement", UniqueTarget.UnitTriggerable),
OneTimeUnitGainStatus("[unitTriggerTarget] gains the [promotion] status for [positiveAmount] turn(s)", UniqueTarget.UnitTriggerable,
docDescription = "Statuses are temporary promotions. They do not stack, and reapplying a specific status take the highest number - so reapplying a 3-turn on a 1-turn makes it 3, but doing the opposite will have no effect. " +
"Turns left on the status decrease at the *start of turn*, so bonuses applied for 1 turn are stll applied during other civ's turns."),
OneTimeUnitLoseStatus("[unitTriggerTarget] loses the [promotion] status", UniqueTarget.UnitTriggerable),
//endregion
///////////////////////////////////////// region 10 TRIGGERS /////////////////////////////////////////