From 93cb098edf23483e6b6ea2f8c873cb604feddb94 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Wed, 21 Aug 2024 23:16:41 +0300 Subject: [PATCH] Added "unit loses status" trigger unique --- .../ruleset/unique/UniqueTriggerActivation.kt | 8 +++++ .../unciv/models/ruleset/unique/UniqueType.kt | 30 +++++++++++-------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueTriggerActivation.kt b/core/src/com/unciv/models/ruleset/unique/UniqueTriggerActivation.kt index b210562628..c2b517811f 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueTriggerActivation.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueTriggerActivation.kt @@ -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 = diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 791d71c7d0..66fb4ed3ff 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -828,6 +828,23 @@ 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 + + SkipPromotion("Doing so will consume this opportunity to choose a Promotion", UniqueTarget.Promotion), + FreePromotion("This Promotion is free", UniqueTarget.Promotion), + + OneTimeChangeTerrain("Turn this tile into a [terrainName] tile", UniqueTarget.Triggerable), + + + UnitsGainPromotion("[mapUnitFilter] units gain the [promotion] promotion", UniqueTarget.Triggerable, + docDescription = "Works only with promotions that are valid for the unit's type - or for promotions that do not specify any."), // Not used in Vanilla + FreeStatBuildings("Provides the cheapest [stat] building in your first [positiveAmount] cities for free", UniqueTarget.Triggerable), // used in Policy + FreeSpecificBuildings("Provides a [buildingName] in your first [positiveAmount] cities for free", UniqueTarget.Triggerable), // used in Policy + TriggerEvent("Triggers a [event] event", UniqueTarget.Triggerable), + + //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), @@ -840,18 +857,7 @@ enum class UniqueType( 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), - - OneTimeChangeTerrain("Turn this tile into a [terrainName] tile", UniqueTarget.Triggerable), - - - UnitsGainPromotion("[mapUnitFilter] units gain the [promotion] promotion", UniqueTarget.Triggerable, - docDescription = "Works only with promotions that are valid for the unit's type - or for promotions that do not specify any."), // Not used in Vanilla - FreeStatBuildings("Provides the cheapest [stat] building in your first [positiveAmount] cities for free", UniqueTarget.Triggerable), // used in Policy - FreeSpecificBuildings("Provides a [buildingName] in your first [positiveAmount] cities for free", UniqueTarget.Triggerable), // used in Policy - TriggerEvent("Triggers a [event] event", UniqueTarget.Triggerable), - + OneTimeUnitLoseStatus("[unitTriggerTarget] loses the [promotion] status", UniqueTarget.UnitTriggerable), //endregion