fix(CS): stop crown re-capture loop + show seal panel only to the master
Some checks failed
.NET Core / build (push) Has been cancelled
Some checks failed
.NET Core / build (push) Has been cancelled
- The occupier can no longer re-register its own throne (canCapture = eligible != occupier), which caused a repeating 60s panel loop; only a DIFFERENT guild can contest. - The 60s registration panel (0xB2/0x15) is now sent ONLY to the master on the crown, not broadcast to switch-holders/other players. Shield(0x16) + capture(0x18) still broadcast. +1 test (15 total).
This commit is contained in:
@@ -236,6 +236,35 @@ public class CastleSiegeContextTest
|
||||
Assert.That(ctx.OccupierGuildName, Is.Null);
|
||||
}
|
||||
|
||||
/// <summary>Tests that the occupier can't re-capture its own throne, but a different guild can contest it.</summary>
|
||||
[Test]
|
||||
public async Task OccupierDoesNotRecaptureButAnotherGuildCanContestAsync()
|
||||
{
|
||||
var ctx = new CastleSiegeContext(Config());
|
||||
await ctx.ForceStartRegistrationAsync(T0);
|
||||
await ctx.ForcePhaseAsync(CastleSiegePhase.Siege, T0);
|
||||
ctx.SetDefenseCount(0);
|
||||
var hold = TimeSpan.FromSeconds(60);
|
||||
|
||||
ctx.SetSwitchHolder(217, "A");
|
||||
ctx.SetSwitchHolder(218, "A");
|
||||
ctx.TickCrownHold("A", true, T0, hold);
|
||||
Assert.That(ctx.TickCrownHold("A", true, T0.AddSeconds(60), hold).Event, Is.EqualTo(CrownEvent.Captured));
|
||||
Assert.That(ctx.OccupierGuildName, Is.EqualTo("A"));
|
||||
|
||||
// A keeps holding — no re-registration loop, but the shield stays down (they hold it).
|
||||
var after = ctx.TickCrownHold("A", true, T0.AddSeconds(61), hold);
|
||||
Assert.That(after.Event, Is.EqualTo(CrownEvent.None));
|
||||
Assert.That(after.ShieldDown, Is.True);
|
||||
|
||||
// B takes both switches and can contest/capture.
|
||||
ctx.SetSwitchHolder(217, "B");
|
||||
ctx.SetSwitchHolder(218, "B");
|
||||
Assert.That(ctx.TickCrownHold("B", true, T0.AddSeconds(62), hold).Event, Is.EqualTo(CrownEvent.HoldStarted));
|
||||
Assert.That(ctx.TickCrownHold("B", true, T0.AddSeconds(122), hold).Event, Is.EqualTo(CrownEvent.Captured));
|
||||
Assert.That(ctx.OccupierGuildName, Is.EqualTo("B"));
|
||||
}
|
||||
|
||||
private static CastleSiegeConfiguration Config() => new()
|
||||
{
|
||||
RegistrationDuration = TimeSpan.FromMinutes(5),
|
||||
|
||||
Reference in New Issue
Block a user