fix: speed effects stack multiplicatively
This commit is contained in:
@@ -19,7 +19,7 @@ namespace Core.Domain.Status.Effects
|
|||||||
public void ModifyCapabilities(ref PlayerCapabilities caps)
|
public void ModifyCapabilities(ref PlayerCapabilities caps)
|
||||||
{
|
{
|
||||||
caps.CanTriggerDecay = false;
|
caps.CanTriggerDecay = false;
|
||||||
caps.SpeedMultiplier = 1.2f;
|
caps.SpeedMultiplier *= 1.2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnApply()
|
public void OnApply()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Core.Domain.Status.Effects
|
|||||||
|
|
||||||
public void ModifyCapabilities(ref PlayerCapabilities caps)
|
public void ModifyCapabilities(ref PlayerCapabilities caps)
|
||||||
{
|
{
|
||||||
caps.SpeedMultiplier = _multiplier;
|
caps.SpeedMultiplier *= _multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnApply() { }
|
public void OnApply() { }
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Core.Domain.Status;
|
using Core.Domain.Status;
|
||||||
|
using Core.Domain.Status.Effects;
|
||||||
|
|
||||||
namespace DecayGrid.Tests
|
namespace DecayGrid.Tests
|
||||||
{
|
{
|
||||||
@@ -14,5 +15,30 @@ namespace DecayGrid.Tests
|
|||||||
Assert.AreEqual(1f, caps.SpeedMultiplier, 0.001f);
|
Assert.AreEqual(1f, caps.SpeedMultiplier, 0.001f);
|
||||||
Assert.IsFalse(caps.CanHover);
|
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