fix(movement): invalidate burden on enchantment changes

This commit is contained in:
Erik 2026-07-31 10:16:27 +02:00
parent 2b9dfec9d7
commit d6e8b60303
13 changed files with 231 additions and 25 deletions

View file

@ -89,6 +89,25 @@ public sealed class IndicatorBarControllerTests
Assert.Equal(expectedState, button.ActiveRetailStateId);
}
[Fact]
public void EnchantmentChange_ReevaluatesBurdenFromEffectiveStrength()
{
var h = CreateHarness(strength: 10);
using IndicatorBarController controller = h.Controller;
h.Objects.UpdateIntProperty(Player, 5u, 1600);
UiButton button = h.Button(IndicatorBarController.BurdenButtonId);
Assert.Equal(IndicatorBarController.EncumberedState, button.ActiveRetailStateId);
h.Strength = 20;
h.Spellbook.OnEnchantmentAdded(new ActiveEnchantmentRecord(
42u, 1u, 60d, Player, Bucket: 1u));
Assert.Equal(IndicatorBarController.UnencumberedState, button.ActiveRetailStateId);
h.Strength = 10;
h.Spellbook.OnPurgeAll();
Assert.Equal(IndicatorBarController.EncumberedState, button.ActiveRetailStateId);
}
[Fact]
public void Burden_ClickOpensCharacterInformationPanel()
{
@ -205,7 +224,7 @@ public sealed class IndicatorBarControllerTests
spellbook,
objects,
() => Player,
() => strength,
() => harness.Strength,
() => harness.LinkStatus,
() => harness.Time,
harness.ToggledPanels.Add,
@ -222,7 +241,7 @@ public sealed class IndicatorBarControllerTests
public ImportedLayout Layout { get; } = layout;
public Spellbook Spellbook { get; } = spellbook;
public ClientObjectTable Objects { get; } = objects;
public int Strength { get; } = strength;
public int Strength { get; set; } = strength;
public List<uint> ToggledPanels { get; } = [];
public double Time { get; set; }
public LinkStatusSnapshot LinkStatus { get; set; } = new(true, 0d);