Skip to content

Commit

Permalink
feat: duplicate modifier remove duration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillu1 committed Nov 23, 2024
1 parent 1c4a332 commit 3e6d6e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions ModiBuff/ModiBuff.Tests/DurationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,23 @@ public void Duration_Damage_Once()

Assert.AreEqual(UnitHealth - 5, Unit.Health);
}

[Test]
public void TwoModifiersSameDurationRemove()
{
AddRecipe("DurationRemove")
.Remove(5);
AddRecipe("DurationRemove2")
.Remove(5);
Setup();

Unit.AddModifierSelf("DurationRemove");
Unit.AddModifierSelf("DurationRemove2");

Unit.Update(5f);

Assert.False(Unit.ContainsModifier("DurationRemove"));
Assert.False(Unit.ContainsModifier("DurationRemove2"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public void CreateGenerators()
_modifierInfos = new ModifierInfo[_recipes.Count + _manualGenerators.Count];
_tags = new TagType[_recipes.Count + _manualGenerators.Count];
_auraIds = new int[_recipes.Count + _manualGenerators.Count];
_auraIds.AsSpan().Fill(-1);
for (int i = 0; i < _auraIds.Length; i++)
_auraIds[i] = -1;
foreach (var generator in _manualGenerators.Values)
{
_modifierGenerators.Add(generator.Name, generator);
Expand Down
1 change: 0 additions & 1 deletion ModiBuff/ModiBuff/Core/Modifier/ModifierController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ public void Remove(in ModifierReference modifierReference)
if (Config.UseDictionaryIndexes)
_modifierIndexesDict[topModifier.Id] = modifierIndex;
else
//TODO Make a unit test that checks that this is implemented
_modifierIndexes[topModifier.Id] = modifierIndex;
}

Expand Down

0 comments on commit 3e6d6e2

Please sign in to comment.