Commit Graph
175 Commits
Author SHA1 Message Date
23643d0934 Fix ArchSpirit ability activation + Ownership:Target auto-resolution
- AbilitySystem.cs: ActivateAbility was only searching player.Field for the
  source unit, but player.ArchSpirit is stored in a separate field and was never
  checked. Active abilities on an ArchSpirit now work correctly.

- game_screen.gd: Add "Target" to auto_ownerships so the client skips the
  player-picker UI for Ownership:Target actions. The server auto-resolves them
  from ctx.ResolvedTargets (the owner of the previously targeted card), which
  is exactly what Bounce needs: refund SP to the owner of the returned spirit
  without asking the user to choose a 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-03-22 10:42:56 -04:00
3894fbdd16 Fix @onready null crash: add_child before setup() across all scene rows
@onready vars are resolved when a node enters the scene tree. Calling setup()
before add_child() means all %NodeName refs are still null, causing
"Invalid assignment... on base object of type Nil" errors.

Fixed ordering in every affected screen:
- free_play_screen.gd: LobbyBrowserRow, ActiveGameRow, DeckPickerButton
- lobby_room_screen.gd: RulesEditorDialog
- matchmaking_screen.gd: DeckPickerButton
- card_detail_popup.gd: StatRow, AbilityRow
- starter_deck_screen.gd: StarterDeckCard
- account_screen.gd: NotificationRow
- leaderboard_screen.gd: LeaderboardRow

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-03-22 10:36:01 -04:00
d27c7f67c3 Debug delta diffing: add diagnostics + empty-delta fallback
- All game action handlers: move ToDto() call to after SaveStateAsync()
  so the ACK's StateVersion matches the pushed delta (stale-version fix)
- GameHandlerBase.PushStateToPlayersAsync: add empty-delta safety fallback
  — when ComputeDelta() returns all-null content fields, fall back to a
  full game.state_update push so clients always see the correct state
- Add Console.WriteLine diagnostics to PushStateToPlayersAsync to expose
  prev/next phase, turn, active player, and whether prevStateJson matches
  the post-mutation session.StateJson (root cause investigation)
- Game.gd: wire game.activity push to game_activity signal

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-03-21 21:52:45 -04:00
b1a51cb862 Standardize programmatic UI to scene-based instantiation (Phases 1-5)
Convert all screens that built UI nodes in GDScript into proper .tscn
scene files. Each component gets its own scene; parent screens use
preload + instantiate; data flows through setup() methods; actions use
signals. Eliminates ~1000 lines of boilerplate node-creation code.

Phase 1 — Simple row components (6 new scenes):
  LeaderboardRow, NotificationRow, StarterDeckCard, DeckPickerButton,
  StatRow, AbilityRow
  Modifies: leaderboard_screen, account_screen, starter_deck_screen,
            matchmaking_screen, card_detail_popup (GridContainer→VBox)

Phase 2 — Lobby browser rows (2 new scenes):
  LobbyBrowserRow (signal join_requested), ActiveGameRow (signal spectate_requested)
  Modifies: free_play_screen

Phase 3 — RulesEditorDialog (1 new scene):
  Replaces 150+ line _open_rules_editor() in lobby_room_screen with
  4-line instantiate pattern; signal confirmed(overrides)

Phase 4 — DeckEditorPanel.tscn:
  Moves split-pane deck editor into scene file; removes _setup_ui(),
  _make_left_pane(), _make_right_pane(); switches to @onready refs;
  DecksView.tscn updated to instance the scene

Phase 5 — ChatOverlay.tscn:
  Fully populates ChatPanel with header, 7 tab buttons, 7 content panes
  (FriendsPane/PresencePane/GlobalPane/LobbyPane/GamePane/PartyPane/DmsPane),
  and InputBar; removes _build_panel() and all _make_*/_build_*_tab()
  functions from chat_overlay.gd; replaces with @onready refs and
  _ready() wiring from scene children

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-03-21 12:33:15 -04:00
d5d444c31d Live skybox: ambient star cycle when no real games active
Adds a background ambient cycle that spawns 1-2 stars every 5 seconds
(random interval 2.5-5 s) regardless of server activity. Each ambient star
lives 15-30 s before its explosion-fade removal. Uses IDs prefixed with
"~ambient~" to avoid collisions with real session GUIDs. Timer is torn
down cleanly on mode switch and scene exit.

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-03-21 11:29:41 -04:00
88f395e032 Fix _apply_delta crash on null array/dict fields in delta
dict.get(key, default) returns null (not the default) when the key exists
with a null value. Assigning null to a typed Array or Dictionary variable
throws a type error in GDScript 4. Replace all typed var declarations with
untyped vars guarded by 'is Array' / 'is Dictionary' checks so a fully-null
delta (e.g. a stats-only update that sends changedTiles: null) no longer
crashes every game action.

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-03-21 10:25:03 -04:00
b812372514 Fix rule suggestions + placement highlights
- JoinCustomLobbyResponse now includes ActiveRules so the guest's rule editor
  pre-populates from the lobby's current effective rules instead of hardcoded
  defaults; previously all fields in a suggestion were sent as defaults, causing
  accepted suggestions to reset rules to defaults.
- game_screen.gd: placement tile highlights are now re-applied on every state
  update while the player hasn't placed yet, not only on the first entry into
  PLACEMENT mode; fixes highlights disappearing when the opponent places their
  ArchSpirit and a delta arrives mid-placement.

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-03-21 10:22:29 -04:00
97b8391608 Live-star skybox: game activity feed + procedural star sky
Server:
- GameActivityRegistry singleton tracks subscribed clients
- game.subscribe_activity handler: registers client, returns active session IDs
- game.unsubscribe_activity handler: deregisters client
- BroadcastActivityAsync helper in GameHandlerBase (mirrors spectator push pattern)
- GamePlaceArchSpiritHandler broadcasts "started" when both players have placed
- FinalizeGameAsync broadcasts "ended" to all subscribers

Client:
- Settings.skybox_mode: "live" | "cdn" | "off" (default: "live"), persisted to cfg
- Game.game_activity signal forwarded from game.activity push
- game_screen.gd: live mode sets near-black procedural sky; subscribes to activity
  feed; each active session is an emissive sphere star (280-unit radius, blue-white)
  that fades in on start, twinkles via sine tween, and flash-explodes on end
- CDN and Off modes preserved; hot-swap supported mid-game via Settings.settings_changed
- InGameSettings: SkyboxModeOption OptionButton (Live / CDN / Off)

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-03-21 09:49:08 -04:00
5b66f459c0 Add skybox system: admin management + client 3D application
- SkyboxDefinition entity (catalog schema) with static/animated support
- EF migration: catalog.skybox_definitions table
- content.get_skybox_config handler returns active skybox definition
- SkyboxManagerPage.razor: full CRUD admin UI with inline editing,
  activate/deactivate, and animated frame config
- NavMenu.razor: Skyboxes link under Content section
- game_screen.gd: fetches active skybox on ready; applies as
  PanoramaSkyMaterial on WorldEnvironment; animated skyboxes cycle
  frames via Timer; procedural sky kept as fallback when none active

Also fixes inverted camera pan (delta.x / -delta.y signs corrected).

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-03-21 08:55:45 -04:00
cf5089ae50 Delta state system: replace full-push with game.state_delta
After any game action, push a structured GameStateDelta instead of
the full GameStateDto to both players and spectators. Full state is
preserved for: initial connect (game.ready), reconnect/get_state,
spectate ACK, and turn-timer expiry.

Server:
- GameMessages.cs: add GameStateDeltaPush, GameStateDelta, TileDelta,
  UnitDelta, PlayerStatsDelta, GameMetaDelta record types
- GameEngine.cs: make ToCardDto internal (used by differ)
- GameStateDiffer.cs: new file — ComputeDelta (viewer-specific) and
  ComputeSpectatorDelta; diffs tiles, field units, hands, discards,
  archs, player stats, and game meta
- GameHandlerBase.cs: PushStateToPlayersAsync gains optional prevState
  param; when provided pushes delta, else falls back to full push
- All 10 action handlers: pass prev state to PushStateToPlayersAsync

Client:
- Game.gd: _state_version tracking, _apply_delta, _merge_unit_delta,
  request_sync, game.state_delta push handler with auto-resync on gap
- in_game_settings.gd + InGameSettings.tscn: Request Sync button

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-03-21 06:54:33 -04:00
c93aaf64c0 Two-tier inactivity: mutual idle blocks force-concede at 10 min
Tier 1 (5 min, unchanged):
- Active player: game.inactive_warning — "you may be forfeited"
- Waiting player: game.opponent_inactive — "Accept Forfeit / Wait"

Tier 2 (10 min — mutual idle):
- If the game is still stalled after 10 min the waiting player also
  hasn't claimed forfeit, so both are treated as mutually idle
- Sends game.both_idle_warning to BOTH players
- Client closes any open tier-1 dialogs and shows "Wait" only —
  no concede or force-concede available
- Prevents the tactic of both players going idle to pressure the
  other into conceding

Monitor service now prunes notified sets on each poll so sessions
that become active again can be re-notified if they stall again.

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-03-21 06:16:13 -04:00
a84a610964 Fix rules editor: allow Open state + update UI from ACK
Server (GameUpdateLobbyRulesHandler):
- Allow update_rules in both Open (solo) and Full lobby states,
  not just Full — was silently failing when no guest had joined yet
- Push to guest only when GuestAccountId is present (was crashing
  with null deref in Open state if status check had been bypassed)

Client (CustomLobby.gd):
- update_rules ACK callback now emits lobby_rules_updated immediately
  from the ACK payload instead of relying solely on the lobby_updated push

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-03-20 21:28:58 -04:00
502c672c91 Fix spectator UI: use add_theme_font_size_override instead of property assignment
theme_override_font_sizes is not a settable property in GDScript 4.

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-03-20 20:12:48 -04:00
aded0f03a0 Phase 8: StartingRandomTilePct rule — full-stack implementation
- GameRules: add StartingRandomTilePct (int, 0–100, default 0)
- Board.Create(): accept startingRandomTilePct param; each tile
  independently seeded from {Lake, Hill, Forest, Field} on Base1
- GameEngine: pass rules.StartingRandomTilePct to Board.Create()
- GameMessages: add StartingRandomTilePct to CustomRulesOverride + CustomRulesDto
- CustomLobby entity: add StartingRandomTilePctOverride column
- GameRuleSet entity: add StartingRandomTilePct column
- Migration AddStartingTileRule: new columns on custom_lobbies + game_rule_sets
- All 6 handlers wired: Create, LobbyReady, UpdateRules, AcceptSuggestion,
  ListCustomLobbies, ListActiveLobbies
- Client lobby_room_screen.gd: "Starting Tile Affinity %" SpinBox (0–100)
  in BOARD section; displayed in rules label and suggestion 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-03-20 18:23:15 -04:00
3d597856e4 Implement custom rules editor + guest rule suggestions
Server:
- RuleSuggestionService — in-memory pending suggestion store (one per lobby)
- GameSuggestRulesHandler (game.custom.suggest_rules) — guest proposes rules
- GameAcceptRuleSuggestionHandler (game.custom.suggest_rules.accept) — host applies suggestion
- GameRejectRuleSuggestionHandler (game.custom.suggest_rules.reject) — host dismisses
- New message types: SuggestRulesRequest/Response, AcceptRuleSuggestionRequest/Response,
  RejectRuleSuggestionRequest/Response, LobbyRuleSuggestionPush, LobbyRuleSuggestionRejectedPush
- ServiceRegistration: register RuleSuggestionService + 3 new handlers

Client:
- CustomLobby.gd: rule_suggestion_received/rejected signals + suggest/accept/reject methods
- LobbyRoomScreen.tscn: add SuggestionBanner (host accept/reject UI); EditRulesBtn always visible
- lobby_room_screen.gd: replace OS.alert stub with full scrollable rules editor popup
  (SpinBoxes + CheckBoxes for all 17 rule fields, grouped by category); host sees "Apply",
  guest sees "Suggest"; SuggestionBanner shows proposed rules summary to host

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-03-20 17:27:16 -04:00
dingo e377faad92 Sync 2026-03-20 17:07:19 -04:00
dingo afc8564201 fixing deck editor filter bugs 2026-03-20 11:49:35 -04:00
dingo 6c6a66c011 Cleaning up errors on Deck editor of client 2026-03-20 11:01:16 -04:00
dingo 2e3a5e4569 Enabling Decks to have multiple Tier 1 ArchSpirits 2026-03-20 10:13:55 -04:00
dingo 2c08868fa2 Swap effects to abilities 2026-03-19 17:52:26 -04:00
dingo d5c6ca2559 Missing EffectJson for Repentance and Instinct cards 2026-03-19 14:04:20 -04:00
efcd693d60 Fix null-session prompt, stale ready state, spectator UI, and admin cancel
- init_screen.gd: handle null sessionId from game.get_active_session.ack
  properly — str(null)="<null>" which passed the is_empty() check causing
  every player to see "active game in progress (null phase)" on login
- CustomLobby.gd: call clear_state() at the start of create() and join() so
  that i_am_ready/partner_ready are reset between lobbies — fixes players
  appearing instantly ready when entering a new lobby after a previous game
- game_screen.gd: in _setup_spectator_ui(), hide _settings_btn (prevents
  accessing the Concede button) and add a programmatic "Leave" button that
  calls Game.stop_spectating() and navigates back to FreePlayScreen
- CustomLobbiesPage.razor: add Cancel button (admin) for Open/Full lobbies;
  directly sets Status=Cancelled and refreshes the list

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-03-19 10:49:46 -04:00
dingo e104330da4 Fixing Client, Repentance was trying to use abilitiesJson vs effectsJson, invalid types on attributes as well 2026-03-19 10:13:42 -04:00
2ec29ce2dc Fix leave handler, partner-left push, and GDScript compile error
- GameLeaveCustomLobbyHandler: return success silently for Started/Cancelled
  status (allows the Leave button to work regardless of lobby state); inject
  IClientPush and send LobbyPartnerLeftPush to remaining participant when
  someone leaves a Full lobby; reset ready flags when guest leaves
- GameMessages: add LobbyPartnerLeftPush(LobbyId, Reason)
- CustomLobby.gd: add partner_left signal; handle game.custom.lobby.partner_left
  push by calling clear_state() then emitting partner_left
- lobby_room_screen.gd: connect/disconnect partner_left; show toast + navigate
  back to FreePlayScreen when partner leaves
- free_play_screen.gd: extract auto-select into _auto_select_deck() helper to
  fix GDScript parse error (comma inside multi-line if-body within lambda)

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-03-19 09:45:24 -04:00
116d3c10f2 Fix FreePlayScreen join: deck selection before join
- Cache _all_decks from server; auto-select first deck on load
- Join flow: if multiple decks, show inline deck-picker dialog
  before proceeding to password prompt / join
- Remove stub _get_first_deck_id() (was always returning "")
- _populate_create_deck_buttons now uses _all_decks cache and
  auto-presses first button to reflect the default selection
- Guard in _do_join: show alert if _selected_deck still empty

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-03-19 09:23:08 -04:00
d61ebe66b8 Phase 8: Free Play ready-up system + client scenes
Server (Phase A):
- CustomLobby: +HostReady/GuestReady/HostFirstTurnPref/GuestFirstTurnPref/MaxPlayers
- Migration: AddReadyUpSystem — applied to prod DB
- GameJoinCustomLobbyHandler: no longer auto-creates session; sets Full status,
  resets readiness, pushes CustomLobbyGuestJoinedPush to host
- GameLobbyReadyHandler (NEW): game.custom.lobby.ready — marks caller ready,
  resolves first-turn, creates session + pushes game.custom.started when all ready
- GameUnreadyHandler (NEW): game.custom.lobby.unready
- GameChangeLobbyDeckHandler (NEW): game.custom.lobby.change_deck
- GameUpdateLobbyRulesHandler (NEW): game.custom.update_rules (host only)
- GameListActiveLobbiesHandler (NEW): game.custom.list_active (Status==Started)
- GameListCustomLobbiesHandler: now batch-loads host/guest display names
- GameMessages: +LobbyReadyRequest/Response, UnreadyInLobbyRequest/Response,
  ChangeLobbyDeckRequest/Response, UpdateLobbyRulesRequest/Response,
  ListActiveLobbiesRequest/Response, LobbyReadyStatusPush, LobbyDeckChangedPush,
  ActiveLobbyDto; CustomLobbyDto +HostDisplayName/GuestDisplayName
- ServiceRegistration: register 5 new handlers

Client (Phase B):
- CustomLobby.gd: new autoload for Free Play lobby state + all server calls
- project.godot: register CustomLobby autoload
- MainScreen: +Free Play button → FreePlayScreen.tscn
- FreePlayScreen (NEW): Open Lobbies tab + Active Games tab + Create dialog
- LobbyRoomScreen (NEW): ready-up UI, first-turn selector, preset voting
- Game.gd: +is_spectating, +start_spectating(), +stop_spectating()
- game_screen.gd: spectator mode — SPECTATING label, hidden action buttons,
  neutral HUD labels, stop_spectating() on exit

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-03-19 09:10:55 -04:00
5d3ee92553 Fix: Repentance/Instinct card target selection + server active ability execution
Client: Repentance/Instinct cards with Active abilities in abilitiesJson now
enter ABILITY_TARGET mode instead of sending play_card immediately. Units on
matching tile affinities (IsOnTileWithAffinity) are highlighted in blue; the
player clicks a target unit and the card is sent with the selected unit target.

Server: FireCardEffects now also processes Active abilities from AbilitiesJson
(after the existing EffectsJson path). Source-side ActivationConditions are
checked; target-side conditions (Subject=Target) are trusted from the client.

New Game.gd helper: send_play_card_with_targets sends play_card with a targets
array so the server can route unit selections to the active ability 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-03-18 14:05:49 -04:00
6c02c17a9d Fix: suppress stalagmite bottom models on PureVoid tiles
PureVoid tiles are meant to appear as empty floating platforms — attaching
stalagmite decoration below them breaks the visual. The affinity is checked
at the start of _try_load_tile_model and both attach points (placeholder
path and 3D-model-loaded path) are skipped when affinity == "PureVoid".

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-03-18 09:51:46 -04:00
73c3a71194 Feature: ETag-based CDN model cache invalidation
When admin replaces a model/art file via the CDN browser, the S3 ETag is
now captured and stored on CardAsset.ContentETag. The ETag is included in
the content sync DTO (CardAssetDto) so clients receive it on every sync.

Client-side ModelCache now keys its disk cache on sha256(url + "#" + etag)
instead of sha256(url), so updating a file at the same CDN path busts the
disk cache automatically. A _CACHE_VER="v2" sentinel purges old-scheme
.bin files on first launch after the client update.

Changes:
- CdnUploadResult: add string? ETag field
- S3CdnClient: capture ETag from PutObjectAsync response
- CardAsset: add string? ContentETag property
- Migration 20260318000001_AddAssetContentETag: add content_etag text column
- ContentMessages: add string? ContentETag to CardAssetDto
- ContentDtoMapper: map ContentETag in CardAsset → CardAssetDto
- CdnBrowser.razor: UploadFileToKeyAsync returns Task<string?> (ETag);
  ReplaceAsync calls PropagateAssetETagAsync which updates CardAsset rows
  and touches CardDefinition.UpdatedAt to trigger a version bump
- ModelCache.gd: versioned disk key + cache migration + etag parameter on
  load_model() and evict()
- game_screen.gd: pass model_asset.contentETag to load_model / retry chain

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-03-18 09:38:17 -04:00
635b1d78bd Fix: blocked SFX plays when defender absorbs all attack damage
Move tracked_target consume before the early-return path so fully-blocked
hits (zero HP change on all units) still trigger the defender's blockedSoundUrl
after attack_remaining seconds, matching the timing of a landed hit.

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-03-17 13:43:58 -04:00
ea3293e9c5 Feature: client SFX playback for unit animations
- SFX.gd autoload: fire-and-forget CDN audio player with 8-slot pool,
  session-level stream cache, OGG/MP3 support via HTTPRequest download,
  uses Settings BUS_SFX so volume/mute work automatically
- Register SFX in project.godot autoloads
- game_screen.gd:
  - _sfx_for_unit(iid, key) helper — looks up CardDefinition SFX URL
    from ContentCache using the unit's def ID
  - Attack sound: played when player initiates attack + counter-attack
  - Damaged sound: played at all damage animation sites (immediate,
    delayed bystander, post-attack callback, counter-chain)
  - Death sound: played when dying animation fires
  - Move sound: played when movement animation starts

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-03-17 13:30:39 -04:00
3ba33275e3 Feature: model retry + rejoin on login + 5-min inactivity detection
**Feature 1 — Model retry (client)**
- `ModelCache.gd`: add `evict(url)` to remove failed entries so re-download is possible
- `game_screen.gd`: when GLB load fails, `_schedule_model_retry` queues a 60-second
  retry (up to 10 attempts); `_do_model_retry` evicts + re-downloads and swaps the
  placeholder mesh for the real model if/when it succeeds

**Feature 2 — Rejoin on login (server + client)**
- Server: `GameGetActiveSessionHandler` (`game.get_active_session`) — returns the
  caller's active session ID + phase, or null when no session exists
- Client: `init_screen.gd` checks for an active session after content sync; shows
  a "Rejoin / Concede" dialog when one is found; rejoin navigates to GameScreen with
  the session ID already set so `send_ready` → `AlreadyStarted` → `_fetch_state`

**Feature 3 — 5-minute inactivity detection (server + client)**
- `GameSession`: add `LastActionAt` column + EF migration
  (`20260317000001_AddLastActionAt`)
- `GameHandlerBase.SaveStateAsync`: sets `session.LastActionAt` on every action
- `GameInactivityMonitorService`: background poll every 60 s; when a session hasn't
  had an action in ≥ 5 min, pushes `game.inactive_warning` to the stalled player and
  `game.opponent_inactive` to their opponent (once per session per server lifetime)
- `GameForceConcedeHandler` (`game.force_concede`): lets the waiting player claim
  the win; validates caller is not the active player and `LastActionAt` is stale
- `Game.gd`: new `opponent_inactive` / `inactive_warning` signals + push handlers +
  `send_force_concede()` helper
- `game_screen.gd`: handles `opponent_inactive` with Accept/Wait dialog;
  handles `inactive_warning` with informational 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>
2026-03-17 09:05:05 -04:00
8ef264fd9b Fix: update GLB-load closure to use above_tile instead of y_offset
y_offset was renamed to above_tile in the previous commit but the
ModelCache callback closure still referenced the old name, causing
GDScript parse errors on lines 838 and 846.

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-03-16 18:31:57 -04:00
a4b390460d Fix: unit Y height drifts upward across moves
Root cause: _animate_unit_move computed unit_above by subtracting
from_tile_top from body.position.y. If a state update arrived before
the board rebuilt (body still mid-tween), that subtraction produced a
value > 0.28 which then compounded each successive move.

Secondary: from_tile_top was typed :int, silently truncating the float
sum of tile_base + tile_h.

Fix: store above_tile as body metadata in _add_unit_mesh (0.28/0.4/0.5
per card type). _animate_unit_move reads the stored constant directly —
it is immune to board rebuild timing.

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-03-16 18:24:23 -04:00
dingo eb7a8e57b1 missmatch Type 2026-03-16 18:14:51 -04:00
cfee0bbccc Feature: tile Y stagger — board no longer completely flat
Every tile now has a deterministic vertical offset (±0.15 units) in
addition to its existing height variety, giving the board a natural
uneven terrain look.  Units placed on tiles and highlight rings account
for the stagger offset.  Move animations step through correct per-tile
Y heights so units don't float or sink as they walk across the board.

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-03-16 18:07:32 -04:00
26d2b88623 Feature: tile spacing gap + 2D placeholder textures
Visual changes (client):
- 0.1 gap between all tiles (TILE_SPACING = 1.1)
- Placeholder tiles (no 3D model) are now 0.5 height instead of random
  0.8-1.0, making undecorated tiles visually distinct
- Placeholder tiles load a 2D CDN texture via HTTP and apply it as the
  albedo on the BoxMesh (same affinity-per-shape lookup as 3D models)
- Placeholder tiles also attach a stalagmite bottom model, matching the
  look of fully-decorated tiles

Server:
- TileModelBinding.TexturePublicUrl (nullable text) added to entity,
  migration 20260317000001_AddTileTexture applied to DB
- TileModelDto extended with TexturePublicUrl
- ContentGetTileModelsHandler includes TexturePublicUrl in response

Admin (/content/tile-models):
- New "Square Texture" and "Hex Texture" columns in the bindings table
- Texture picker modal browses the CDN textures/ prefix and shows image
  thumbnails; select + assign writes TexturePublicUrl to the binding
- Texture can be assigned without a 3D model (creates a binding row
  with empty model fields)

ContentCache:
- Caches texturePublicUrl alongside modelPublicUrl from tile_models response
- New get_tile_texture_url(affinity, shape) → String accessor

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-03-16 17:47:28 -04:00
0c120ff1ae Fix: hand cards use ContentCache def for full art + stats
CardInstanceDto lacks the `assets` array, so card art never loaded.
Look up the full CardDefinitionDto from ContentCache (which has assets,
genus, abilitiesJson, and all base stats) and pass it as the `def`
argument to widget.setup().

Also remove the old "compact" code that was hiding the stats grid and
shrinking the art area — the full CardWidget now shows as intended.

Field alias retained: maxMp → movementPoints for CardWidget._load_stats.

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-03-16 17:24:49 -04:00
568f418608 Fix: stalagmite base at tile centre, not tile physical bottom
The affinity model's visual base is at body-local Y=0 (= world Y=tile_h/2,
the tile centre), because _fit_model_to_tile seats AABB bottom there.
The stalagmite base (AABB top) must sit at the same height so it connects
seamlessly.

Previous shift -(tile_h/2 + scaled_h) placed the base at body-local
Y=-tile_h/2 (world Y=0 = tile physical bottom), creating a gap of tile_h/2
between the affinity model and the stalagmite.

Fix: shift by -scaled_h only, bringing AABB top to body-local Y=0.

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-03-16 17:17:37 -04:00
2ab0025b8c Fix stalagmite positioning: add_child before AABB/fit calls
MeshInstance3D.get_aabb() returns a zero AABB when the node is not yet
in the scene tree, so the previous code's _fit_model_to_tile call was
a no-op (early return on zero footprint) and scaled_h was always 0.

Fix: add_child the stalagmite to the tile body FIRST (matching the same
order used by _try_load_tile_model for tile top models), then call
_fit_model_to_tile, then read the now-valid AABB to compute scaled_h
and apply the correct downward shift so the wide base lands flush with
the tile underside.

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-03-16 16:51:46 -04:00
dingo 03c0fcc279 misstyped Var 2026-03-16 16:28:20 -04:00
58ecd8388c Fix stalagmite orientation + AABB-based model grounding
- Stalagmite: remove erroneous flip; models are spike-at-AABB-bottom so
  no rotation needed — shift down by (tile_h/2 + scaled_h) so the wide
  base lands flush with the tile underside and spike hangs below
- Tile affinity models: revert accidental +tile_h*0.5 lift (those models
  were not the subject of the grounding complaint)
- Unit/card models: replace naive (tile_h - y_offset) offset with
  AABB-based formula that works regardless of model origin placement
  (feet, geometric centre, etc.):
    model.position.y = (tile_h - y_offset) - scale.y * aabb.position.y

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-03-16 16:24:09 -04:00
dingo 112d471533 Fixed Stalagmites 2026-03-16 16:04:30 -04:00
51f3ee23d4 Feature: tile height variation + stalagmite bottoms + live content refresh
## Tile height variation (fix)
Tile tops now visibly vary (0.8–1.0) from a fixed bottom at world Y=0.
Previously the top was fixed and the variation was only visible underneath.
Heights are seeded by tile coordinate so they're deterministic per board.
Unit y_offsets and highlight positions update to match per-tile height.

## Stalagmite tile bottoms
Server: new TileBottomModel entity + migration (catalog.tile_bottom_models),
content.tile_bottoms handler returns all active CDN URLs.
Admin: "Tile Bottom Models" section in the Tile Model Manager page —
  add/toggle active/delete entries with CDN picker.
Client: ContentCache fetches + disk-caches the URL pool; _try_load_tile_model
  picks a random URL and attaches it flipped below the tile model as a
  stalagmite using the existing _fit_model_to_tile scale logic.

## Live content refresh
ContentCache schedules start_sync() every 5 minutes after sync_complete so
card definitions, tile models, and bottom models are refreshed in the
background without restarting the client.

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-03-16 15:05:48 -04:00
977d150a46 Visual: randomise tile column depth for organic terrain feel
Each placeholder tile box is assigned a random visual height between 0.8 and
1.0.  The mesh is shifted downward so the TOP surface stays fixed at world
Y=0.5 — collision shapes, unit y_offsets, and highlight positions are all
unchanged.  The variation shows as more or less tile-side visible from the
camera angle, giving the grid an uneven, terrain-like appearance.

3D tile models (when loaded) replace the placeholder mesh and are unaffected.

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-03-16 14:38:57 -04:00
cf771f8531 Fix: counter-attack animation fires even when defender absorbs damage with defense
Previously the counterattack chain was only triggered when both units appeared
in damaged_iids (HP decreased).  If the defender's defense stat absorbs the
attacker's hit entirely, their HP doesn't change, so they were never in
damaged_iids — the counterattack animation was silently skipped.

Fix: record _last_attack_target_iid in send_attack() and use it in
_play_damage_animations as the primary defender source.  The tracked target is
consumed (cleared) on first use so it never bleeds into later state updates.
The old fallback (any other damaged unit) is kept for cases where no tracked
target is available.

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-03-16 13:58:36 -04:00
f5f0dd91e0 Fix: full counter-attack animation chain (attack → damaged → counter → damaged)
Previously both units played "damaged" simultaneously after the attacker's
attack animation. Now when both units take damage in the same state update
(= counterattack), the full chain fires:

  1. Mob 1 finishes Attack animation
  2. Mob 2 plays Damaged (hit by Mob 1)
  3. Mob 2 plays Attack (counterattack)
  4. Mob 1 plays Damaged (hit by Mob 2) + Mob 2 returns to Idle

Implementation:
- _override_oneshot(iid, cb): replaces a pending animation_finished ONE_SHOT
  callback without leaving stale signal connections
- _play_counter_attack(defender, attacker): plays defender "attack", then
  triggers attacker "damaged" + defender "idle" via _override_oneshot
- _play_counter_chain(defender, attacker, delay): tween-delayed entry into the
  chain; starts with defender "damaged" then hands off to _play_counter_attack
- _play_damage_animations: detects counterattack (attacker_iid AND another unit
  both in damaged_iids), routes to _play_counter_chain; falls through to the
  existing simple-damage path otherwise

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-03-16 12:23:03 -04:00
f1f6183f85 Fix: sequence attack→damaged animations (no mid-attack interruption)
Attack animations were being interrupted halfway through by "damaged"
because _play_damage_animations fired immediately on state arrival —
even for the attacker who also took counter-damage.

Fix:
- Track each unit's oneshot animation_finished callback in _oneshot_callbacks
  so it can be replaced later without a stale lambda leak.
- _is_attack_track() helper matches current animation against ANIM_ALIASES.
- _play_damage_animations now sequences:
    Attacker mid-attack → override idle-return callback with "damaged",
      so attack plays fully, then damaged plays, then idle.
    Defender → delay "damaged" tween by the attack's remaining duration
      so the hit lands at the moment the swing connects.
    No attack in progress → play "damaged" immediately (existing behaviour).

Result: Attack → (attack lands) defender damaged + attacker damaged → idle.

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-03-16 11:09:43 -04:00
15449f0061 Fix: show move tiles after attacking (isExhausted != no MP)
_valid_move_tiles was gating on isExhausted, but the server tracks
movement and attacks independently. isExhausted=true only means the
unit has attacked this turn; movement is governed solely by currentMp.
Removing the exhaustion check restores move highlights after an attack.

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-03-16 10:48:15 -04:00
085249b5c4 Fix: model facing default (south/+Z) + clear game state on rematch
Model facing: GLB models exported from Blender arrive in Godot facing +Z,
not -Z. Changed _facing_to_base_angle default case from 0 (north/-Z) to
PI (south/+Z). Explicit "north" case added. Updated admin dropdown label
from "Default (north)" to "Default (south / Blender GLB)" to match.

Stale game state: when matchmaking.match_found is received, clear Game.state
so the new GameScreen always calls send_ready() rather than rendering the
previous (ended) game's state. Fixes same-players-re-match ending up in
the already-completed session.

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-03-16 08:18:28 -04:00