feat(CS): authentic Crown-hold throne capture (S6 protocol) replacing Sinior-talk
Some checks failed
.NET Core / build (push) Has been cancelled
Some checks failed
.NET Core / build (push) Has been cancelled
Break all gates + hold both switches (defenses down) -> the Crown shield drops (C1 B2 16=0). The guild master then stands on the Crown (176,212) and holds for CrownHoldDuration (default 60s, client shows a 60s countdown via C1 B2 15) to capture; capture broadcasts C1 B2 18 + golden text and sets the occupier. Losing a switch or leaving the crown resets the hold (contestable until the siege timer ends). Sinior (223) is now informational guidance. +2 tests (14 total). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -193,6 +193,49 @@ public class CastleSiegeContextTest
|
||||
Assert.That(ctx.GetRemainingSiegeTime(T0.AddMinutes(15)), Is.EqualTo(TimeSpan.Zero), "past the end -> clamped to zero");
|
||||
}
|
||||
|
||||
/// <summary>Tests that a guild master holding the crown (both switches held, defenses down) captures after the hold duration.</summary>
|
||||
[Test]
|
||||
public async Task CrownHoldCapturesAfterHoldDurationAsync()
|
||||
{
|
||||
var ctx = new CastleSiegeContext(Config());
|
||||
await ctx.ForceStartRegistrationAsync(T0);
|
||||
await ctx.ForcePhaseAsync(CastleSiegePhase.Siege, T0);
|
||||
ctx.SetDefenseCount(0);
|
||||
ctx.SetSwitchHolder(217, "Attackers");
|
||||
ctx.SetSwitchHolder(218, "Attackers");
|
||||
Assert.That(ctx.GetShieldEligibleGuild(), Is.EqualTo("Attackers"));
|
||||
|
||||
var hold = TimeSpan.FromSeconds(60);
|
||||
Assert.That(ctx.TickCrownHold("Attackers", true, T0, hold).Event, Is.EqualTo(CrownEvent.HoldStarted));
|
||||
Assert.That(ctx.TickCrownHold("Attackers", true, T0.AddSeconds(30), hold).Event, Is.EqualTo(CrownEvent.None));
|
||||
Assert.That(ctx.OccupierGuildName, Is.Null);
|
||||
|
||||
var captured = ctx.TickCrownHold("Attackers", true, T0.AddSeconds(60), hold);
|
||||
Assert.That(captured.Event, Is.EqualTo(CrownEvent.Captured));
|
||||
Assert.That(captured.ShieldDown, Is.True);
|
||||
Assert.That(ctx.OccupierGuildName, Is.EqualTo("Attackers"));
|
||||
}
|
||||
|
||||
/// <summary>Tests that losing a switch mid-hold resets the crown-hold progress (contestable).</summary>
|
||||
[Test]
|
||||
public async Task CrownHoldResetsWhenSwitchLostAsync()
|
||||
{
|
||||
var ctx = new CastleSiegeContext(Config());
|
||||
await ctx.ForceStartRegistrationAsync(T0);
|
||||
await ctx.ForcePhaseAsync(CastleSiegePhase.Siege, T0);
|
||||
ctx.SetDefenseCount(0);
|
||||
ctx.SetSwitchHolder(217, "A");
|
||||
ctx.SetSwitchHolder(218, "A");
|
||||
|
||||
Assert.That(ctx.TickCrownHold("A", true, T0, TimeSpan.FromSeconds(60)).Event, Is.EqualTo(CrownEvent.HoldStarted));
|
||||
|
||||
ctx.SetSwitchHolder(218, null); // lost a switch -> no longer eligible
|
||||
var reset = ctx.TickCrownHold(ctx.GetShieldEligibleGuild(), false, T0.AddSeconds(10), TimeSpan.FromSeconds(60));
|
||||
Assert.That(reset.ShieldDown, Is.False);
|
||||
Assert.That(reset.Event, Is.EqualTo(CrownEvent.HoldReset));
|
||||
Assert.That(ctx.OccupierGuildName, Is.Null);
|
||||
}
|
||||
|
||||
private static CastleSiegeConfiguration Config() => new()
|
||||
{
|
||||
RegistrationDuration = TimeSpan.FromMinutes(5),
|
||||
|
||||
Reference in New Issue
Block a user