672 Commits
Author SHA1 Message Date
dingo 44f61f764e bugfix 2026-07-06 06:42:53 -04:00
dingoandClaude Fable 5 4961696fee 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>
2026-07-04 06:23:17 -04:00
dingo b96b8b89c0 Fable test 2026-07-02 13:09:05 -04:00
ed300d4e4f Fix build: move CardSalvageValues to SOR.Database
SOR.Bazaar has no project reference to SOR.Collection, so the using
in BazaarGetSuggestedPriceHandler caused CS0234.

- Move CardSalvageValues class to SOR.Database (shared by both assemblies)
- Replace SOR.Collection/CardSalvageValues.cs with a global using alias
  so Collection handlers continue to work without changes
- Update BazaarGetSuggestedPriceHandler to use SOR.Database instead of SOR.Collection

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-04 09:47:28 -04:00
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
91ba3d094d Add verbose debug logging to ability system for cost/effect diagnosis
- AbilitySystem: add static ILogger + InitLogger(ILoggerFactory)
- Log [ABILITY] START/END with actor ST/SP, PayCostGroup before/after,
  ExecuteActions entry count
- Log [COST] SacrificeTokens/SpiritPoints before and after deduction
- Log [EFFECT] SummonToken coord, tile state, token affinity, every
  silent break path, and SUCCESS with ST at placement time
- Program.cs: call AbilitySystem.InitLogger at startup
- appsettings.json: add Debug override for SOR.Game.AbilitySystem

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 12:15:44 -04:00
88a68a1443 Update Delta-Sync-flow.md to reflect all 6 fixes as implemented
- §2 UnitDelta: note Art2dUrl/ModelUrl removed; only in UnitSnapshot
- §6 Push Decision: note spectator registry is now Redis-backed
- §9 Push Dispatch: note _fetch_state is guarded by _syncing flag
- §11 _merge_unit_delta: remove stale art2dUrl/modelUrl snippet; add note
  that URLs are applied once on unitsAdded and stay on the unit dict
- §12 Fallback/Resync: update _fetch_state row (_syncing guard, session-id
  validation); update arch spirit null row (is Dictionary guard)
- §14: replace "Known Issues & Planned Fixes" with "Fixes Applied" —
  documents all 6 commits with root cause, resolution, and files changed

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 06:06:22 -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
14a467dc69 Fix 1: Move SpectatorRegistryService from in-memory to Redis Sets
Spectator registrations were held in a per-process ConcurrentDictionary,
causing spectators to miss updates when game actions were handled by a
different pod than the one that processed game.spectate.

Changes:
- SpectatorRegistryService: replace ConcurrentDictionary with Redis Set
  operations (SADD/SREM/SMEMBERS/DEL) via IConnectionMultiplexer.
  All four methods are now async (RegisterAsync, UnregisterAsync,
  GetSpectatorsAsync, RemoveSessionAsync). TTL of 24h on each SADD
  for self-expiry on abnormal session end.
- RedisKeys: add SpectatorSet(Guid sessionId) -> "spectators:{id}"
- SOR.Game.csproj: add StackExchange.Redis package reference
- GameHandlerBase: all GetSpectators/RemoveSession call sites updated
  to await the new async methods (BroadcastToAllViewersAsync,
  PushStateToPlayersAsync x3, FinalizeGame x2, BroadcastPlayerEliminated)
- GameSpectateHandler: await RegisterAsync
- GameStopSpectatingHandler: make HandleAsync truly async, await UnregisterAsync
- ServiceRegistration: update comment to reflect Redis backing

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:47:15 -04:00
e5cfbae7bd Add Delta-Sync-fix-plan.md: implementation plan for 6 delta-sync bugs
Fix 1: SpectatorRegistryService → Redis sets (SADD/SREM/SMEMBERS/DEL)
Fix 2: get_unit_by_id null crash → is Dictionary guard pattern
Fix 3: Audit DiffTiles no-change guard completeness (server verify)
Fix 4: Strip modelUrl/art2dUrl from UnitDelta record and DiffUnit
Fix 5: iOS Safari scoped asset loading, ModelCache eviction, lazy load
Fix 6: _fetch_state race → _syncing flag + session-id guard in _apply_state_from_payload

Includes per-fix root cause table, exact file/class/line, code before/after,
execution order rationale, and full files-changed summary.

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:20:04 -04:00
47effec8d6 Add §14 Known Issues to Delta-Sync-flow.md: bugs and planned fixes
- Issue 1: SpectatorRegistryService is in-memory per-process; spectators
  miss updates in scaled deployments due to load-balancer routing mismatch.
  Fix: move registry to Redis.
- Issue 2: get_unit_by_id null crash when arch is null (not absent) on
  player disconnect. Fix: use 'is Dictionary' guard instead of .get({}).
- Issue 3: ChangedTiles must only include actually-changed tiles; fix is
  server-side only.
- Issue 4: modelUrl/art2dUrl sent in every UnitDelta; strip from delta,
  derive from card definition; iOS Safari: cache on first sight.
- Issue 5: iOS Safari memory crash from unbounded asset cache; layered
  fix: scoped loading, lazy load, disk cache for non-iOS, evict on removal.
- Issue 6: _fetch_state() race on version gap; fix with _syncing flag.
- §12: clarified IsEmpty should never fire in practice (MP always regenerates).

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 17:23:50 -04:00
7dba78ea67 Expand Ruin-flow.md: failure modes, randomness note, disable timeline, cross-links
- §18: failure-mode table covering all error paths (NO_VALID_RUIN_TILE,
  CANNOT_CHANNEL_RUIN, null/malformed AbilitiesJson, invalid relocate dest, etc.)
- §19: randomness & determinism note — Random.Shared is non-deterministic;
  replay tests need tolerance or a seeded/mock RNG
- §20: disable-duration turn-boundary example with concrete timeline (set T5 → disabled T6/T7 → re-enables T8)
- §21: See Also cross-links to Ability-flow.md and Delta-Sync-flow.md
- §9: added row flagging non-deterministic tile/ability selection (→ §19)
- TOC updated with sections 18-21

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 13:53:56 -04:00
0d24a11bcf Add Ruin-flow.md: end-to-end ruin system reference
Covers data model, channeling flow, FireRuinAbilities activation logic,
priority/ordering rules, ruin-specific effects, observer triggers,
double-fire guard (6-D), network deltas, and full client handling.

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 13:24:35 -04:00
85508ef3e9 Expand Ability-flow.md: error paths, delta sync, trigger ordering, cost atomicity, gotchas, JSON examples
Adds six new sections:
- §23 Failure/Error paths — all GameException codes with line refs, client error propagation behavior
- §24 State version & delta sync — full vs delta push decision, client version gap handling, _fetch_state
- §25 Trigger re-entrancy & ordering — no depth guard, iteration order, TriggerLimit as only loop protection
- §26 Cost atomicity & rollback — costs-before-effects invariant, interactive pause semantics, no rollback
- §27 Known caveats & gotchas — line drift, ActionGroup/Actions exclusivity, ChooserRole defaults, error opacity
- §28 Minimal JSON examples — Active, Triggered with PendingTriggeredTarget, OR ActionGroup with chooser

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 12:57:44 -04:00
4e3c197442 Add Ability-flow.md: end-to-end ability system reference
Documents the full ability lifecycle — data models, all four ability types
(Active/Passive/Aura/Triggered), ActionGroup resolution, target resolution,
effect execution, interactive pause states, cost handling, duration tracking,
network message flow, and client-side targeting with line numbers throughout.

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 11:59:19 -04:00
150a20b0ab Fix Delta-Sync-flow.md: add effectsJson, clarify line number stability
- Section 11: add missing effectsJson field to _merge_unit_delta snippet
- Section 11: add note that line numbers drift; prefer symbol names for navigation

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 09:13:25 -04:00
83217c630e Add Delta-Sync-flow.md: end-to-end delta sync reference
Documents the complete delta lifecycle from server action handler
through GameStateDiffer computation, PushStateToPlayersAsync dispatch,
Redis transport, and client-side application in Game.gd/_apply_delta.
Includes line numbers, code snippets, wire types, and design invariants.

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 07:46:55 -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 5756e2187a Preserve model fallback for cloned SpiritTokens 2026-05-12 07:55:47 -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
469e72b0f6 Fix GamePlayCardHandler card lookup and visual target fallback
Medium: replace .First() with .FirstOrDefault() ?? throw new
GameException("CARD_NOT_IN_HAND") so a bad/stale CardInstanceId
produces a normal game error instead of a raw InvalidOperationException.

Low/Medium: ComputeVisualTargets fallback now uses GameState.GetEnemyIds
which filters by different TeamIndex and !IsEliminated, preventing the
placeholder projectile from targeting an ally or an already-eliminated
player in team and multiplayer modes.

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 21:05:14 -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
8325370069 Add iOS Safari memory crash fix draft v2
Patches all 8 gaps from code review: CONNECT_ONE_SHOT replaces no-op
signal clear, evict_all flushes pending callbacks, disk-cache hits queue
correctly without re-downloading, pool reset covers transform/meta/groups,
pool size is capped, instrumentation added, _exit_tree cleanup added to
unit_mesh_builder for both tweens and pool nodes.

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 09:54:54 -04:00
f45df0cf86 Add iOS Safari memory crash fix draft
Documents root cause (WKWebView WASM heap exhaustion), four proposed
fixes (download throttle, cache eviction, tween tracking, unit pooling),
and a write-up of how each fix addresses the 60s crash and the rejoin loop.

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-08 20:09:58 -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
f7fc4fbdd3 Re-apply aura effects at turn start for units already in range
ModifyMP(Current) and similar per-turn aura bonuses were only applied
once when a unit entered the aura range. The CurrentMp reset at turn
start wiped the bonus without re-applying it.

Added ReapplyAurasAtTurnStart which strips stale tracked effects
(without reversal — the stat reset already undid them) and re-applies
ApplyAuraEffects for active-player units still in range. Called in
NextTurn after the Mp/Defense restore and ExpireActiveEffects.

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-07 14:58:00 -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