Commit Graph
271 Commits
Author SHA1 Message Date
aa8fa34a05 Fix hex grid support for movement, channeling range, and terramorpha
Movement (_bfs_path): was using 4 square directions for pathfinding,
causing units on hex grids to take indirect multi-step routes when a
single diagonal step exists. Now uses 6 hex dirs when grid is Hexagon.

Channeling (_valid_play_tiles Spirit): was using Manhattan distance
instead of hex cube distance, producing a diamond-shaped channel range
on hex boards. Now delegates to _board_distance for both grid types.

Terramorpha (three fixes):
- Initial valid-play highlights now filter by _tile_bodies so only
  real tiles are highlighted (not every grid position in the bbox)
- Adjacency validation for Di/Tri multi-pick now uses _board_distance
  instead of abs(dx)+abs(dy), enabling all 6 hex neighbours
- Next-pick highlight loop now uses 6 hex dirs and guards with
  _tile_bodies check, consistent with the reachability BFS

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-07 14:36:08 -04:00
4ac92d0139 Add hex stalagmite support for tile bottom models
- TileBottomModel gains a Shape column (Square/Hex, default Square)
  so admins can manage separate stalagmite pools per tile grid type
- EF migration 20260407153312_AddTileBottomModelShape adds the column
  with a default of 'Square' to preserve existing data
- Admin UI splits the Tile Bottom Models section into Square and Hex
  cards, each with their own Add/toggle/delete controls
- content.tile_bottoms response now returns squareUrls and hexUrls
  separately; handler queries each shape independently
- ContentCache splits into _tile_bottom_urls_square / _hex and
  get_random_tile_bottom_url() now takes a shape parameter
- game_screen: hex tiles with no 3D model now receive a hex stalagmite
  instead of silently skipping; 3D-model path passes shape_key through

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-07 11:34:46 -04:00
cfb10ae4d0 Fix Keycloak auth failures: audience validation + packet drain race
Server — JWT audience validation failing:
  Keycloak does not include the client ID in the `aud` claim by default
  (uses "account"). ValidateAudience=true with ValidAudience="sor-game"
  rejected every token. Disabled audience validation — issuer + signature
  + realm role check is sufficient for a single-realm deployment.
  Bumped JWT validation failure log to Information so it appears in default logs.

Client — DISCONNECTED instead of AUTH_FAILED on rejected auth:
  When the server sends an error packet immediately followed by a close frame,
  the socket transitions to STATE_CLOSING before the next _process frame.
  Network.gd returned early during STATE_CLOSING without draining packets,
  leaving the pending request unresolved. _on_ws_closed then failed it as
  DISCONNECTED. Now drains packets during STATE_CLOSING so the error packet
  is resolved with the correct error code before the close is processed.

  Also added "invalid_token", "role_required", "invalid_payload",
  "auth_service_unavailable", "account_creation_failed" to the close reason
  → error code mapping so they surface as AUTH_FAILED / AUTH_SERVICE_UNAVAILABLE
  rather than DISCONNECTED even in the fallback path.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-02 19:36:09 -04:00
79fa08e192 Fix Keycloak: scene reload on error, web signal missed, redirect URI
PC — scene reloading on auth error:
  Auth.gd's keycloak error handler called change_scene_to_file(LoginScreen)
  after emitting auth_failed, which reloaded the scene and wiped the error
  message before the user could see it. Removed the scene change — the
  login screen is already active and handles auth_failed itself.

Web — token_received signal never handled after page redirect:
  login_screen._ready() returned early when Keycloak.auth_in_progress was
  true, before connecting Keycloak.token_received. When the exchange
  completed nobody was listening, so the game sat frozen. Signals are now
  connected before the early-return check.

Web — fragile redirect URI and sessionStorage injection:
  JavaScriptBridge.eval return value could stringify as "<null>". Now uses
  separate origin + pathname evals with a null check. sessionStorage items
  and the final navigation use uri_encode() + decodeURIComponent() instead
  of manual quote-escaping, preventing injection from PKCE values.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-02 19:20:04 -04:00
1c6064e157 Fix Keycloak auth: DISCONNECTED retry + web export support
PC native — connection lost, retrying:
  _send_keycloak_auth's DISCONNECTED handler was clearing _pending_keycloak_token
  (taken at top of function) without restoring it, so the next _on_network_connected
  had no token to retry with. Restore it: _pending_keycloak_token = token.

Web export — could not bind a local redirect port:
  Godot's HTML5 export cannot create TCP server sockets. Add a separate web
  code path in Keycloak.gd:
  - start_auth_flow() detects OS.get_name() == "Web" and navigates the page
    to Keycloak, persisting PKCE state (verifier, state, redirect_uri) in
    sessionStorage before the page leaves.
  - _check_web_callback() (called in _ready()) detects the ?code= params on
    return, recovers state from sessionStorage, cleans the URL via
    history.replaceState, then calls _exchange_code().
  - auth_in_progress flag lets login_screen show "Completing sign-in..."
    while the token exchange is in flight after page reload.
  Requires the web game's origin to be registered as a valid redirect URI
  in the Keycloak sor-game 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-04-02 16:39:13 -04:00
60d6098c11 Fix Keycloak login: force fresh WebSocket before auth.keycloak
The server closes idle unauthenticated connections after AuthTimeoutMs
(10 s). A user authenticating in the browser takes longer than that, so
the socket the client held while the browser was open is already dead
when token_received fires. Sending auth.keycloak on that stale
connection produces no reply and the scene never changes.

Fix: login_with_keycloak() now calls Network.force_reconnect() instead
of sending immediately. _on_network_connected() then sends auth.keycloak
as the guaranteed-first message on the fresh connection.

Also: DISCONNECTED errors in the auth.keycloak error callback no longer
clear keycloak_refresh_token, preserving silent re-auth on transient drops.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-02 16:20:45 -04:00
39253716ad Replace login/register forms with Keycloak sign-in flow
- LoginScreen: single "Sign in with Aeternalis" button replaces two-tab
  email/password/register layout; all credential encryption removed
- login_screen.gd: wires Keycloak.token_received → Auth.login_with_keycloak,
  handles auth_error and auth_failed signals
- Auth.gd: rewritten to use Keycloak session tokens; stores Keycloak refresh
  token for silent re-auth; calls Keycloak.revoke on logout
- Keycloak.gd: new autoload implementing Authorization Code + PKCE with
  loopback redirect, silent refresh, and fire-and-forget revocation
- project.godot: register Keycloak as autoload singleton

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-02 15:04:43 -04:00
78f55930a0 Fix team play: correct team indices, team-aware unit colors and ownership
Server:
- Add TeamCount, PlayerOneTeamIndex, PlayerTwoTeamIndex to GameSession so
  team assignments survive the lobby→game transition without recomputation
- GameLobbyReadyHandler.StartGameAsync: apply TeamAssignmentsJson (host custom
  reassignments) for all seats; store P1/P2 team indices on the session
- GameReadyHandler N-player path: use session.PlayerOneTeamIndex /
  PlayerTwoTeamIndex instead of hardcoded teamCount=1 (which put both P1 and
  P2 on team 0 in every non-FFA game)
- EF migration: AddGameSessionTeamFields

Client (game_screen.gd):
- _rebuild_ownership: treat same-team allies as friendly instead of enemy
- Unit color loop: use state.teamColors palette per team instead of hardcoded
  blue (self) / red (everyone else)
- _on_game_over: derive i_won from player_outcomes[me].outcome == "Winner" so
  a teammate's final kill correctly shows "Victory!" for the whole team

Also: skip absent hex tiles in BoardTemplateBuilder SVG render

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-02 08:40:43 -04:00
0572aea4d2 Extend board template builder with hex SVG canvas + filter client by grid type
- Admin builder: SVG hex canvas renders when GridType=Hexagon (pointy-top hexagons, correct axial layout); square CSS grid otherwise
- Admin builder: ApplyHexSides / OnGridTypeChanged handle dimension/tile pruning; canvas header shows N/diameter for hex
- BoardTemplateDto now includes GridType and HexSides so clients can filter
- rules_editor_dialog: Board Width/Height/Shape hidden when hex selected; Hex Sides hidden when square; template picker filtered to matching grid type with live toggle

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-01 21:22:07 -04:00
a4badc276b Unit models face nearest enemy rather than fixed north/south
_idle_rotation now:
- Finds the nearest enemy body in _unit_bodies by XZ distance
- Returns atan2 toward that position minus the model's base angle
- Falls back to the original north/south heuristic when no enemy exists yet

Also refreshes idle rotation for all units on every state rebuild (step 4 in
_rebuild_units), skipping any unit currently in a move tween, so rotations
stay correct as units reposition across turns.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-01 20:30:39 -04:00
f9832d1a1f Hex board: corner starting zones, half tile spacing
Server - MakeHexagon starting zones:
- Zones are now corner-based instead of full-edge: each zone is the corner
  tile plus (N-1)/2 tiles along each of the two edges meeting at that corner
- 2 players → opposite corners (0, 3 = right/left); 3 → every-other corner
  (0,2,4); 4 → (0,1,3,4); 5 → (0-4); 6 → all 6 corners

Client - game_screen.gd:
- Add HEX_TILE_SPACING = TILE_SPACING * 0.5 constant
- _coord_to_world: use HEX_TILE_SPACING for hex world positions
- _add_tile: tile cylinder radius scaled by HEX_TILE_SPACING
- _add_highlight: highlight cylinder radius scaled by HEX_TILE_SPACING

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-01 18:44:20 -04:00
97e7698000 Wire HexSides through custom lobby; fix boardTemplateIdOverride empty-string crash
Server:
- CustomRulesOverride: add HexSides (int?) field
- CustomLobby entity: add HexSidesOverride (int?) column
- GameUpdateLobbyRulesHandler: save HexSidesOverride, include HexSides in
  effective rules preview
- GameLobbyReadyHandler: set rules.HexSides from lobby.HexSidesOverride on
  game start
- GameSavePresetHandler: capture BoardShape + HexSides in saved presets
- Migration 20260401222603_AddCustomLobbyHexSides: adds HexSidesOverride to
  custom_lobbies; applied to pg-forge-01 via dotnet ef database update

Client:
- rules_editor_dialog: send null (not "") for boardTemplateIdOverride when no
  template selected — empty string crashed Guid? deserialisation on the server

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-01 18:28:08 -04:00
aa76ac9994 Add Grid Type toggle (Square/Hexagon) to lobby rules editor
Replaces burying "Hexagon" in the Board Shape list with a dedicated
Grid Type dropdown at the top of the BOARD section. When "Hexagon" is
selected, boardShape is forced to "Hexagon" on confirm; square boards
use the Board Shape field as before. Hex Sides remains visible for
the sides setting.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-01 18:18:21 -04:00
8a20e56cb3 Hex tiles: use affinity-coloured cylinder placeholder, no Square fallback
When no Hex CDN model exists for an affinity, hex tiles now keep their
coloured CylinderMesh (radial_segments=6) placeholder rather than loading
a Square model or texture. Square boards are 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-04-01 17:38:49 -04:00
1bd26f11be Add hex grid to lobby rules editor; fix hex model/texture CDN loading
- rules_editor_dialog: add "Hexagon" to Board Shape picker and a Hex Sides
  spinner (3–10, default 5) so custom lobbies can configure hex boards
- game_screen _add_tile: has_model check now looks for Hex-shape CDN models
  (falls back to Square), so hex tiles get height variance when a Hex model is
  registered on the CDN instead of always using the flat placeholder height
- game_screen _try_load_tile_model: texture fallback now checks shape_key
  ("Hex") first, then falls back to "Square" — consistent with model loading

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-01 17:16:22 -04:00
2cfa60c7dd Add hex grid support (sides 3–10) for boards, pathfinding, LOS, and client rendering
- New HexGrid.cs: axial coord helpers, BFS neighbors, cube-lerp LOS, jump-range
- Board: HexSides property, GetNeighbors() dispatches hex/square, IsInBounds() hex-aware
- BoardShapeGenerator: MakeHexagon() with edge-based starting zones (2–6 players);
  FromTemplate() now carries HexSides through to the Board
- Pathfinding: Walk/Flight BFS uses board.GetNeighbors() (hex+square unified)
- LineOfSight: delegates to HexGrid.HasLos when hexSides > 0
- GameRules/GameRuleSet/BoardTemplate/BoardTemplateSnapshot: GridType + HexSides fields
- GameMessages BoardDto: GridType + HexSides sent to client
- GameEngine: PlaceArchSpirit range uses HexGrid.Distance on hex boards;
  Teleport LOS passes board.HexSides; ToBoardDto emits GridType/HexSides
- EF migration 20260401000000_AddHexGridSupport: grid_type + hex_sides columns on
  game_rule_sets and board_templates; applied to pg-forge-01
- Client game_screen.gd: hex coord→world (pointy-top flat layout), CylinderMesh
  tiles (radial_segments=6), _board_distance cube metric, _bfs_reachable 6-dir,
  _client_has_los cube-lerp, highlight mesh for hex tiles; reads gridType/hexSides
  from BoardDto

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-01 16:44:17 -04:00
c756b9cffa Fix highlight accuracy: BFS movement, LOS attack filtering
Movement tiles (_valid_move_tiles):
- Walk: BFS blocked by all occupied tiles (can't walk through units)
- Flight: BFS blocked only by other Flight units (flies over Walk units)
- Jump: Manhattan range, unoccupied only (was already correct)
- Teleport: Manhattan range + LOS to destination

Attack highlights (_attack_range_tiles, _valid_attack_target_coords,
_valid_attack_target_ids):
- Added AttackRequiresLos field to CardInstanceDto / ToCardInstanceDto
- Client now checks _client_has_los() for LOS-required attackers
- Tiles/units blocked by occupants are no longer highlighted as targets

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-01 11:19:24 -04:00
1d53f1046a Merge Sacrifice/Ascend/Transition into the unit ability panel
Previously, clicking an ArchSpirit showed the abilities panel AND a
separate OS-level PopupMenu for arch-spirit actions. Now everything
lives in one floating panel:

  [Abilities]        ← shown only if unit has active abilities
  ──────────
  <ability buttons>

  [ArchSpirit]       ← shown only for friendly ArchSpirit
  ──────────
  Sacrifice a Spirit  (only when valid candidates adjacent)
  Ascend              (only when tier+1 card in hand)
  Transition          (only when tier-1 card in hand)

Removed the _show_arch_spirit_menu() PopupMenu call from _select_unit().
_show_ability_panel() now builds both sections and returns early only
when both would be 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-31 14:13:22 -04:00
2a37f90746 Add 20-second sync watchdog to fix random hung init screen
If sync_complete or sync_failed never fires (e.g. background refresh
_is_syncing guard eats the start_sync call and signals were already
emitted before init_screen connected them, or a server request is
in-flight with no reply), the player was silently stranded with no
retry path and had to relaunch.

Adds a SYNC_TIMEOUT_SEC = 20 watchdog timer started in _do_sync() and
reset on each sync_progress page. If it fires, surfaces the retry
button with a "Timed out" message.

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-31 13:25:27 -04:00
waterss dccdb8a4f8 SP now in Icon on bottom left of game screen, just above cards.
- Added SP and ST images in icons/
2026-03-31 11:51:15 -04:00
waterss 318c50c2a6 Update LoginScreen 2026-03-31 10:57:43 -04:00
95841b724a Disable all multi-finger gestures in buttons camera mode
2-finger pinch/pan, 3-finger pan, MagnifyGesture, and PanGesture are
now gated behind gesture mode. In buttons mode only single-finger drag
(controlled by the active toggle button) affects the camera.

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-31 09:44:58 -04:00
7da9335599 Disable gesture timer accumulation in buttons camera mode
Gesture movement tracking and timer cancellation in ScreenDrag were
running unconditionally. Gate them behind gesture mode so buttons mode
is fully independent of gesture logic.

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-31 09:23:46 -04:00
dingo 431ae6fc2c Typing fix 2026-03-31 09:00:54 -04:00
Shard a655ce8e47 Fix board click occupant redirect: ignore null occupantId for movement 2026-03-31 12:46:56 +00:00
Shard a1e7bd06b1 Set web client to 72fba92 baseline for confirmation 2026-03-31 12:29:48 +00:00
Shard dead968e51 Set web client to 2e3e284 baseline for confirmation 2026-03-31 12:14:14 +00:00
Shard 1b968b30f1 Rollback web client camera/input files to 515bfaa for bisect baseline 2026-03-31 12:04:26 +00:00
dingo 45eb19615c Breaking it worse 2026-03-31 07:56:46 -04:00
72fba92af5 Fix touch: use start-to-end distance to distinguish taps from camera drags
Cumulative drag distance (_touch_drag_total) is the wrong metric for tap
detection: natural finger jitter (A→B→A) can exceed 36 px even on a clean
tap, silently suppressing board clicks (unit moves, card plays, etc.).

Switch the board-click gate to start-to-end distance (< 50 px = tap).
_touch_drag_active now only means "camera mode fired during this touch" and
is set by the gesture timer or when an active camera mode consumes a drag.
This means taps always reach _handle_board_click regardless of finger wobble.

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-30 19:58:52 -04:00
6e27f57d7a Fix touch input: tap suppression must only fire when camera mode is active
_touch_drag_active was set unconditionally on 36px drag, silently eating
board taps even when no camera action occurred. Now only set when a camera
mode (orbit/pan/zoom) is actually active. Gesture timer also immediately
marks drag-active on activation so the 3s hold doesn't fire a board click.
Buttons enlarged to 44px minimum height for touch usability.

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-30 17:34:31 -04:00
08be334b4d Add Option 3 touch camera: gesture hold and button toggle modes
- Settings: new touch_camera_mode ("gesture"|"buttons"), persisted to camera section
- GameScreen: CamGestureTimer (3 s), CamCtrlPanel with Orbit/Pan/Zoom toggle buttons
- game_screen: gesture timer fires orbit/pan/zoom after 3-second stationary hold;
  button mode shows on-screen toggles; single-finger drag now gated behind active mode
- InGameSettings: Camera Controls section with Touch Camera OptionButton

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-30 17:21:13 -04:00
3bc7c30093 Fix camera control: right-click orbits, left-click always fires board action
Left-click drag was orbiting the camera on desktop, so any mouse movement
>2px during a click would suppress _handle_board_click. Moved camera orbit
to right-mouse drag (_orbit_active flag) leaving left-click exclusively for
board actions regardless of mouse movement. Touch single-finger orbit is
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-30 13:51:03 -04:00
dingo d541dccb78 camera control fight 2026-03-29 22:03:52 -04:00
247d92c253 Fix touch: use cumulative drag distance to distinguish taps from swipes
4px per-event threshold was too sensitive — normal finger tremor during
a tap could exceed it, causing _touch_drag_active to suppress the click.
Now accumulates total drag distance since touch-down; requires 12px total
movement before classifying the touch as a camera orbit.

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-29 18:07:20 -04:00
Shard 206ff9a212 Add touch tap/hold selection and keep one-finger orbit 2026-03-29 19:55:03 +00:00
b9e6dc6e80 Fix touch input: distinguish taps from swipes for camera vs click
Added _touch_drag_active flag set only when finger moves > 4px threshold.
Camera orbit now requires meaningful drag; taps no longer jiggle camera
or get swallowed — board clicks fire correctly for gameplay actions.

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-29 10:48:05 -04:00
Shard 864ae4a847 Ignore single-touch PanGesture to preserve one-finger orbit 2026-03-29 14:14:18 +00:00
a2a7d7bff0 Fix indentation in _unhandled_input touch guard comment/condition
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-29 10:05:48 -04:00
Shard ed5e8f12c3 Guard mouse orbit during touch gestures in browser 2026-03-29 13:48:31 +00:00
38a7a23c5f Fix browser multi-touch: prevent camera spin during pinch gestures
- Add _was_multi_touch flag: set when second finger lands, cleared only
  when all fingers lift — prevents single-finger orbit logic from running
  during a pinch even if ScreenDrag(finger-0) arrives before ScreenTouch(finger-1)
- Handle InputEventMagnifyGesture (trackpad/browser pinch-to-zoom) and
  InputEventPanGesture (two-finger pan) which browsers emit instead of
  raw dual ScreenDrag events
- Initialize _last_mouse from touch pair midpoint when second finger lands
  so two-finger pan has a correct delta baseline

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-29 09:39:11 -04:00
515bfaabdf Implement triggered ability target prompting (Option D)
When a Triggered ability fires and any of its actions require a human target
pick, the server now pauses execution instead of auto-resolving:

Server:
- AbilitySystem.FireTrigger detects actions needing client input via
  ActionNeedsClientTargets(); stores PendingTriggeredTarget in GameState and
  returns early rather than executing the ability
- PushStateToPlayersAsync (GameHandlerBase) checks for PendingTriggeredTarget
  after every state push and sends a game.ability.triggered_target_request push
  to the owning player carrying the action definition and range
- New GameTriggeredTargetHandler (game.triggered_target) receives the player's
  picks, calls AbilitySystem.ResumeTriggeredAbility, and broadcasts the result
- PendingTriggeredTarget model stored in GameState.PendingTriggeredTarget (JSONB)

Client:
- Game.gd handles the triggered_target_request push and emits a signal
- game_screen.gd connects the signal, re-uses the existing ABILITY_TARGET mode
  and _start_ability_targeting() flow, then sends game.triggered_target instead
  of game.activate_ability when done
- A brief banner ("Triggered: <name> — select a target") informs the player

"Warrant Cover" (OnChanneled, Owner unit pick) will now correctly prompt the
player to select which friendly unit gains +1 Defense.

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-28 18:50:48 -04:00
cb601abd00 Add tile detail drawer, click-to-focus-camera, and occupied tile click redirect
- Right-side slide-in drawer shows tile coords, affinity, base1/base2, ruin,
  and occupant name when any tile is clicked in NONE mode; auto-closes on mode change
- New 'Focus camera when clicking a tile' setting (Settings.click_to_focus_camera),
  toggled in in-game settings panel, tweens camera to clicked tile
- Clicking a tile occupied by a unit now redirects to that unit in both NONE
  and UNIT_SELECTED modes, so you no longer need to hit the unit mesh exactly

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-28 17:36:01 -04:00
2e3e284023 Fix ability targeting gaps: multi-target, UpTo, ChooseOne, LinearOnly, RequiresLos
- AbilityTarget: add BranchIndex for ChooseOne branch selection
- Action: add ChooseOne? property; when set the action is a branch selector
- AbilitySystem: ExecuteSingleAction handles ChooseOne — reads BranchIndex
  from client targets, executes chosen branch actions (auto-resolved)
- game_screen.gd: count.N > 1 — input handler now accumulates targets until
  N collected before advancing to next action
- game_screen.gd: count.UpTo — show "Done Selecting" confirm button so player
  can finish with fewer than N targets
- game_screen.gd: ChooseOne — detect chooseone key in action dict, show branch
  panel with labelled buttons, record branchIndex in target payload
- game_screen.gd: LinearOnly — _is_linear() filter applied to both tile and
  unit highlights when ability range has linearonly=true
- game_screen.gd: RequiresLos — _client_has_los() supercover DDA (matches
  server LineOfSight.HasLos) applied to highlights when requireslos=true

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-28 16:27:47 -04:00
bd59904ce2 Add Decagonal board shape, team reassignment, and multiplayer considerations
- BoardShapeGenerator: add MakeDecagonal() for 7-10 players (10-armed
  radial, 11x11 arena, 21x21 total); AutoShape now routes 7-10 to Decagonal
- CustomLobby: add TeamAssignmentsJson (seat -> team override map)
- GameMessages: add ReassignTeamRequest/Response, LobbyTeamAssignmentChangedPush,
  SeatTeams field on JoinCustomLobbyResponse
- GameReassignTeamHandler: new game.custom.reassign_team handler (host-only);
  pushes team_reassigned to all participants including additional players
- EF migration: AddTeamAssignmentsToLobby (applied to pg-forge-01)
- Client CustomLobby.gd: seat_teams state, reassign_team() action, push handler
- lobby_room_screen.gd: _rebuild_team_controls() renders host-only [<] Tx [>]
  cycle buttons per seat in team modes; _team_label() reads seat_teams overrides
- OVERALL.md: add Considerations for Later (fog of war, asymmetric teams, ranked ELO)

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-28 15:18:53 -04:00
450c71544d Fix nil crash: int(null) on currentHealth in damage animations
unit.get("currentHealth", 0) returns null when the key exists with a
null value; int(null) has no valid constructor in GDScript 4.
Use explicit null check before casting.

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-28 12:05:57 -04:00
04ad45d0f7 Fix nil crash when clicking card with null abilitiesJson
card.get("abilitiesJson", "") returns null when the key exists but
the server sent null — the default only fires for absent keys.
Assigning null to a typed String variable throws in GDScript 4.

Use an explicit null check instead of relying on the dict default.

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-28 11:39:58 -04:00
66b116b5e0 Fix bool crash in _play_damage_animations (GDScript or operator)
GDScript 4's `or` is a logical operator that returns bool, not the
left/right value like Python. `player.get("archSpirit") or {}` was
putting true/false into the iteration array instead of the dict,
causing `is_empty` to fail with 'base bool'.

Replace with an explicit null check:
  var _arch_list = [] if arch_raw == null else [arch_raw]

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-28 11:30:09 -04:00
ba898f610a Filter channel tile highlights to matching affinity only
Spirits may only be channeled onto tiles whose resolvedAffinity
matches the card's affinity. Previously all unoccupied in-range tiles
were highlighted regardless of affinity.

Also:
- Cache Game.get_tile() result to avoid double lookup per cell
- Add sparse-board guard (_tile_bodies existence check)
- Remove stray debug print statements

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-28 11:12:39 -04:00
883543d8de Fix nil crash in _play_damage_animations on player concede
When a player is eliminated, the server sends archSpirit: null.
player.get("archSpirit", {}) returns null (not {}) when the key
exists but its value is null — the default only fires for missing
keys. GDScript then throws assigning null to unit: Dictionary.

Use `player.get("archSpirit") or {}` which coerces any falsy value
(null, missing key) to an empty dict before building the iteration
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-28 10:20:07 -04:00