feat(CS): on-map siege countdown timer (S6 client protocol C1 B2 17/1E)
Some checks failed
.NET Core / build (push) Has been cancelled
Some checks failed
.NET Core / build (push) Has been cancelled
Client already renders the siege-map countdown but never received the packets. New ICastleSiegeStatusViewPlugIn + RemoteView impl send the raw S6 packets: C1 B2 17 (battle start/stop flag, arms the countdown) and C1 B2 1E (remaining hour/minute). CastleSiegeEventPlugIn broadcasts them to players on the battle map every 10s during Siege and sends stop at Settlement. No client changes. +1 test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -179,6 +179,20 @@ public class CastleSiegeContextTest
|
||||
Assert.That(ctx.ConsumeDirty(), Is.True);
|
||||
}
|
||||
|
||||
/// <summary>Tests that the remaining siege time counts down during the siege and is zero otherwise.</summary>
|
||||
[Test]
|
||||
public async Task RemainingSiegeTimeReflectsSiegePhaseAsync()
|
||||
{
|
||||
var ctx = new CastleSiegeContext(Config()); // 10 minute siege duration
|
||||
Assert.That(ctx.GetRemainingSiegeTime(T0), Is.EqualTo(TimeSpan.Zero), "no siege running -> zero");
|
||||
|
||||
await ctx.ForceStartRegistrationAsync(T0);
|
||||
await ctx.ForcePhaseAsync(CastleSiegePhase.Siege, T0);
|
||||
|
||||
Assert.That(ctx.GetRemainingSiegeTime(T0.AddMinutes(3)), Is.EqualTo(TimeSpan.FromMinutes(7)));
|
||||
Assert.That(ctx.GetRemainingSiegeTime(T0.AddMinutes(15)), Is.EqualTo(TimeSpan.Zero), "past the end -> clamped to zero");
|
||||
}
|
||||
|
||||
private static CastleSiegeConfiguration Config() => new()
|
||||
{
|
||||
RegistrationDuration = TimeSpan.FromMinutes(5),
|
||||
|
||||
Reference in New Issue
Block a user