feat(CS-P3): PROPER siege - position-based Crown Switch hold (stand on them) + gates & statues destructibles + auto throne capture; remove non-working talk handlers
Some checks failed
.NET Core / build (push) Has been cancelled
Some checks failed
.NET Core / build (push) Has been cancelled
This commit is contained in:
@@ -67,25 +67,30 @@ public class CastleSiegeContextTest
|
||||
Assert.That(ctx.RegisteredGuilds, Does.Contain("Attackers"));
|
||||
}
|
||||
|
||||
/// <summary>Tests the full siege objective chain: destroy statues, hold both switches, then capture the throne.</summary>
|
||||
/// <summary>Tests the full siege objective chain: destroy defenses, then hold both switches to capture the throne.</summary>
|
||||
[Test]
|
||||
public async Task FullSiegeObjectiveChainToOwnershipAsync()
|
||||
{
|
||||
var ctx = new CastleSiegeContext(Config());
|
||||
await ctx.ForceStartRegistrationAsync(T0);
|
||||
await ctx.ForcePhaseAsync(CastleSiegePhase.Siege, T0);
|
||||
ctx.SetStatueCount(2);
|
||||
ctx.SetDefenseCount(2);
|
||||
|
||||
// Throne blocked until statues destroyed + both switches held.
|
||||
Assert.That(ctx.TryCaptureThrone("Attackers").Success, Is.False);
|
||||
// Both switches held but defenses still up -> no capture.
|
||||
ctx.SetSwitchHolder(217, "Attackers");
|
||||
ctx.SetSwitchHolder(218, "Attackers");
|
||||
Assert.That(ctx.EvaluateCapture(), Is.Null);
|
||||
|
||||
ctx.NotifyStatueDestroyed();
|
||||
ctx.NotifyStatueDestroyed();
|
||||
ctx.HoldSwitch(217, "Attackers");
|
||||
Assert.That(ctx.TryCaptureThrone("Attackers").Success, Is.False); // only one switch held
|
||||
ctx.NotifyDefenseDestroyed();
|
||||
ctx.NotifyDefenseDestroyed();
|
||||
|
||||
ctx.HoldSwitch(218, "Attackers");
|
||||
Assert.That(ctx.TryCaptureThrone("Attackers").Success, Is.True); // both switches + statues down
|
||||
// Only one switch held -> still no capture.
|
||||
ctx.SetSwitchHolder(218, null);
|
||||
Assert.That(ctx.EvaluateCapture(), Is.Null);
|
||||
|
||||
// Both switches held by the same guild + defenses down -> capture.
|
||||
ctx.SetSwitchHolder(218, "Attackers");
|
||||
Assert.That(ctx.EvaluateCapture(), Is.EqualTo("Attackers"));
|
||||
Assert.That(ctx.OccupierGuildName, Is.EqualTo("Attackers"));
|
||||
|
||||
await ctx.TickAsync(T0.AddMinutes(20)); // Siege -> Settlement
|
||||
@@ -93,27 +98,27 @@ public class CastleSiegeContextTest
|
||||
Assert.That(ctx.OwnerGuildName, Is.EqualTo("Attackers"));
|
||||
}
|
||||
|
||||
/// <summary>Tests that a rival guild holding only one switch cannot steal the throne.</summary>
|
||||
/// <summary>Tests that two different guilds each holding one switch cannot capture the throne.</summary>
|
||||
[Test]
|
||||
public async Task ThroneRequiresBothSwitchesBySameGuildAsync()
|
||||
{
|
||||
var ctx = new CastleSiegeContext(Config());
|
||||
await ctx.ForceStartRegistrationAsync(T0);
|
||||
await ctx.ForcePhaseAsync(CastleSiegePhase.Siege, T0);
|
||||
ctx.SetStatueCount(0);
|
||||
ctx.HoldSwitch(217, "A");
|
||||
ctx.HoldSwitch(218, "B");
|
||||
Assert.That(ctx.TryCaptureThrone("A").Success, Is.False);
|
||||
Assert.That(ctx.TryCaptureThrone("B").Success, Is.False);
|
||||
ctx.SetDefenseCount(0);
|
||||
ctx.SetSwitchHolder(217, "A");
|
||||
ctx.SetSwitchHolder(218, "B");
|
||||
Assert.That(ctx.EvaluateCapture(), Is.Null);
|
||||
}
|
||||
|
||||
/// <summary>Tests that objective actions outside the siege phase are no-ops.</summary>
|
||||
/// <summary>Tests that switch holding outside the siege phase is a no-op.</summary>
|
||||
[Test]
|
||||
public void ObjectiveActionsOutsideSiegeAreNoOp()
|
||||
public void SwitchHoldOutsideSiegeIsNoOp()
|
||||
{
|
||||
var ctx = new CastleSiegeContext(Config());
|
||||
ctx.HoldSwitch(217, "A");
|
||||
Assert.That(ctx.TryCaptureThrone("A").Success, Is.False);
|
||||
ctx.SetSwitchHolder(217, "A");
|
||||
ctx.SetSwitchHolder(218, "A");
|
||||
Assert.That(ctx.EvaluateCapture(), Is.Null);
|
||||
Assert.That(ctx.OccupierGuildName, Is.Null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user