Commit Graph
101 Commits
Author SHA1 Message Date
e254cd8ee8 Fix: BFS path type error Array vs Array[Vector2i]
Queue entries store paths as plain Array (nested in an untyped Array).
GDScript cannot implicitly upcast Array → Array[Vector2i] on pop_front.
Keep path variables untyped while building; use Array.assign() to
produce a typed Array[Vector2i] only at the final return point.

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-15 20:29:39 -04:00
f524cb9782 Feature: deferred board rebuild + BFS movement path animation
Units now animate before their nodes are rebuilt:

Deferred rebuild
- _schedule_rebuild(state, delay) uses a Tween to hold off _rebuild_units
  until animations finish; a new state cancels and replaces the pending rebuild
- POST_ANIM_SECS (1.2s) delay for attack / damaged / dying one-shots
- Hand and HUD update immediately; only the board is delayed

BFS movement animation
- _bfs_path() does 4-directional BFS avoiding other units' old positions
- _animate_unit_move() tweens the StaticBody3D through each grid step
  (EASE_IN_OUT / TRANS_SINE, 0.28s per cell) while playing the Moving loop
- Returns to Idle automatically when the tween finishes
- rebuild delay = max(move duration, POST_ANIM_SECS if damage played)
- Model load callback skips position reset if a move tween owns the body

Housekeeping
- _play_damage_animations now returns bool (triggered any anim?)
- _update_prev_state() replaces HP/pos tracking that was in _rebuild_units
- _rebuild_units kills all in-flight move tweens before destroying 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-03-15 19:22:50 -04:00
038f736926 Fix: animation track resolver handles dot/underscore model-name prefix
GLB animations exported from DCC tools often prefix track names with
the model name using a dot (Merlock.Attack) or underscore (Merlock_IDLE).
The previous resolver only stripped the GLTF library prefix (before '/').

Now tries three forms after stripping the library prefix:
  1. Direct match                  ("Idle"           → "idle")
  2. After last dot                ("Merlock.Attack"  → "attack")
  3. After first underscore        ("Merlock_IDLE"    → "idle")

Each form is tried for the canonical action name and all its aliases,
so "Merlock.Attacked" maps to "damaged" via the "attacked" alias, and
"Merlock.Move" maps to "moving" via the "move" alias.

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-15 16:38:14 -04:00
f3a947eb01 Debug: add [Anim] diagnostic prints to animation pipeline
Adds targeted print statements at 3 key checkpoints in the GLB
animation system to identify why animations don't play:
  1. model_url presence (per unit, on every state rebuild)
  2. AnimationPlayer presence + full track list (after model load)
  3. Track resolution result in _play_unit_anim

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-15 14:32:57 -04:00
c4999c953a Feature: GLB animation playback, model facing, CDN animation preview
Server:
- CardAnimationBinding.AnimationTrackName: nullable override for GLB track name
  (blank = case-insensitive convention match; Idle/Attack/Damaged/Moving/Dying)
- CardAnimationBindingDto: includes AnimationTrackName in content sync
- CardEditor: GLB Track Name column in animation bindings table
- CdnBrowser: model-viewer animation list + playback (JS interop on load event)
- Migration: AddAnimationTrackName applied to production

Client:
- ContentCache.get_anim_track(): resolves GLB track name from binding override
  or falls back to convention with case-insensitive aliases
- game_screen.gd:
  - _find_animation_player(): recursive search in loaded GLB scene tree
  - _resolve_anim_track(): case-insensitive + alias resolution
  - _play_unit_anim(): plays track, returns to Idle when one-shot finishes
  - _play_damage_animations(): detects HP drops and unit deaths before rebuild
  - Model facing: P1 units rotated 180deg Y to face opponent across board
  - Idle loop starts automatically after real model loads
  - Attack animation fires immediately on attack input (before ACK)

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-15 14:06:55 -04:00
3810742fe6 Feature: leaderboard hide, ability animations, card sounds, BGM, in-game settings
Server:
- Account.IsHiddenFromLeaderboard: filter bots/devs from leaderboard
- AbilityAnimationDefinition: type, effect, dimensions, asset/sound URLs per ability
- CardAnimationBinding: CastSoundCdnUrl + ImpactSoundCdnUrl per card action
- GameAudioConfig entity: admin-configurable BGM tracks per context
- GetGameAudioConfigHandler (content.get_audio_config) + ServiceRegistration
- Admin pages: AccountDetail toggle, AudioConfig CRUD, CardEditor + AbilityBuilder UI
- Migrations: AddLeaderboardHide, AddCardActionSounds, AddGameAudioConfig

Client:
- Music.gd autoload: fetches BGM config, crossfades between context tracks
- InGameSettings overlay: audio sliders, camera follow toggle, concede with confirm
- GameScreen: gear button opens settings; ConcedeBtn moved into settings panel
- project.godot: Music autoload registered

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-13 23:31:10 -04:00
c44dadec45 Fix: clear game state on game.over to prevent matchmaking re-entry bug
When game.over was received, Game.state was not cleared. If both players
re-queued and matched again, the new GameScreen saw non-empty state and
called _on_state_updated instead of send_ready(), leaving the new session
stuck in Initializing. Clearing state = {} before emitting game_over fixes this.

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-13 21:32:19 -04:00
dingo 92f61dcd76 Ability Range fix 2026-03-13 17:36:57 -04:00
cb8cb59b22 Fix: login screen UX + chat poll auth guard
- Status label: connect Network.connected so "Connecting…" clears once the
  WebSocket opens (previously the label stuck forever with no session)
- Remember Me: apply font_color override so the checkbox text is visible
- Register errors: map ASP.NET Identity password-policy error codes
  (PasswordTooShort, PasswordRequiresUpper/Lower/NonAlphanumeric/Digit) to
  user-friendly strings; old WEAK_PASSWORD kept as alias
- Chat poll: guard _on_message_poll_tick with Auth.user_id check so the timer
  cannot send chat.get_messages as the first message on a fresh connection
  when the user is not yet authenticated (caused by logout not stopping the
  timer, leaving it running into the next reconnect cycle)

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-10 20:36:36 -04:00
ad06f69331 Fix: explicit Dictionary types on Variant-inferred locals (GDScript warning)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-10 20:23:30 -04:00
200c061dd3 Fix: enforce WithinRange/IsAdjacentToSource filters in client targeting UI
_highlight_ability_targets was ignoring the target selector's filters array
entirely — it showed all ownership-matched units as clickable regardless of
spatial constraints.  The server correctly rejected out-of-range selections
(after the previous fix) but the UI still offered them.

Added _unit_passes_filters() and _tile_passes_filters() which evaluate the
withinrange and isadjacenttosource filters using Manhattan distance from the
ability source unit before adding a tile highlight.  Other filters (HasFlag,
AffinityMatches, etc.) are left as pass-through for now since they didn't
affect visibility in any reported case.

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-10 12:47:30 -04:00
8e3f64d9d1 Fix: ability WithinRange/IsAdjacentToSource filters + ModelCache web CORS
- AbilitySystem: implement WithinRangeFilter (Manhattan distance min/max) and
  IsAdjacentToSourceFilter in FilterMatches — both were falling through to
  _ => true, so range constraints on targeting were silently ignored
- Program.cs: add GET /cdn/{**path} proxy endpoint with
  Access-Control-Allow-Origin: * so browser web clients can fetch GLB models
  (Ceph RadosGW / cdn.aeternalisgames.com has no CORS headers)
- ModelCache.gd: on web export, rewrite cdn.aeternalisgames.com URLs to go
  through hub.aeternalisgames.com/cdn proxy; disk/memory cache still keyed
  on the original CDN URL for consistency across platforms

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-10 10:39:13 -04:00
df9140ed2c Fix: ability panel position + visibility
- Panel now appears to the right of the clicked spirit by projecting
  its 3D world position to screen space via Camera3D.unproject_position,
  with viewport-edge clamping so it never goes off-screen
- Removed ScrollContainer (height=0 caused buttons to be invisible);
  replaced with plain VBoxContainer — panel auto-sizes to content

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-09 22:48:26 -04:00
bdbd7b204f Fix: normalise ability JSON keys to lowercase before parsing
Server serialises AbilityDefinition with PascalCase property names
(Type, Actions, Target, Scope, Ownership, Count, All…).  The client
was checking for lowercase keys (\"type\", \"actions\", etc.) so
ab.get(\"type\") always returned null, actives stayed empty, and the
panel was silently skipped.

Added _normalize_keys() which recursively lowercases all Dictionary
keys after JSON.parse_string(), making every subsequent lookup
case-insensitive without needing dual-key fallbacks 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-03-09 22:38:42 -04:00
9e400c87b4 Feat: ability activation UI with targeting flow
- Ability panel now starts a per-action targeting flow instead of
  immediately firing the ability
- Board abilities: blue tile highlights for unit/tile targets; click
  to collect AbilityTarget and advance to the next action
- Player/zone abilities: left-side player panel with player name
  buttons; zone (Hand/Deck/Discard) sub-buttons appear for zone-scoped
  abilities
- Re-clicking a selected spirit toggles the ability panel open/closed
- Auto-skips actions whose ownership is Self/ExactSelf/Random or whose
  count.all = true (server resolves those without player input)
- Game.send_activate_ability now accepts an optional targets array

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-09 22:22:02 -04:00
1c0ec5fed9 Fix: replace match with if in send_ready lambda to fix GDScript parse error
match inside a lambda inside a function call argument confuses the GDScript
parser. Simple if is equivalent and parses correctly.

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-09 18:53:17 -04:00
014d264540 Fix: remove spurious 'no state key' warning from game.ready ack; handle session_abandoned push
For WaitingForOpponent/Started, state always arrives via game.state_update push
not via the ack payload — calling _apply_state_from_payload on the ack was
producing a confusing warning with no real effect. Replace with a match that
only fetches state for AlreadyStarted.

Also add game.session_abandoned push handler: emits Game.session_abandoned
signal (new) and game_screen connects to it to navigate back to MainScreen,
so clients stuck on the loading screen after a server restart recover cleanly.

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-09 18:51:18 -04:00
c9f7c22bf0 Fix: auto-scale tile 3D models to fit 0.98-unit tile footprint
Adds _fit_model_to_tile() + _model_local_aabb() helpers. After a tile
model loads, its AABB is computed from all descendant VisualInstance3D
nodes in the model's local space. The model is then uniformly scaled so
its largest XZ dimension = 0.98 units, and repositioned so it is
centred on XZ with its bottom at y = 0 of the tile body.

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-09 14:43:34 -04:00
7ca853258b Fix: tile 3D models load on affinity change (not just at board build)
_update_tile_affinity previously only repainted the placeholder material.
Now extracts model loading into _try_load_tile_model() which is called
both at initial board build (_add_tile) and on every affinity change
(_update_tile_affinity). Handles model swapping correctly — removes all
non-collision children before adding the new model so Lake→Hill transitions
don't stack meshes.

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-09 14:35:11 -04:00
9295155fbb Debug: log tile affinity sample and tile model URLs at board build
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-09 14:25:27 -04:00
c94fe4204d Fix: ModelCache gives actionable error when OBJ/non-GLB file is loaded
Shows the first 20 printable bytes and explains that only binary .glb
is supported at runtime, with a Blender re-export hint.

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-09 14:15:18 -04:00
03b553feab Debug: log ModelCache HTTP result/headers/bytes; fix weakref captures
- ModelCache._download: log result enum, HTTP code, body size,
  Content-Type header, and first 16 bytes for every download — enough
  to diagnose why Godot receives non-GLB data despite CDN serving valid GLB
- Moved disk-cache write to AFTER a successful parse so corrupt bytes
  are never written; disk cache read now deletes + re-downloads on bad parse
- game_screen: replace raw `body` lambda captures with weakref to
  eliminate "Lambda capture freed" noise (behavior unchanged)

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-09 14:06:23 -04:00
6dda0edf17 Fix: 3D model loading for units/tiles + tile model server pipeline
- ModelCache: switch GLTFDocument.append_from_buffer (was append_from_file
  which returned ERR_BUSY/43); validate GLB magic bytes; explicit signal
  disconnect before queue_free to avoid freed-lambda errors
- ContentCache: add tile model fetch (content.tile_models), disk cache at
  user://content/tile_models.json, get_tile_model_url() API
- game_screen: _add_tile now loads tile CDN model via ModelCache when bound
- Server: ContentGetTileModelsHandler (content.tile_models msg), registered
  in ServiceRegistration; TileModelDto / GetTileModelsResponse added to
  ContentMessages

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-09 13:34:17 -04:00
e815dd708f Feat: load 3D models from card definition assets on game board
Client:
- Added ModelCache autoload (autoloads/ModelCache.gd)
  - Downloads .glb files from CDN via HTTPRequest
  - Disk cache: user://remote_model_cache/<sha256>.glb
  - Memory cache: PackedScene per URL for instant re-instantiation
  - Concurrent requests for same URL queue and share one download
  - Loads via GLTFDocument.append_from_file + generate_scene
- game_screen.gd: _add_unit_mesh now looks up cardDefinitionId
  → ContentCache.get_definition() → finds Model3D asset URL
  → calls ModelCache.load_model() to async replace placeholder geometry
  - Placeholder (sphere/cylinder/box) shown immediately
  - Real model swaps in on download completion
  - Guards against body being freed before model arrives
  - Added _unit_bodies dict for O(1) body lookup
- project.godot: registered ModelCache autoload

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-09 12:37:25 -04:00
60697460cb Feat: scroll block over hand, camera follow, chat overlay, admin cleanup
Client (game_screen.gd):
- Scroll wheel no longer zooms camera when mouse is over the hand panel
- Clicking a friendly unit smoothly tweens camera pivot to that unit
  (EASE_OUT CUBIC, 0.4s) — respects Settings.camera_follow_unit toggle
- Chat overlay instantiated from game screen and removed on exit

Client (Settings.gd + SettingsScreen):
- Added camera_follow_unit bool (default: on) to gameplay settings section
- Persisted to user://settings.cfg under [gameplay]
- Toggle visible in Settings screen under new GAMEPLAY section

Server Admin (MatchmakingQueuePage):
- "Clear History" button deletes all non-Searching matchmaking entries

Server Admin (GameSessionsPage):
- Per-row "Abandon" button for Active/Initializing sessions
- "Abandon All Active" bulk button marks all live sessions as Abandoned
  with EndedAt=now and WinCondition="admin"

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-09 09:09:01 -04:00
dingo 77dbc7fce3 Fixed Terramorpha, was order of operations, terra count being wiped right after being set 2026-03-09 08:44:36 -04:00
e23b4b958c Refactor: unit double-click uses existing ctx_popup instead of CardDetailPopup
Removes the broken CardDetailPopup overlay machinery entirely.
Double-clicking a battlefield unit now populates and shows the existing
ContextPopup with name/type/affinity header, HP/DEF/ATK/MP stats row,
and ability list (name + description bullets).

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-08 21:00:16 -04:00
6bb261102e Fix: popup anchor Control must ignore mouse to not block game input
The full-rect Control wrapper had default MOUSE_FILTER_STOP, eating
all clicks across the entire screen. Set MOUSE_FILTER_IGNORE so input
passes through to the 3D scene and HUD beneath it.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-08 20:46:53 -04:00
15a50f3d7c Fix: battlefield popup — Control wrapper between CanvasLayer and popup
CenterContainer/ScrollContainer require a proper Control parent to
compute sizes. Adding CardDetailPopup directly to a CanvasLayer broke
the nested container layout chain, causing zero-height Panel (invisible
content despite the grey overlay showing correctly).

Fix: spawn a dedicated CanvasLayer (layer 20, above HUD at layer 10)
containing a full-rect Control anchor, then parent the popup to that
Control. This restores proper anchor→Control→Container sizing.

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-08 18:10:57 -04:00
b3ce6a1200 Fix: card_detail_popup use add_theme_*_override instead of dict access
theme_override_constants["key"] and theme_override_font_sizes["key"]
throw on nodes not yet in the scene tree. Replaced with the proper
add_theme_constant_override() / add_theme_font_size_override() calls.

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-08 18:00:58 -04:00
11ebdc40d7 Fix: abilitiesJson null crash, battlefield popup, ExactSelf ability filter
Client (game_screen.gd):
- Fix crash when clicking a unit with null abilitiesJson: server sends the key
  with a null value, so dict.get(key,default) returns null — guard both uses
  (_show_ability_panel and _on_hold_timer_fired) with explicit null check.
- Add double-click on battlefield units to open a full CardDetailPopup showing
  name, affinity, stats, and ability descriptions. Popup is instantiated once
  in _ready() and reused; aliases movementPoints/abilities keys as expected.

Server (Filters.cs / AbilitySystem.cs):
- IsSelf filter now matches by CardDefinitionId (definition-level: any copy of
  the same card). This is the appropriate semantic for "self" as a type scope.
- IsExactSelf filter added: matches by InstanceId (instance-level: only this
  specific unit on the battlefield). Use this to prevent duplicate-instance
  trigger bleed where two copies of a card both fire when only one acted.
- TriggerMatches now accepts the evaluating FieldCard and forwards its
  InstanceId to Own() for all ownership checks.
- Own() gains "ExactSelf" scope: fires only when occ.Data.SourceId matches the
  evaluating unit's InstanceId — eliminating the definition-level bleed bug.

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-08 16:28:06 -04:00
94f39be8a7 Fix: card double-click via remove_child before queue_free + frame dedup guard
Root cause: _rebuild_hand used queue_free() alone, which keeps nodes in the
GUI tree (and receiving input events) until end-of-frame. When two state
updates arrive in the same frame, stale and live CardWidget instances overlap
at the same screen position — both emit card_pressed → _on_hand_card_clicked
fires twice per physical click, alternating select/deselect.

Fix 1 (root cause): _rebuild_hand now calls remove_child(c) before queue_free(c),
so the old widget is immediately detached from the HBoxContainer and can no
longer receive GUI input.

Fix 2 (defensive): _on_hand_card_clicked deduplicates calls within the same
engine frame for the same card instance using Engine.get_process_frames().

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-08 15:34:23 -04:00
f5621d6285 Fix: defer z_index + tween to prevent Godot GUI re-triggering card press
Setting widget.z_index = 20 synchronously while a mouse button is held causes
Godot 4 to re-evaluate GUI focus and deliver a synthetic second pressed=true
event to the widget.  This fired card_pressed a second time in the same frame,
making _on_hand_card_clicked see the card already selected → immediate deselect.

Fix: move tween creation and z_index assignment into a new _tween_hand_card()
helper, called via call_deferred() so it runs after the current input event is
fully processed (mouse button already released by then).

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-08 14:09:40 -04:00
1a2fdad9ba Fix: CardWidget double-click causes immediate select→deselect cycle
Godot 4 fires two separate pressed=true InputEventMouseButton events for a
fast click: a normal press and a double_click press, both in the same frame.
The previous _gui_input emitted card_pressed for both, so the first emission
selected the card and the second (double_click) immediately deselected it.

Fix:
- Skip card_pressed emission when event.double_click is true
- Consume RELEASE as well as PRESS so neither can leak to the 3D board's
  _unhandled_input handler (belt-and-suspenders over the _press_was_on_board
  guard that already exists in game_screen.gd)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-08 13:38:52 -04:00
b36a644f56 Fix: Spirit card highlights — emissive material, preserve selection through state updates
- _add_highlight: use emission (emission_energy_multiplier=2) + 75% opaque base
  so tiles glow visibly regardless of depth-sort/transparency ordering; raised
  Y to 0.58 (clear of tile top at 0.50); thicker mesh (0.06 vs 0.02)
- Remove Godot-3-only flags_transparent property (no-op in Godot 4)
- _on_state_updated: preserve CARD_FROM_HAND / TERRAMORPHA_SELECT through server
  state pushes if selected card is still in hand (re-apply highlights after
  _rebuild_hand); only clear UNIT_SELECTED and other transient modes
- Add diagnostic prints to _add_highlight and _on_state_updated to trace when
  state updates arrive relative to card selection

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-08 12:40:48 -04:00
101e671752 Fix: Spirit tile highlights (null channel range), Ruin immediate play, deselect tween
- Spirit tile null safety: dict.get(key, default) only uses the default when
  the key is absent. Server sends nullable ints as JSON null, so the key EXISTS
  but the value is null. GDScript returns null which coerces to 0 on a typed int,
  collapsing min_r/max_r to 0 and producing zero valid tiles. Fixed by reading
  channel range as Variant and substituting the default (1/2) when null.

- Channel range source: read from arch (ArchSpirit), not the Spirit card — the
  ArchSpirit defines how far away from itself it can channel Spirits.

- Ruin: auto-placed by server. Clicking a Ruin card now immediately calls
  send_play_card without entering CARD_FROM_HAND mode or requiring a tile click.
  Added Ruin to the board-click immediate-play guard as well.

- Deselect previous: before entering a new CARD_FROM_HAND selection, explicitly
  call _set_mode(NONE) when already in CARD_FROM_HAND or TERRAMORPHA_SELECT.
  This guarantees _refresh_hand_selection fires a deselect tween on the old
  card before the new card's select tween begins.

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-08 10:52:26 -04:00
715ce1f032 Fix: Spirit/Ruin tile highlights, Terramorpha SP gate, selection tween
- Spirit/Ruin valid tiles: channel range was read from arch (archSpirit) instead
  of card (the Spirit being played). Fixed to card.get("minChannelRange", 1) /
  card.get("maxChannelRange", 2). Also restored "Ruin" to the tile-target branch
  (it needs a tile target, not the no-target branch).

- Terramorpha: skip entering TERRAMORPHA_SELECT if currentSp < spCost. Player
  can see their SP in the HUD; clicking an unaffordable card does nothing.

- Hand card tween: removed mouse_entered/mouse_exited hover animation. Tween
  now fires only on selection state change in _refresh_hand_selection, tracking
  previous state via "_sel" widget metadata.

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-08 10:15:56 -04:00
c82682f77e Fix: card play input bug, populate CardInstanceDto fields, genus/SP/ST/MP display
- Input bug: CardWidget only consumed mouse PRESS via accept_event(), not RELEASE.
  This caused _unhandled_input to fire _handle_board_click on release of a card
  click, hitting the tile physically behind the hand area in 3D — accidentally
  sending play_card to the wrong tile (Spirit/Ruin) or picking the first tile for
  Terramorpha. Fixed by tracking _press_was_on_board: board clicks only fire when
  the originating PRESS also reached _unhandled_input (i.e., was not consumed by
  a UI card widget).

- Server: added SpCost, StCost, Genus, MinChannelRange, MaxChannelRange,
  MinAttackRange, MaxAttackRange, CanMove, CanAttack, ExtraAttacksRemaining,
  CanBeAttacked, AbilitiesJson to CardInstanceDto and ToCardDto mapping.
  All fields were already on CardInstance; they were simply not exposed to clients.

- Client: build def dict in _make_hand_card with maxMp → movementPoints alias
  so CardWidget displays movement points correctly.

- Client: show MetaRow (genus + type) in compact hand card; only StatsGrid is
  hidden. HandArea / RightPanel height raised 190 → 220px for better visibility.

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-08 09:10:24 -04:00
85ef0fb29c Fix: restore board interaction after CardWidget + camera changes
Two root causes broke unit movement and card play:
1. Camera yaw=180° for P1 pushed P1's own row to the bottom of the 3D
   projection, directly behind the 260px HandArea panel → tiles unreachable
2. HandArea grew from 180→260px, blocking even more of the lower board

Fixes:
- Compact CardWidget in hand: hide MetaRow + StatsGrid, shrink ArtArea
  min height to 80px → card ~150px, fits in 190px HandArea
- HandArea / RightPanel height: 260→190px
- Camera orientation: when setting yaw for P1/P2, also shift _cam_pivot
  30% of board half-length toward the player's own side so their row
  sits mid-screen (above the HandArea), not hidden behind it

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-07 21:46:02 -05:00
28892cbe10 Game screen: CardWidget hand, Dimorpha/Trimorpha tile hints, attack range, camera
Hand display:
- Replace bespoke _make_hand_card() with CardWidget.tscn (the shared collection
  card widget) — shows art, stats, affinity border, SP/ST costs
- Pass live game card dict as both dto and def; all camelCase fields match
- _refresh_hand_selection() now calls widget.set_selected() instead of
  manipulating StyleBoxFlat directly
- HandArea/RightPanel height 180 → 260px to fit CardWidget (238px natural height)
- HBoxContainer separation -12 (overlap) → 6px (proper spacing)

Terramorpha tile selection (Dimorpha / Trimorpha):
- After each tile pick, re-highlight: orange for already-selected tiles, green
  for valid adjacent tiles for the next pick — no more silent rejection of
  non-adjacent clicks

Attack range visualization:
- _attack_range_tiles(): returns all tiles within minAttackRange–maxAttackRange
  for units with maxRange > 1 (ranged spirits)
- _select_unit() shows orange range area first, then red on top for actual
  attackable enemies — players can now see a ranged unit's full reach

Camera orientation:
- On first state that includes playerOneAccountId, orient camera behind the
  local player's row: P1 (row 0, world -Z) gets yaw=180°, P2 keeps yaw=0°
- _camera_oriented flag ensures this only runs once per scene entry

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-07 21:24:52 -05:00
8445a27101 Fix P2 placement: check own arch position, not activePlayerAccountId
activePlayerAccountId stays as P1 for the entire Placement phase, so
P2 always saw "waiting for opponent". Now each player checks whether
their own ArchSpirit has been placed to decide which UI to show.

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-07 12:19:01 -05:00
036738e44d Fix Placement-phase move attempts; case-insensitive player ID matching; hand debug
- Block unit selection in Placement phase (prevents sending game.move_unit
  when opponent hasn't placed yet)
- All accountId comparisons now case-insensitive (Guid serialization may
  differ between auth response and state DTO)
- Add debug log in _on_state_updated: phase, player found, hand size

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-07 11:38:48 -05:00
926c9d53a6 Add Game.gd debug logging for all packets sent and received
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-07 10:50:44 -05:00
c58f03757d Fix occupantId null handling in game_screen.gd
Server sends occupantId as JSON null for empty tiles, not "".
- dict.get("occupantId", "") returns null (not "") when key is present with null value
- Fixed all four occupantId checks to use truthiness instead of "" comparison
- Hold timer: extract to untyped var first then cast, avoids Nil→String assignment crash
- Valid placement/move/channel tiles now correctly identify empty tiles

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-07 10:37:51 -05:00
dingo e7da2532a2 Client fixors 2026-03-07 10:28:32 -05:00
84612614c5 Fix game state push type and reconnect flow in Game.gd
- Server pushes "game.state_update" not "game.state_update.push"
- On "AlreadyStarted" ack (reconnect), explicitly fetch state via game.get_state
  instead of expecting state in the ready ack (it's never there)

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-07 09:33:56 -05:00
7e4e4aad52 Fix %ContextClose missing unique_name_in_owner in GameScreen.tscn
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-07 09:13:26 -05:00
ef7d45f40e Fix GDScript type inference errors in game_screen.gd
- Explicit Dictionary type on pd variable (unit position)
- Explicit int type on all dist variables (abs() returns Variant
  when operands are from Dictionary.get() calls)

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-07 09:11:45 -05:00
e41e67e188 Fix indentation on split assignments in game_screen.gd
cyl.bottom_radius and sm.height were left at 2-tab indent after
the chained-assignment split; corrected to 3 tabs.

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-07 09:10:06 -05:00
dbfd7033e1 Fix GDScript parse errors in game_screen.gd
- Split chained assignments (a = b = val not valid in GDScript)
- Move 'and' continuations onto same line as return in lambda bodies

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-07 09:05:47 -05:00