Ability system: zone-scope card picks, target-pick prompts, builder filter editor, tests
Server engine (SOR.Game): - Zone-scope card targets (Hand/Deck/Discard/AnyZone) pause with a server- enumerated candidates list (PendingTargetPick.CandidatesJson) instead of failing when the client submits player accountIds for hidden zones - Missing mandatory target picks now prompt (PendingTargetPick) rather than throwing INSUFFICIENT_TARGETS; all post-pick resume flows run with requireClientTargets so actions never silently auto-hit the first candidate - ChannelCardFromZone: Filters + InOwn/InTargetChannelRange enforced via shared IsWithinChannelConstraints (incl. player-picked tile validation) - TakeControl duration reversal via internal __ReturnControl effect; board occupant-owner kept in sync both ways - TrackedDuration gains SourceOwnerAccountId (UntilStartOfSourceOwnerTurn now anchors correctly) and IsAura (aura reapply no longer strips unrelated buffs) - RevealCards honours N for player targets; IsAllyTurn means teammate's turn; content-keyed ParseAbilities cache; AbilityValidator for save-time linting; duplicate PolyType attributes removed (converter reads base registry only) Admin builder (AbilityBuilder/CardEditor): - Full multi-filter editor (28 filter types with parameter fields) replacing the single param-less dropdown; raw-JSON ChooseOne editor per action - Cost PickMode, TriggerLimitPerGame, SourceZoneGate inputs - Save-time ability validation with error list (blocks invalid saves) Client (Godot): - Card-list picker for zone-scope target picks; OR/XOR-root abilities skip speculative upfront targeting; ally units included in team-aware highlight pools (Game.get_ally_units); state re-sync on rejected pick responses Tests: new SOR.Game.Tests project (21 passing) covering the regression suite from SOR.Abilities-Review-and-solutions.md §8 plus validator rules. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -260,6 +260,24 @@ func get_all_enemy_units() -> Array:
|
||||
return units
|
||||
|
||||
|
||||
## Returns all units (field + archSpirit) belonging to allied players
|
||||
## (same team, not the local player). Empty in FFA games.
|
||||
func get_ally_units() -> Array:
|
||||
var my_team : int = int(get_my_player().get("teamIndex", -1))
|
||||
var units : Array = []
|
||||
if my_team < 0:
|
||||
return units
|
||||
for p: Dictionary in state.get("players", []):
|
||||
var pid : String = str(p.get("accountId", ""))
|
||||
if pid == Auth.user_id: continue
|
||||
if int(p.get("teamIndex", -2)) != my_team: continue
|
||||
units.append_array(_as_array(p.get("field", [])))
|
||||
var arch = p.get("archSpirit")
|
||||
if arch is Dictionary and not (arch as Dictionary).is_empty():
|
||||
units.append(arch)
|
||||
return units
|
||||
|
||||
|
||||
## Returns a TileDto dict by coord, or {}.
|
||||
func get_tile(x: int, y: int) -> Dictionary:
|
||||
for t: Dictionary in get_tiles():
|
||||
@@ -468,6 +486,16 @@ func send_reveal_choice_pick_response(request_id: String, ordered_indices: Array
|
||||
|
||||
# ── Private ───────────────────────────────────────────────────────────────────
|
||||
|
||||
## Pick/response messages where the client optimistically tears down its prompt UI
|
||||
## before the server confirms. If the server rejects the pick, the pending prompt
|
||||
## still exists server-side — re-fetching state makes GameGetStateHandler re-push
|
||||
## it so the player is never stuck without a prompt.
|
||||
const _PROMPT_RESPONSE_TYPES: Array[String] = [
|
||||
"game.triggered_target", "game.cost_pick", "game.cost_group_pick",
|
||||
"game.action_group_pick", "game.branch_pick", "game.target_pick",
|
||||
"game.tile_pick", "game.player_pick", "game.reveal_choice_pick",
|
||||
]
|
||||
|
||||
func _game_request(msg_type: String, extra: Dictionary) -> void:
|
||||
var payload := { "sessionId": session_id }
|
||||
payload.merge(extra)
|
||||
@@ -480,7 +508,9 @@ func _game_request(msg_type: String, extra: Dictionary) -> void:
|
||||
_apply_state_from_payload(p),
|
||||
func(code: String, msg: String) -> void:
|
||||
if debug_output:
|
||||
print("[Game] ERR ", msg_type, " code=", code, " msg=", msg))
|
||||
print("[Game] ERR ", msg_type, " code=", code, " msg=", msg)
|
||||
if msg_type in _PROMPT_RESPONSE_TYPES:
|
||||
_fetch_state())
|
||||
|
||||
|
||||
func _apply_state_from_payload(p: Variant) -> void:
|
||||
|
||||
Reference in New Issue
Block a user