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
+14
View File
@@ -46,6 +46,10 @@ signal player_eliminated(session_id: String, eliminated_account_id: String, seat
## event_type: "started" | "ended"
signal game_activity(event_type: String, session_id: String)
## Emitted when a Triggered ability needs the local player to pick a target.
## Payload keys: requestId, sourceInstanceId, abilityName, actionJson, rangeJson
signal triggered_target_request(request_data: Dictionary)
# ── State ─────────────────────────────────────────────────────────────────────
var session_id : String = ""
@@ -333,6 +337,13 @@ func send_activate_ability(source_id: String, ability_index: int,
payload["targets"] = targets
_game_request("game.activate_ability", payload)
func send_triggered_target_response(request_id: String, targets: Array) -> void:
var payload : Dictionary = { "requestId": request_id }
if not targets.is_empty():
payload["targets"] = targets
_game_request("game.triggered_target", payload)
# ── Private ───────────────────────────────────────────────────────────────────
func _game_request(msg_type: String, extra: Dictionary) -> void:
@@ -648,3 +659,6 @@ func _on_server_push(type: String, payload: Variant) -> void:
var ev_type : String = str(d.get("eventType", ""))
var ev_sid : String = str(d.get("sessionId", ""))
game_activity.emit(ev_type, ev_sid)
"game.ability.triggered_target_request":
triggered_target_request.emit(payload as Dictionary)