Implement triggered ability target prompting (Option D)

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>
This commit is contained in:
dingo
2026-03-28 18:50:48 -04:00
co-authored by Claude Happy
parent cb601abd00
commit 515bfaabdf
9 changed files with 343 additions and 1 deletions
+29
View File
@@ -753,3 +753,32 @@ public sealed record AbilityTarget(
CoordDto? Coord = null,
/// <summary>Set for ChooseOne actions: the 0-based index of the chosen branch.</summary>
int? BranchIndex = null);
// ── Triggered ability target prompting ───────────────────────────────────────
/// <summary>
/// Pushed to the owning player when a Triggered ability fires and requires a
/// manual target selection before it can complete.
/// The client should enter ability-targeting mode using the provided action definition,
/// then reply with <see cref="GameTriggeredTargetRequest"/>.
/// </summary>
public sealed record TriggeredTargetRequestPush(
/// <summary>Correlation ID — must be echoed back in the response.</summary>
string RequestId,
/// <summary>InstanceId of the unit whose triggered ability is waiting.</summary>
string SourceInstanceId,
/// <summary>Display name of the ability, for UI labelling.</summary>
string AbilityName,
/// <summary>JSON-serialized <c>Action</c> for the first client-pick action.</summary>
string ActionJson,
/// <summary>JSON-serialized <c>AbilityRange</c>? — for client highlight validation. Null if no range.</summary>
string? RangeJson);
/// <summary>
/// Sent by the client to submit target picks for a pending triggered ability.
/// </summary>
public sealed record GameTriggeredTargetRequest(
Guid SessionId,
string RequestId,
IReadOnlyList<AbilityTarget> Targets);