diff --git a/OpenRA.Mods.Common/Traits/Conditions/ConditionManager.cs b/OpenRA.Mods.Common/Traits/Conditions/ConditionManager.cs index 875733a518..805756aaf5 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ConditionManager.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ConditionManager.cs @@ -153,10 +153,18 @@ namespace OpenRA.Mods.Common.Traits var target = (conditionState.Tokens.Count - 1).Clamp(0, sc.Length); var st = stackedTokens[condition]; for (var i = st.Count; i < target; i++) - st.Push(GrantCondition(self, sc[i])); + { + // Empty strings are used to skip unwanted levels + var t = !string.IsNullOrEmpty(sc[i]) ? GrantCondition(self, sc[i]) : InvalidConditionToken; + st.Push(t); + } for (var i = st.Count; i > target; i--) - RevokeCondition(self, st.Pop()); + { + var t = st.Pop(); + if (t != InvalidConditionToken) + RevokeCondition(self, t); + } } } diff --git a/OpenRA.Mods.Common/Traits/Conditions/StackedCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/StackedCondition.cs index dc24965f7b..c2cd3574a8 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/StackedCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/StackedCondition.cs @@ -22,9 +22,11 @@ namespace OpenRA.Mods.Common.Traits public readonly string Condition = null; [FieldLoader.Require] + [FieldLoader.AllowEmptyEntries] [GrantedConditionReference] [Desc("Conditions to grant when the monitored condition is granted multiple times.", - "The first entry is activated at 2x grants, second entry at 3x grants, and so on.")] + "The first entry is activated at 2x grants, second entry at 3x grants, and so on.", + "Use empty entries to skip levels.")] public readonly string[] StackedConditions = { }; }