Skip to content

Commit

Permalink
fix: remove on stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillu1 committed Jun 24, 2024
1 parent 35ba197 commit d2b4963
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions ModiBuff/ModiBuff.Tests/SaveLoadRecipeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public void SaveRemoveStackRecipeLoad()
Unit.AddModifierSelf("RemoveStack");
Assert.True(Unit.ContainsModifier("RemoveStack"));
Unit.AddModifierSelf("RemoveStack");
Unit.Update(0);
Assert.False(Unit.ContainsModifier("RemoveStack"));
}

Expand Down
16 changes: 16 additions & 0 deletions ModiBuff/ModiBuff.Tests/StackTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,22 @@ public void RemoveOnMaxStacks()
Unit.AddModifierSelf("RemoveStack");
Assert.True(Unit.ContainsModifier("RemoveStack"));
Unit.AddModifierSelf("RemoveStack");
Unit.Update(0);
Assert.False(Unit.ContainsModifier("RemoveStack"));
}

[Test]
public void RemoveOnMaxStacksEffect()
{
AddRecipe("RemoveStack")
.Effect(new RemoveEffect(), EffectOn.Stack)
.Stack(WhenStackEffect.OnMaxStacks, 2);
Setup();

Unit.AddModifierSelf("RemoveStack");
Assert.True(Unit.ContainsModifier("RemoveStack"));
Unit.AddModifierSelf("RemoveStack");
Unit.Update(0);
Assert.False(Unit.ContainsModifier("RemoveStack"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,6 @@ public ModifierRecipe Effect(IEffect effect, EffectOn effectOn)
#if DEBUG && !MODIBUFF_PROFILE
Logger.LogWarning("[ModiBuff] Adding a remove effect through Effect() is not recommended, " +
"use Remove(RemoveEffectOn) or Remove(float) instead");
if (effectOn.HasFlag(EffectOn.Stack))
{
Logger.LogError("[ModiBuff] Adding a remove effect through stack is not currently supported");
effectOn &= ~EffectOn.Stack;
}
#endif
AddRemoveEffect(effectOn);
_saveInstructions.Add(new SaveInstruction.Remove(SaveInstruction.Remove.Type.RemoveOn, effectOn));
Expand Down

0 comments on commit d2b4963

Please sign in to comment.