feat(CS-P3): throne registration via Sinior/Crown talk (223/216) after defenses down + both switches held; reachable defense positions
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:
@@ -169,26 +169,38 @@ public class CastleSiegeContext
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the throne capture: if the siege is running, all defenses are destroyed, the throne is not
|
||||
/// yet taken, and one guild holds BOTH Crown Switches at once, that guild captures the throne.
|
||||
/// Attempts to capture the throne for a guild (called when a member registers at the Sinior/Crown NPC).
|
||||
/// Succeeds only during the siege when the throne is free, all castle defenses are destroyed, and the
|
||||
/// guild is currently holding BOTH Crown Switches (a member standing on each).
|
||||
/// </summary>
|
||||
/// <returns>The guild that just captured the throne (for announcing), or <c>null</c> if nothing changed.</returns>
|
||||
public string? EvaluateCapture()
|
||||
/// <param name="guildName">The capturing guild's name.</param>
|
||||
/// <returns>Whether it succeeded and a human-readable reason/result message.</returns>
|
||||
public (bool Success, string Reason) TryCaptureThrone(string guildName)
|
||||
{
|
||||
if (this.Phase != CastleSiegePhase.Siege || this._occupier is not null || this._defensesRemaining > 0)
|
||||
if (this.Phase != CastleSiegePhase.Siege)
|
||||
{
|
||||
return null;
|
||||
return (false, "The siege is not running.");
|
||||
}
|
||||
|
||||
var holder217 = this._switchHolders[217];
|
||||
var holder218 = this._switchHolders[218];
|
||||
if (holder217 is not null && holder217 == holder218)
|
||||
if (this._occupier is not null)
|
||||
{
|
||||
this._occupier = holder217;
|
||||
return holder217;
|
||||
return (false, this._occupier == guildName
|
||||
? "Your guild already holds the throne."
|
||||
: $"The throne is already held by '{this._occupier}'.");
|
||||
}
|
||||
|
||||
return null;
|
||||
if (this._defensesRemaining > 0)
|
||||
{
|
||||
return (false, $"Destroy the castle defenses first ({this._defensesRemaining} remaining).");
|
||||
}
|
||||
|
||||
if (this._switchHolders[217] != guildName || this._switchHolders[218] != guildName)
|
||||
{
|
||||
return (false, "Your guild must be holding BOTH Crown Switches at once (stand a member on each).");
|
||||
}
|
||||
|
||||
this._occupier = guildName;
|
||||
return (true, "throne captured");
|
||||
}
|
||||
|
||||
/// <summary>Returns a human-readable status summary for admin display.</summary>
|
||||
|
||||
Reference in New Issue
Block a user