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>
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>
- 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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
- 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>
- 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>
- 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>
- New Settings.draw_card_popup bool (default true, persisted)
- Toggle in InGameSettings under Gameplay: "Show drawn card popup"
- _rebuild_hand detects brand-new cards and queues them in
_pending_popup_cards instead of adding to hand immediately
- _show_next_card_popup builds a CanvasLayer overlay (layer 20) with a
dimmed background + full-size card widget; click card or background to
dismiss
- _dismiss_card_popup pops the queue, adds the card to hand via
_apply_display_hand in server order, then shows the next queued popup
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>
- _rebuild_hand now diffs existing widgets against new hand: only removes
cards that left, only creates widgets for cards that arrived; everything
else stays in place with no rebuild flash
- New card widgets snap to their fan position on first layout instead of
tweening from (0,0), eliminating the slide-from-corner jitter on draw
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>