When a Triggered ability fires and any of its actions require a human target
pick, the server now pauses execution instead of auto-resolving:
Server:
- AbilitySystem.FireTrigger detects actions needing client input via
ActionNeedsClientTargets(); stores PendingTriggeredTarget in GameState and
returns early rather than executing the ability
- PushStateToPlayersAsync (GameHandlerBase) checks for PendingTriggeredTarget
after every state push and sends a game.ability.triggered_target_request push
to the owning player carrying the action definition and range
- New GameTriggeredTargetHandler (game.triggered_target) receives the player's
picks, calls AbilitySystem.ResumeTriggeredAbility, and broadcasts the result
- PendingTriggeredTarget model stored in GameState.PendingTriggeredTarget (JSONB)
Client:
- Game.gd handles the triggered_target_request push and emits a signal
- game_screen.gd connects the signal, re-uses the existing ABILITY_TARGET mode
and _start_ability_targeting() flow, then sends game.triggered_target instead
of game.activate_ability when done
- A brief banner ("Triggered: <name> — select a target") informs the player
"Warrant Cover" (OnChanneled, Owner unit pick) will now correctly prompt the
player to select which friendly unit gains +1 Defense.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
33 lines
1.4 KiB
C#
33 lines
1.4 KiB
C#
namespace SOR.Game.Abilities.Models;
|
|
|
|
/// <summary>
|
|
/// Stored in GameState when a Triggered ability fires but needs a human target pick.
|
|
/// The engine pauses execution, pushes a request to the owning player, then resumes
|
|
/// via GameTriggeredTargetHandler once the player submits their selection.
|
|
/// </summary>
|
|
public sealed class PendingTriggeredTarget
|
|
{
|
|
/// <summary>Correlation ID sent to the client so responses can be matched.</summary>
|
|
public string RequestId { get; set; } = Guid.NewGuid().ToString("N");
|
|
|
|
/// <summary>AccountId of the player who must pick the target.</summary>
|
|
public string ActorId { get; set; } = string.Empty;
|
|
|
|
/// <summary>InstanceId of the unit whose triggered ability is paused.</summary>
|
|
public string SourceInstanceId { get; set; } = string.Empty;
|
|
|
|
/// <summary>Display name of the ability (for client UI).</summary>
|
|
public string AbilityName { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// JSON-serialized <see cref="Action"/>[] — the full action list to execute on resume.
|
|
/// </summary>
|
|
public string ActionsJson { get; set; } = "[]";
|
|
|
|
/// <summary>JSON-serialized <see cref="AbilityRange"/>? — for client-side highlighting.</summary>
|
|
public string? RangeJson { get; set; }
|
|
|
|
/// <summary>JSON-serialized <see cref="DurationModel"/>? — forceDuration applied to all actions.</summary>
|
|
public string? ForceDurationJson { get; set; }
|
|
}
|