fix: speed effects stack multiplicatively
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
using Core.Domain.Status;
|
||||
using Core.Domain.Status.Effects;
|
||||
|
||||
namespace DecayGrid.Tests
|
||||
{
|
||||
@@ -14,5 +15,30 @@ namespace DecayGrid.Tests
|
||||
Assert.AreEqual(1f, caps.SpeedMultiplier, 0.001f);
|
||||
Assert.IsFalse(caps.CanHover);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SpeedBoostAlone_AppliesMultiplier()
|
||||
{
|
||||
var sm = new StatusManager();
|
||||
sm.AddEffect(new SpeedBoostEffect(10f, 1.5f));
|
||||
Assert.AreEqual(1.5f, sm.CurrentCapabilities.SpeedMultiplier, 0.001f);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LightFootedAlone_AppliesMultiplier()
|
||||
{
|
||||
var sm = new StatusManager();
|
||||
sm.AddEffect(new LightFootedEffect(10f));
|
||||
Assert.AreEqual(1.2f, sm.CurrentCapabilities.SpeedMultiplier, 0.001f);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TwoSpeedEffectsStack_Multiplicatively()
|
||||
{
|
||||
var sm = new StatusManager();
|
||||
sm.AddEffect(new LightFootedEffect(10f)); // *1.2
|
||||
sm.AddEffect(new SpeedBoostEffect(10f, 1.5f)); // *1.5
|
||||
Assert.AreEqual(1.8f, sm.CurrentCapabilities.SpeedMultiplier, 0.001f); // 1.0 * 1.2 * 1.5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user