Commit Graph
343 Commits
Author SHA1 Message Date
47808074ef Add card salvage system and player storefront / trading features
Server:
- CardSalvageValues: rarity-base + (SpCost+StCost)*CostMultiplier formula, foil 2x
- CollectionSalvageCardHandler: collection.salvage_card — validates ownership,
  tradeable, not listed, deck copy check, then atomically deletes card + credits OP
- BazaarGetPlayerShopHandler: bazaar.get_player_shop — paginated active listings
  for any seller with their display name (public read endpoint)
- BazaarGetSuggestedPriceHandler: bazaar.get_suggested_price — recent sale avg
  if ≥3 sales, otherwise 4× salvage floor
- Added GetPlayerShopRequest/Response + GetSuggestedPriceRequest/Response DTOs
- Added SalvageCardRequest/Response DTOs
- Registered all 3 new handlers in their respective ServiceRegistration files

Client:
- card_detail_popup: List for Sale form (with live price suggestion) + Salvage
  button with OP preview; both gated on IsTradeable
- salvage_confirm_popup: confirmation modal that calls collection.salvage_card,
  emits confirmed(player_card_id, op_awarded) on success
- bazaar_screen: My Shop tab (own active listings + cancel), player storefront
  search by account ID, sort options for own listings

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>
2026-06-03 20:13:43 -04:00
dfccd091fd Fix AI opponents in FreePlay 3+ player lobbies
- Remove max_players == 2 gate; use per-seat Add AI buttons in the
  additional players panel instead of the guest-slot button
- Fix seat-indexed panel rendering: unified loop over all additional
  seats detects AI slots, human players, and empty seats correctly
- Add _ai_adding guard to prevent concurrent add-AI requests that
  caused the server race (second request overwrote first AI slot)
- Fix push handler reading wrong key ("slots" → "currentAiSlots")
  which wiped ai_slots on every push, leaving only the newest AI
- Fix ACK handler reading wrong keys ("aiId"/"displayName" →
  "aiAccountId"/"aiDisplayName")
- Server: fix all-ready check that required GuestAccountId.HasValue,
  blocking start for no-guest lobbies filled via AdditionalPlayersJson
- Server: fix StartGameAsync null-deref on GuestAccountId and add
  no-guest branch (host=P1, first additional=P2, rest=seats 2+)

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>
2026-05-26 16:51:01 -04:00
dingo 32693d303b Client selection fixes 2026-05-22 14:18:18 -04:00
7e22d875f6 Fix 6: _fetch_state race — _syncing guard and session-id validation
- Add _syncing: bool flag; _fetch_state() returns immediately if a
  game.get_state request is already in-flight — prevents multiple
  concurrent full-sync requests on poor connections or reconnect bursts
- _syncing cleared in both success and error callbacks, and in _clear_state()
  so it resets cleanly when the session ends
- _apply_state_from_payload: reject responses whose sessionId doesn't match
  the current session_id, discarding stale full-state responses that were
  in-flight when the player left or started a new game

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>
2026-05-21 05:53:40 -04:00
c8c3666d26 Fix 5: iOS Safari scoped asset loading and memory management
- New Platform.gd autoload: is_ios_safari() detects iPhone/iPad Safari
  via JavaScriptBridge UA check (no Chrome/CriOS), gating all iOS memory paths
- ModelCache.release_model(url, etag): evicts a model from in-memory cache
  on iOS Safari when a unit leaves the board; no-op on other platforms so
  disk cache is always preserved for fast reload
- unit_mesh_builder: stores resolved model URL+ETag per unit (_unit_model_urls,
  _unit_model_etags); calls ModelCache.release_model in the to_remove loop so
  PackedScene refs are freed as soon as the unit is pooled or freed
- ContentCache.get_model_url_for_definition: stub for looking up a card's
  Model3D CDN URL without a loaded unit dict (foundation for future eviction paths)

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>
2026-05-20 22:35:05 -04:00
93e3c8b0db Fix 4: Remove Art2dUrl/ModelUrl from UnitDelta
These URLs are fixed for the lifetime of a card definition and are
already delivered once in the initial UnitSnapshot (CardInstanceDto).
Sending them again in every UnitDelta was wasting bandwidth on every
stat change, move, and attack.

Server:
- GameStateDiffer.DiffUnit: remove Art2dUrl/ModelUrl from the anyChange
  detection block and from the UnitDelta constructor call
- GameMessages.UnitDelta record: remove string? Art2dUrl and ModelUrl
  fields (CardInstanceDto/UnitSnapshot retains both — first placement
  delivery is unaffected)

Client:
- Game.gd _merge_unit_delta: remove the five URL merge lines
  (art2dUrl, Art2dUrl, modelUrl, ModelUrl, modelurl). Values on the
  unit dict are set once via unitsAdded and stay for the unit's lifetime.

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>
2026-05-20 20:34:30 -04:00
e7bf25759f Fix 2: Guard against null archSpirit in get_unit_by_id and _apply_delta
GDScript dict.get(key, fallback) only returns the fallback when the key
is absent. When a player disconnects the server sets archSpirit to null
(key present, value null), so .get("archSpirit", {}) returns null and
the next .get("instanceId") call crashes with 'Nonexistent function
get in base Nil'.

- get_unit_by_id (~line 276): replace typed Dictionary assignment with
  Variant + 'is Dictionary' guard (same pattern already used correctly
  in get_all_enemy_units)
- _apply_delta §7 (~line 633): replace typed Dictionary assignment with
  Variant + null/type guard before casting; null or non-Dictionary
  triggers request_sync() the same as an empty baseline would

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>
2026-05-20 19:57:59 -04:00
dingo 41c18da1ed Update client screens and deck editor 2026-05-19 17:16:19 -04:00
dingo 8439f287b4 Normalize tiny unit model scale 2026-05-12 16:07:25 -04:00
dingo db1c3558d8 Refine ability panel availability 2026-05-12 14:21:11 -04:00
dingo cf6b3a3733 UI Cache issue 2026-05-12 09:55:56 -04:00
dingo ab3c14dd3d Selection issues, model issues, ability bug 2026-05-12 09:28:15 -04:00
dingo c8f2b5f330 Handle token model URL casing variants 2026-05-12 07:47:26 -04:00
dingo d0983cbbcd Fix null token model URL fallback 2026-05-12 07:41:07 -04:00
f3e5363c13 Fix SummonToken tile-filter validation: reject bad picks before costs are paid
Three bugs fixed for abilities like Demonate Leviathan (SummonToken + TileFilter):

1. Server: AbilityUsesThisTurn was incremented (and costs paid) before effect-level
   TileFilter validation ran. Added PreValidateClientTileTargets() called before the
   use-count increment so an invalid tile pick wastes no uses and no sacrificed tokens.

2. Server: SummonToken silently break'd when TileFilter or token-affinity check failed,
   giving the client no error. Changed both to throw GameException("INVALID_TILE").

3. Client: tile_passes_filters() only checked the target selector's filters, not the
   effect-level TileFilter (e.g. SummonToken.tileFilter). Added _collect_effect_tile_filters()
   and TileAffinityMatches handling so invalid tiles are never highlighted or accepted.

Also includes: Art2dUrl/ModelUrl deltas in GameStateDiffer/GameMessages/GameEngine,
unit_mesh_builder token-model URL fallback + shader/tint helpers, ModelCache v3 bump,
Game.gd unit delta merging for art2dUrl/modelUrl.

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>
2026-05-12 07:06:54 -04:00
3bbf419836 Add generic active-ability placeholder VFX (game.visual.ability_placeholder)
Server:
- Add AbilityPlaceholderVisualPush DTO (sourceInstanceId, abilityName,
  sourceAffinity, targets, targetMode: Self|Unit|Tile|PlayerZone|None)
- Promote ComputeVisualTargets to GameHandlerBase (protected static)
- Add ComputeAbilityVisualTargets — extends Repentance logic with
  Self/ExactSelf + All-count detection, falls back to enemy ArchSpirit
- Add ComputeAbilityTargetMode — derives mode from visual targets +
  sourceInstanceId (PlayerZone when target is a player account ID)
- Add FindSourceUnit helper — searches Field + ArchSpirit across all players
- GameActivateAbilityHandler captures source unit + ability def before
  ActivateAbility, skips push when Animation.AssetUrl is set

Client:
- Add ability_placeholder_visual signal and push router case in Game.gd
- New AbilityPlaceholderFx component: Self/None → radial glow burst + two
  expanding rings on source; Unit/Tile/PlayerZone → orb projectile from
  source unit body to resolved target, impact ring + burst motes on arrival
- Wire component in game_screen.gd (_ready, _exit_tree, handler)

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>
2026-05-11 22:59:57 -04:00
a26c99ce4a Fix Repentance placeholder VFX: targets, colors, animation check
High: server now computes visual targets after resolution — prefers
client-provided unit InstanceId or tile Coord, falls back to the first
live opponent ArchSpirit so targetless/server-resolved effects always
have a destination.

Medium: source ArchSpirit fallback now looks up the actor's player
in game state rather than get_my_player(), fixing opponent and
spectator views.

Medium: player color now uses teamIndex from the player DTO instead
of deriving it from seatOrder, fixing team and multiplayer modes.

Low: hasCustomAnimation check now scans all Active ability definitions
for a non-empty AssetUrl, not just abilities[0].

Low: server no longer sends the push (or the HasCustomAnimation field)
when a custom animation exists; client-side guard removed accordingly.

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>
2026-05-11 19:48:20 -04:00
0a20b9880f Add Repentance placeholder VFX — server broadcast + client effect
Server:
- Add RepentancePlaceholderVisualPush DTO to GameMessages.cs
- Add BroadcastToAllViewersAsync helper on GameHandlerBase
- GamePlayCardHandler emits game.visual.repentance_placeholder to all
  players and spectators after a Repentance card resolves; sets
  hasCustomAnimation based on ability Animation.AssetUrl presence

Client:
- Add repentance_placeholder_visual signal and push-router case in Game.gd
- New RepentancePlaceholderFx component: resolves source/target world
  positions, picks affinity + player team colors, tweens a glowing orb
  projectile to target and plays a torus ring + burst-mote impact
- Wire component in game_screen.gd (_ready, _exit_tree, signal handler)

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>
2026-05-11 16:06:51 -04:00
ea840b45d1 Fix 6: don't kill shader tweens on rebuild — fixes stuck materialize effect
Fix 3 killed all shader tweens at the top of every rebuild_units() call.
This interrupted materialize/ascend-arrival tweens mid-animation for units
that were staying on the board. Because tween.kill() skips the completion
callback, the mi.material_override was never restored, leaving every model
permanently frozen in the reveal=0..1 shader state with no actual mesh
visible.

Tweens run to completion naturally. The WeakRef + is_instance_valid guards
inside each tween callback already handle pooled/freed nodes safely, so
there is no leak when a unit is removed while its tween is still running.
_exit_tree() still kills all tweens on scene teardown.

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>
2026-05-10 17:24:34 -04:00
2325a53f0e Fix 5: guard against stale ModelCache callbacks on re-channeled spirits
When a spirit is returned to hand and re-channeled, the old in-flight
ModelCache.load_model() callback could fire after the unit was pooled and
re-created, clobbering the new placeholder and causing the 3D model to
not appear. The browser logged "!is_inside_tree()" hundreds of times/sec
as a result.

Fix: add a per-unit load-generation counter (_unit_load_gen). Each call
to add_unit_mesh() increments the counter and captures it in the closure.
The callback checks on entry whether the generation still matches; if not,
it treats itself as stale, frees the downloaded model_node, and returns
without touching any scene state.

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>
2026-05-10 16:06:55 -04:00
4f8aba5116 Apply Fix 4: pool unit nodes instead of allocating fresh ones
Adds _pool_unit() / _acquire_from_pool() keyed by card_type.
_ready() creates an off-tree _pool_root node to hold retired bodies.
_pool_unit() frees MeshInstance3D children immediately then reparents
the StaticBody3D shell to _pool_root; overflows beyond _MAX_POOL_PER_TYPE
are freed() synchronously to cap memory. _acquire_from_pool() fully
resets transform, collision layers, groups and stale metadata before
reparenting back to units_root. rebuild_units() now calls _pool_unit()
instead of queue_free() for normal unit removal. add_unit_mesh() tries
the pool first; fresh allocs still get a new CollisionShape3D added once.
_exit_tree() frees _pool_root (and all pooled children) on scene teardown.

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>
2026-05-10 09:50:36 -04:00
3c3e479878 Apply Fix 3: track and kill shader tweens on rebuild
Adds _active_tweens list to UnitMeshBuilder. Both materialize and
dissolve shader tweens are appended on creation and auto-erased via
CONNECT_ONE_SHOT on finish. rebuild_units() kills all tracked tweens
before diffing so ShaderMaterial refs are released immediately instead
of up to 1.35s later. _exit_tree() kills remaining tweens on scene
teardown to prevent refs surviving a mid-animation forfeit or disconnect.

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>
2026-05-09 19:47:59 -04:00
b926957329 Apply Fix 2: evict ModelCache on game exit, flush pending callbacks
Adds evict_all() to ModelCache which sets _shutting_down before flushing
_pending with null callbacks, then clears _mem and _job_queue. This
prevents in-flight HTTP completions from firing into a freed game scene
and ensures each new game starts with a clean WASM heap. Called from
game_screen._exit_tree() after all signal disconnections.

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>
2026-05-09 19:18:10 -04:00
30a4211276 Apply Fix 1: throttle ModelCache parse/download jobs
Caps simultaneous GLB parses and HTTP downloads at _MAX_JOBS=4 via a
shared job budget. Disk-cache hits when slots are full queue as
parse_from_disk:true and drain correctly without re-downloading. Replaces
the no-op get_signal_connection_list().clear() with CONNECT_ONE_SHOT.
Adds _shutting_down flag so evict_all() can null-out pending callbacks.
Adds debug-gated logging on all hot paths.

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>
2026-05-09 18:26:01 -04:00
dingo a5e1dde029 Aura bubbles remain after mob removed from board, until a new tile is clicked 2026-05-08 15:54:53 -04:00
dingo 9f15cf1e74 Turning off JSON Debug for Game Scene. 2026-05-08 15:31:48 -04:00
dingo 47cd4fb097 Revamp duel game HUD 2026-05-08 15:19:40 -04:00
dingo 8cd71b838c Refine tile drawer double-click behavior 2026-05-08 11:16:47 -04:00
dingo 6e13128dd8 Add aura range bubble overlay 2026-05-07 14:55:48 -04:00
dingo 11c1fcb13a Refactor game HUD scenes and harden attack checks 2026-05-07 13:38:19 -04:00
dingo 3be1099d93 Add spirit and affinity transition effects 2026-05-07 13:31:57 -04:00
dingo f6210caef4 Stabilize hand click-through and spin controls 2026-05-07 13:25:33 -04:00
5482dedcbe fix(game): centralize death resolution, reorder UnitAttack trigger, clear Position on zone transitions
- FireTrigger(UnitAttack) now fires BEFORE ApplyDamage so triggered abilities
  can modify attacker/target stats before damage lands
- AbilitySystem.KillUnit is now leader-aware: killing an ArchSpirit (in field
  or ArchSpirit slot) calls GameEngine.EliminatePlayer instead of silently failing
- MoveToDiscard and RemoveFromAllZones both clear Position = null on zone transitions
- RemoveFromAllZones guards against direct ArchSpirit removal (throws InvalidOperationException)
- EliminatePlayer made internal for cross-class access from AbilitySystem
- Client: improved JSON parsing error handling in Network.gd; debug_output enabled in Game.gd

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>
2026-05-05 15:58:45 -04:00
dingo 7d5bd6cbd8 Legal docs draft and Client refactor 2026-05-05 11:58:09 -04:00
dingo 020730bc9c Client fixes 2026-04-30 23:30:25 -04:00
dingo ee21346fb0 Client fixes, and ability fixes 2026-04-30 19:27:52 -04:00
b985445ae9 fix(game): revert UntilEndOfTurn effects on ArchSpirit targets; add action-level duration to ability builder
- ApplyReversal and TickActiveEffects were searching p.Field/Hand/Deck/Discard
  but not p.ArchSpirit, so effects applied to an ArchSpirit (e.g. SetCanBeAttacked=false
  from "Branch Between Fangs") were never reverted — the tracking entry was removed
  but CanBeAttacked stayed false permanently
- Fixes by adding p.ArchSpirit to the target lookup in both functions, matching
  the existing pattern in FindTargetByRef
- AbilityBuilder: add action-level Duration field to ActionDraft, compile/parse it
  in CompileActionNode/ParseActionNode, and expose a UI dropdown on each action
- ClearOnLeave now defaults to true in AbilityDefinition and AbilityBuilder
- Instinct/Repentance card click now correctly enters ABILITY_TARGET mode

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>
2026-04-29 07:20:51 -04:00
7cbea2b907 feat(collection): replace paginated collection browser with full owned map
Adds collection.get_owned endpoint that returns { definitionId → count }
for the player's entire collection in a single DB round-trip. The client
caches this map and filters/sorts entirely client-side using definitions
already in ContentCache, eliminating all pagination and "load more" UI.

- Search, type, and affinity filters now work across the full collection
  instantly with no network round-trips
- deck_editor_panel: arch spirit picker also uses the owned map —
  removes a separate collection.get_cards request
- cards_view: same pattern, grid rebuilds client-side on filter change
- CollectionCache: persists owned map to disk (owned.json per player)

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>
2026-04-28 17:20:49 -04:00
7884051cad fix(init): prevent stale sync timeout from firing after reset
SceneTreeTimer callbacks captured _sync_timeout by reference rather
than by identity, so a replaced timer's closure still passed the
null-check and called _on_sync_failed even though progress was
actively arriving. Fix by capturing the timer instance in the closure
and bailing out if _sync_timeout no longer points to it.

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>
2026-04-28 17:19:26 -04:00
7a917cf93b fix(ability-prompts): fix 3 client wiring gaps
1. JSON case normalization
   Parse CostGroupJson, ActionGroupJson, BranchesJson, RevealedCardsJson
   through _normalize_keys in game_screen.gd — server serialises these
   inner payloads with _jsonOpts (no naming policy = PascalCase), but the
   client was reading lowercase keys, producing empty option lists.

2. Cost pick candidate list
   - Add CandidatesJson to PendingCostPick; populated in AbilitySystem.PayCosts
     with the actor's eligible cards (hand for DiscardFromHand, field spirits
     for SendSpiritFromBattlefieldToDiscard / DealDamageToOwnSpirit).
   - Thread CandidatesJson through CostPickRequestPush → GameHandlerBase push.
   - Client _on_cost_pick_request now uses candidatesJson from the push instead
     of Game.get_my_player().hand, fixing opponent-pick and battlefield-cost UIs.

3. Reconnect recovery via game.get_state
   - Extract all pending-prompt pushes into static PushPendingPromptsAsync in
     GameHandlerBase (called from PushStateToPlayersAsync as before).
   - Inject IClientPush into GameGetStateHandler; call PushPendingPromptsAsync
     after building the reply so any active pause prompt is re-sent to the
     chooser on manual state sync / reconnect.

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>
2026-04-21 17:13:04 -04:00
c45db289ad feat(ability-prompts): wire all 8 pending pick types end-to-end
Server:
- GameMessages.cs: add push DTOs for CostGroupPick, ActionGroupPick,
  BranchPick, TargetPick, TilePick, PlayerPick, RevealChoicePick
- GameHandlerBase.PushStateToPlayersAsync: push all 8 pending types
  (including existing CostPick which was missing its push) to the
  chooser player after every state update and on reconnect

Client:
- Game.gd: add 8 signals, 8 send functions, 8 push routes matching
  game.ability.{cost,cost_group,action_group,branch,target,tile,player,
  reveal_choice}_pick_request
- game_screen.gd: add handlers for all 8 types:
  - cost_pick: hand-card selection panel with confirm
  - cost_group_pick / action_group_pick: option-button panels
  - branch_pick: same UI as local ChooseOne but sends game.branch_pick
  - target_pick: reuses ABILITY_TARGET mode, flag routes to game.target_pick
  - tile_pick: highlights valid tiles, click sends game.tile_pick
  - player_pick: player-button panel from server-supplied validPlayerIds
  - reveal_choice_pick: click-to-order card list, sends game.reveal_choice_pick

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>
2026-04-21 17:02:12 -04:00
2d9e9e7347 feat(phase6-AB): Ruin client preflight check and channel confirmation dialog
Phase 6-B — Preflight check in _channel_ruin():
Iterate board tiles before sending play_card; skip any tile that already
has a ruinId (non-null, non-empty) or that doesn't match the card's
affinity. If zero valid tiles exist, show an AcceptDialog
"No valid tile available for this Ruin." and abort the send.

Phase 6-A — Confirmation dialog in _confirm_channel_ruin():
After passing preflight, show ConfirmationDialog "Channel Ruin /
Ruin placement is random. Continue?" with Channel / Cancel buttons.
Only calls Game.send_play_card on explicit confirm.

Replaces the previous immediate Game.send_play_card(iid, 0, 0) on click.
Follows the existing _confirm_ascend / _confirm_transition dialog pattern.

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>
2026-04-20 14:13:05 -04:00
8f3911e881 feat(ability): implement AbilityBuilderR3 + engine additions
Engine:
- AbilityDefinition: add SourceZoneGate (zone-restricted triggers) and TriggerLimitPerGame
- Effects: add StatModOperator (Add/Subtract/Multiply/Divide/Percent) on all stat mod effects; reversal stored as delta
- Action/CostEntry: add CostPickMode enum (Random/SelfPick/EnemySeePick/EnemyRandomPick/EnemyPick)
- PendingCostPick: new model for interactive cost pause/resume (mirrors PendingTriggeredTarget)
- GameState: PendingCostPick field
- GameMessages: CostPickRequestPush, GameCostPickRequest, GameCostPickResponse records
- AbilitySystem: FireTrigger scans Hand/Discard/Deck when SourceZoneGate set; per-game trigger limit tracking; ApplyStatOperator helper; PayCosts/ResumeCostPick for interactive cost flow
- GameCostPickHandler + ServiceRegistration wiring

Admin:
- AbilityBuilderR3.razor: full ability builder at /cards/ability-builder-r3 (39 triggers, 69 effects, 32 conditions, form/canvas/mermaid modes, compiles to engine-native $type JSON)
- AbilityBuilderR2-Draft.razor: fix switch expression no-best-type error

Docs:
- BuilderR3.md: master plan document

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>
2026-04-18 20:15:13 -04:00
dingo f966643e31 Spectator fix 2026-04-15 13:35:15 -04:00
dingo abf2c1d96c AI Match fix 2026-04-15 12:51:14 -04:00
afa9e73489 fix(hand): scroll throttle, deselect on spin/click-outside for all card modes
- Throttle hand scroll to one step per 150 ms so each wheel tick advances exactly one card
- Deselect selected card when clicking outside the hand area (deferred flag pattern so board clicks still play the card)
- Extend spin and click-outside deselect to cover TERRAMORPHA_SELECT and card-triggered ABILITY_TARGET (Repentance/Instinct), not just CARD_FROM_HAND
- Show Repentance/Instinct cards as visually selected in hand when in ABILITY_TARGET mode
- Drop stale spectator state_update pushes from wrong sessions
- Auto-create missing audio buses on Settings._ready to avoid bus-not-found errors

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>
2026-04-15 09:31:30 -04:00
573d8cf727 fix(spectate): move Game signal connections to top of _ready, null-safe IIDs
- Game.state_updated (and other game signals) now connected before any UI
  setup that could error. Previously they were at line ~340, after hand spin
  button setup — if anything between _configure_hand_spin_buttons and those
  connects threw, spectators would never receive live state pushes (no player
  actions to trigger ACK-based updates as fallback)
- _rebuild_hand now uses str(raw) if raw != null else "" for IID extraction;
  card.get("instanceId", "") returns null (not the default) when the key
  exists with a null value, which would error on append to Array[String]

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>
2026-04-14 23:42:28 -04:00
8649384997 fix(spectate): restore _rebuild_hand for spectators, fix typed Array filter
- Removed the outer _is_spectating guard on _rebuild_hand; blocking it
  entirely left _cached_hand_iids stale and skipped other bookkeeping
- Spectator early-exit now inside _rebuild_hand after updating the cache,
  clearing the display hand cleanly
- Replaced Array[Dictionary].filter() (returns untyped Array, silent type
  mismatch on reassignment) with explicit loops into typed Array[Dictionary]
- Same fix for the display_hand build: explicit typed loop instead of
  hand.filter() with Variant cast

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>
2026-04-14 23:30:37 -04:00
286ccf26c7 fix(spectate): skip hand rebuild and clear draw popups when spectating
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>
2026-04-14 23:24:28 -04:00
cbf1ff2ad5 fix(ui): move InGameSettings to CanvasLayer 15 so it renders above all HUD
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>
2026-04-14 23:13:17 -04:00