Commit Graph
83 Commits
Author SHA1 Message Date
dingo c19cf651de build(web): ensure export presets exist in image and precreate .godot/editor for headless export 2026-02-28 03:37:25 +00:00
dingo 505c0b59fa build(web): force compatibility renderer + import pass; export and copy index.html 2026-02-28 03:25:00 +00:00
dingo 1252486c3c ci: build Godot web export inside Dockerfile to avoid dind workspace mount issue 2026-02-28 03:20:50 +00:00
dingo 1301208fc5 ci: fix Harbor login for robot username containing $ 2026-02-28 03:13:33 +00:00
dingo 342230e5d7 ci: always trigger web client build on main pushes 2026-02-28 03:09:51 +00:00
dingo 0383dd431b Add Godot web client build pipeline, image packaging, and Argo webclient deployment manifests 2026-02-28 02:47:41 +00:00
2d6b20f3cb Godot client: version check + content sync + caching architecture
Client flow after auth is now:
  LoginScreen → auth_success → InitScreen → MainScreen

autoloads/ContentCache.gd
  - Cursor-based incremental sync via content.sync (PageSize=200)
  - Merges definition DTOs in-memory (id → Dictionary)
  - Persists to user://content/defs.json on sync completion
  - Incremental on repeat launches: 0 round trips when nothing changed
  - Signals: sync_progress(fetched_total), sync_complete(total), sync_failed(error)

scenes/init/InitScreen.tscn + init_screen.gd
  - Step 1: version.check (clientVersion="0.1.0", platform="web")
      UpdateRequired  → show "please refresh" panel, block
      UpdateAvailable → soft banner, continue
      Ok              → continue
      DISCONNECTED    → wait for Network.connected (one-shot), retry
      other error     → warn + proceed (don't block player on non-critical check)
  - Step 2: ContentCache.start_sync()
      Shows running card count while pages arrive
      On sync_complete: transition to MainScreen
      On sync_failed: show error + Retry button

scenes/login/login_screen.gd
  - _go_to_main() now routes to InitScreen instead of MainScreen directly

project.godot
  - ContentCache registered as autoload (loads before Auth)
  - pointing/emulate_touch_from_mouse=true for desktop browser testing

Caching architecture decision (see plan):
  - Layer 1 (definitions/text): always sync all eagerly — no privacy concern
  - Layer 2 (2D art): lazy by definition ID, CDN fetch on demand
  - Layer 3 (3D models/animations): set-bundle granularity + server-injected
    noise during match pre-warm to prevent cache oracle attack
    (Layer 2/3 implementation is future work)

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-02-27 21:31:47 -05:00
3aaabe75e3 Godot client networking + auth + login/main screens; fix admin hamburger
Server:
- ConnectionLoop: accept auth.login and auth.register as valid first messages
  (not just auth.hello); all ack payloads now include sessionToken for client
  persistence
- IGatewayAuthValidator: add LoginAsync and RegisterAsync
- GatewayAuthValidator: implement both via auth gRPC; fetch displayName from
  ValidateAsync after login/register succeeds
- Admin hamburger: custom .sor-admin-hamburger CSS (hardcoded white, no Bootstrap
  btn-link theme fighting); topbar z-index 1050 with position:sticky

Client (Godot 4.5, GDScript):
- autoloads/Network.gd: WebSocketPeer state machine (CONNECTING / CONNECTED /
  RECONNECTING), exponential backoff (1→30s), app-level keepalive ping every
  30s of idle, 30s ping timeout → reconnect, request/reply correlation by
  sequence number, debug_log_packets export flag for full packet dumps
- autoloads/Auth.gd: drives auth.hello / auth.login / auth.register as first
  WS message; persists sessionToken + userId + displayName to user://auth.cfg;
  auto-resumes saved session on reconnect; auth_success / auth_failed signals
- scenes/login/LoginScreen.tscn + login_screen.gd: Login + Register tabs,
  touch-friendly inputs (44px height), status label, Enter key submits, handles
  reconnect/resume states
- scenes/main/MainScreen.tscn + main_screen.gd: top bar with live connection
  dot, welcome label, placeholder nav buttons, sign-out, redirects to login on
  session expiry
- project.godot: Network and Auth autoloads registered; LoginScreen as main scene

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-02-27 20:48:53 -05:00
dingo af9e335868 docs: add client map from server handlers to client scenes 2026-02-28 00:33:20 +00:00
fb889ae8d7 Admin portal: mobile-friendly layout + nav drawer
app.css:
- New .sor-admin-outer wrapper (flex column, 100vh) so topbar + shell stack vertically
- .sor-admin-shell changed from height:100vh to flex:1 (fills remaining space)
- .sor-admin-topbar: hidden on desktop (display:none), shown at <992px as a 56px
  dark strip hosting the hamburger button and brand
- .sor-admin-sidebar: at <992px becomes a fixed overlay drawer (position:fixed,
  translateX(-100%)), slides in with .open class (0.25s ease-in-out transition)
- .sor-admin-backdrop: full-screen dim overlay (z-index 1040), hidden on desktop
- Minor: tighter container-fluid padding on small screens

MainLayout.razor:
- Wrapped authorized shell in .sor-admin-outer
- Added mobile topbar with hamburger (<i class="bi bi-list">) + brand
- Added backdrop div rendered conditionally when _drawerOpen
- Drawer state (_drawerOpen bool) managed here; toggled by hamburger, closed
  by backdrop click and automatically on any NavigationManager.LocationChanged
- Implements IDisposable to unsubscribe LocationChanged event handler
- Passes IsOpen parameter to NavMenu

NavMenu.razor:
- Added [Parameter] public bool IsOpen { get; set; }
- Applies "open" CSS class to <nav> when IsOpen is 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-02-27 19:04:25 -05:00
4440c6c981 Split sor-host into dedicated gateway and workers deployments
Before: 3 pods ran ENABLED_SERVICES=all — gateway, auth, and every
business-logic service co-hosted. This defeated the purpose of the
gateway pattern and prevented independent scaling.

After:
  sor-gateway (2 replicas) — ENABLED_SERVICES=gateway,auth
    • WebSocket edge, accepts client connections
    • Auth co-located (JWT validation is a localhost gRPC call, no network hop)
    • Lighter resource footprint: 150m/128Mi request, 500m/512Mi limit
    • Ingress at hub.aeternalisgames.com → sor-gateway:80

  sor-workers (3 replicas) — ENABLED_SERVICES=chat,collection,bazaar,
                               content,versioning,matchmaking,game
    • Subscribes to NATS, handles all business-logic messages
    • Holds DB connection pools for all schemas
    • Internal only — no ingress
    • Heavier resources: 300m/384Mi request, 1000m/1Gi limit

configmap.yaml: removed ENABLED_SERVICES=all and Services__Auth (each
  deployment now sets these directly in its own env block)

ingress.yaml: hub.aeternalisgames.com backend sor-host → sor-gateway

ArgoCD prune=true will delete the old sor-host Deployment + Service
from the cluster on next sync.

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-02-27 14:44:08 -05:00
32fc0b80ed Extend booster pack slot system — 4 slot kinds + handler support
BoosterPackEditor.razor:
- New SlotKind enum: Rarity, Specific, RandomFromSet, Random
- Pack-level default CardSet picker (maps to BoosterPack.CardSetId)
- Per-slot UI: Rarity (rarity + set override), Specific (card GUID + name resolve),
  RandomFromSet (set dropdown), Random (any published card)
- Backwards-compatible SlotsJson parse (detects legacy lowercase format)
- Slot legend card explaining all 4 types

BazaarBuyBoosterPackHandler.cs:
- Replace old SlotEntry record with JsonElement-based parsing
- Rarity slots: slot-level SetId → pack.CardSetId → all sets
- Specific slots: guarantee exact CardDefinitionId (Count ≥ 1 for duplicates)
- RandomFromSet slots: random from a given set, no rarity filter
- Random slots: random from all published cards
- Refund OriginPoints on bad SlotsJson before returning error
- Extract CreateAndTrackCard helper to deduplicate PlayerCard creation

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-02-27 13:56:24 -05:00
98f80f729b Structured ability builder UI + chat moderation
AbilityBuilder:
- Replace all raw JSON textareas with structured per-type editors
- Cost editor: Add/remove list with type dropdown + amount input (8 cost types)
- Activation & action condition editors: grouped type dropdown (Turn/Timing,
  Unit, Player, Tile, Battlefield, Composite) + Subject select + per-type
  inline fields for every condition (N inputs, affinity/ownership/comparator
  selects, etc.)
- Effect fields: dedicated labeled inputs for all 59 effect types — Amount,
  BypassDefense, Tiles, BlockedDamage, Direction, Duration, Player, Affinity,
  Tag, AbilityRef, StatTarget, Multiplier, etc.; raw JSON textarea kept only
  for AddAbility/ApplyOnEvent/SummonToken

ChatChannelViewer:
- Add "Send as Admin" compose panel (message attributed to logged-in admin
  account) alongside the existing System message panel
- Add Delete (trash) button per message row for soft-delete (IsDeleted=true)
- Add Restore button on deleted messages to reverse the soft-delete

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-02-27 13:40:22 -05:00
487f84d084 Add BlockedDamage, RequiresLos, and LinearOnly to ability schema + builder UI
- PushUnitEffect and PullUnitEffect gain BlockedDamage (int): deals direct HP
  damage to the displaced unit if it cannot complete the full tile distance
  (blocked by a boundary or another unit)
- AbilityRange gains RequiresLos (bool): engine validates line of sight before
  allowing ability activation
- AbilityRange gains LinearOnly (bool): restricts targeting to cardinal/diagonal
  straight lines only (suitable for Push/Pull/beam abilities)
- AbilityBuilder UI exposes RequiresLos and LinearOnly as inline checkboxes in
  the Active ability range row
- PushUnit/PullUnit effect templates auto-populate with BlockedDamage: 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-02-27 11:01:03 -05:00
c493b1b50b Admin portal: dark mode, account management, chat fixes, ability builder
• Light/dark mode toggle: Bootstrap 5.3 data-bs-theme, theme persisted to
  localStorage via admin.js, Moon/Sun icon button in sidebar, flash-free
  inline <script> in App.razor applies saved theme before first render.

• Account management: Add "Create Account" button + new /accounts/new page
  (email, display name, password, role checkboxes). AccountDetail now has
  interactive role assignment (Add/Remove Admin/SuperAdmin — SuperAdmin
  actions gated with <AuthorizeView Roles="SuperAdmin">) and a force-reset
  password section (RemovePasswordAsync + AddPasswordAsync, no current
  password required).

• Chat fixes: stat card labels changed from text-muted → text-white-50 for
  readability on bg-dark; card-headers now have border-bottom border-secondary
  to visually separate from card bodies; "View" button relabeled "View & Post"
  to surface the hidden compose feature.

• Ability builder (AbilityBuilder.razor): structured UI replacing the raw
  textarea in CardEditor. Supports all 4 ability types (Active/Passive/Aura/
  Triggered) with type-specific fields (range, uses/turn, aura range, trigger
  dropdown). Each ability holds structured actions (scope/type/ownership/count
  dropdowns) and effects (59 types in 11 grouped optgroups; each auto-populates
  a JSON fields template on type selection). Description field stores plain-
  English text in the JSON. Raw JSON toggle + Apply for power users. Live
  compiled JSON preview.

• AbilitySystem: added JsonStringEnumConverter so JSONB enums serialize as
  human-readable strings ("Active" vs 0, "Battlefield" vs 3, etc.).
• AbilityDefinition: added optional Description property (admin-only 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-02-27 10:36:02 -05:00
b749905333 Strengthen admin seed fallback password
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-02-27 09:52:39 -05:00
9186a2a7f3 Hide sidebar until authenticated; wire Admin seed credentials
- MainLayout.razor: wrap shell in <AuthorizeView> so the sidebar and
  nav are only rendered when the user is logged in. Unauthenticated
  pages (login) render @Body directly, giving the login card its full
  viewport without the nav overlay.
- deployment-admin.yaml: inject Admin__Email / Admin__Password from
  sor-app-secrets so the startup seed picks up production credentials.
- sor-app-secrets.yaml.template: add Admin__Email / Admin__Password
  placeholder entries with instructions.
- secrets/README.md: document the two new seed-account keys.

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-02-27 09:47:20 -05:00
dingo 0fd4592b6d k8s: move admin ingress host to control.aeternalisgames.com 2026-02-27 14:39:27 +00:00
fe5cd2d424 Add EF design-time factories; fix Game migration; document DB ops
- DesignTimeFactories.cs: adds IDesignTimeDbContextFactory<T> for all
  6 contexts so dotnet-ef tools work without starting the full ASP.NET
  host (previously failed because Redis/NATS aren't available locally)
- SOR.Host.csproj: adds Microsoft.EntityFrameworkCore.Design (PrivateAssets=all)
  as the EF design-time host still requires it in the startup project
- Game/AddGameRulesAndCustomLobby: emptied Up/Down — migration was generated
  with a stale snapshot duplicating InitialCreate tables; actual GameRuleSet
  and CustomLobby schema is in AddBoardDimensions
- deploy/database-migrations.md: documents how to apply/add migrations
  against any environment; records pg-forge-01 state as of 2026-02-27

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-02-27 09:32:30 -05:00
dingo 8a9ccdba5e docker: include networking abstractions csproj in admin restore layer 2026-02-27 12:59:43 +00:00
dingo 14ff097b8b docker: include Matchmaking and Game csproj in host restore layer 2026-02-27 12:54:57 +00:00
dingo 6b817277d1 ci: support grouped HARBOR secret fallback for registry login 2026-02-27 12:44:30 +00:00
dingo 8f17a6df6d ci: restore checkout and support registry/robot secret variants 2026-02-27 12:30:48 +00:00
dingo 44d8d06baf ci: align SOR workflow with working SystemRevivalServer runner pattern 2026-02-27 12:28:13 +00:00
dingo 7129ff4883 ci: run on ubuntu-22.04 runner label and ensure docker CLI 2026-02-27 11:52:54 +00:00
dingo 9b69a2e1de ci: replace JS-based actions with shell docker build/push for self-hosted runner 2026-02-27 11:50:46 +00:00
dingo 8c941686e0 ci: use self-hosted runner selector for gitea actions 2026-02-27 11:16:00 +00:00
dingo 47c7f1c229 ci: retrigger pipeline after runner restart 2026-02-27 11:14:33 +00:00
dingo 555f4a2d55 ci: trigger gitea actions after runner label fix 2026-02-27 11:13:57 +00:00
dingo 549facb97f ci: target self-hosted gitea runner labels 2026-02-27 11:11:16 +00:00
dingo 95efbcf0be ci: run build-push workflow on main branch 2026-02-27 10:49:42 +00:00
b6ac58bada Switch CDN to S3-compatible Ceph RadosGW (AWSSDK.S3)
Replace custom HttpCdnClient (proprietary upload API) with S3CdnClient
backed by AWSSDK.S3 using ForcePathStyle for Ceph RadosGW compatibility.
CdnOptions gains EndpointUrl/AccessKey/SecretKey/BucketName; removes
UploadBaseUrl/ApiKey. K8s deployments and secrets template updated to
match new config keys.

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-02-27 00:57:15 -05:00
b442ed3d9c ci: switch registry to registry.aeternalisgames.com, rename host image sor-server
- REGISTRY: harbor.aeternalisgames.com → registry.aeternalisgames.com
- Host image: sor-host → sor-server (sor-admin unchanged)
- Remove stale TODO comments from k8s manifests
- Update harbor-pull-secret template with new registry hostname
- Update gameplay-effects-gap.md and gameplay-todo.md to reflect
  completed implementation work

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-02-26 23:12:13 -05:00
92d2e34a68 Implement missing ability effect handlers and gameplay rules
- GameState: add CardInstance fields — CanBeAttacked, CanBeBlocked,
  CanBeObstructed, CanUseAbility, CanBeSacrificed, ExtraAttacksRemaining,
  FixedSacrificeReturn, DisabledAbilities, IsRevealed
- GameState: add PendingDeferredEffect model + GameState.PendingDeferredEffects
- GameEngine.Attack: enforce CanBeAttacked; ExtraAttacksRemaining (extra
  attacks decrement rather than exhausting)
- GameEngine.Sacrifice: enforce CanBeSacrificed; use FixedSacrificeReturn
  override when set
- GameEngine.EndTurn: reset ExtraAttacksRemaining to 0 with other resets

AbilitySystem effect handlers (18 new):
  §5.1  GrantAdditionalAttackEffect
  §5.2  SetCanBeAttacked/Blocked/Obstructed/UseAbility/BeSacrificed
  §5.3  AddAbility/RemoveAbility/EnableAbility/DisableAbility
  §5.7  ReturnToBattlefield, SearchDeck, RevealCards, PlaceOnDeck
  §5.9  DisplaceUnit (absolute direction: N/S/E/W/NE/NW/SE/SW)
  §5.10 GrantMovementControl, SetFixedSacrificeReturn
  §5.12 ApplyOnEvent (deferred; fires once on trigger; cancelled on source death)

AbilitySystem additions:
- ActivateAbility: enforce CanUseAbility + DisabledAbilities
- FireCardEffects / ActivateAbility: requireClientTargets=true for
  mandatory explicit-target validation (gameplay-todo.md)
- ResolveTargets: empty candidates when clientTargets=null + mandatory
  selector, causing INSUFFICIENT_TARGETS for required but missing targets
- FireTrigger: drain PendingDeferredEffects that match the current event
- KillUnit: cancel PendingDeferredEffects whose source is dying
- ParseDirection, TileMatchesFilters helpers
- CreateTokenFieldCard: copy new CardInstance flag fields

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-02-26 21:28:41 -05:00
7c89f4d0db Fix ability lock-out guards, implement SummonTokenEffect, thread card targets
- GameEngine.Transition: enforce CanTransitionArchSpirit flag
- GameEngine.ChannelCard: enforce CanChannelSpirit, CanChannelRepentance,
  CanChannelInstinct, CanChannelRuin, CanChannelTerramorphaMono/Di/Tri
- GameEngine.ChannelCard: accept IReadOnlyList<AbilityTarget>? cardTargets;
  thread through FireCardEffects for Repentance/Instinct effects
- AbilitySystem.FireCardEffects: accept and forward clientTargets to ExecuteActions
- AbilitySystem.ExecuteEffect: implement SummonTokenEffect — deserialize TokenDefJson,
  create SpiritToken FieldCard, place on board, fire UnitEnterBattlefield + aura enter
- GamePlayCardRequest: add IReadOnlyList<AbilityTarget>? Targets for unit/tile inputs
- GamePlayCardHandler: pass req.Targets to ChannelCard

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-02-26 21:10:20 -05:00
dingo 0641fb2324 Document missing SearchDeck execution and audit unimplemented ability effects 2026-02-27 01:07:44 +00:00
dingo d5d86fbd0e Add gameplay TODO for target-gated Repentance/Instinct and aura transition walkthrough 2026-02-27 00:39:28 +00:00
dingo 9e4f9c8c9d Allow Instinct quick-play on any turn; keep other cards main-phase only 2026-02-27 00:22:25 +00:00
dingo ab8dc4a032 Interum manual push 2026-02-26 19:19:34 -05:00
8c5b65192f Add aura range evaluation — EnterAuraRange/LeaveAuraRange triggers
- Add EnterAuraRange and LeaveAuraRange to TriggerEventKind enum
- Add TriggerMatches cases for OnEnterAuraRangeTrigger / OnLeaveAuraRangeTrigger
  with AuraOwnership + UnitOwnerMatches (ally/enemy/any) scope filtering
- Add EvaluateAuraTransitions (on move), EvaluateAurasOnEnter (on channel),
  EvaluateAurasOnLeave (on sacrifice/kill) public methods to AbilitySystem
- Bidirectional evaluation: moving unit vs. stationary auras + moving unit's
  own auras vs. stationary units
- Hook into GameEngine: MoveUnit, ChannelCard (Spirit), Sacrifice
- KillUnit now calls EvaluateAurasOnLeave before board removal

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-02-26 16:48:50 -05:00
39b80ccbdd Add duration tracking — TrackEffect, TrackTick, ExpireActiveEffects, TickActiveEffects
- ExecuteEffect now builds and stores reversal effects in GameState.ActiveEffects
  for all non-Instant durations (stat deltas, flag toggles, genus, affinity)
- DOT/HOT effects register tick entries instead of reversals
- TrackedDuration wrapper records owner + IsTick flag alongside DurationModel
- ExpireActiveEffects handles UntilEndOfTurn, UntilStartOfOwnerTurn, ForNTurns,
  WhileCondition; applies reversal on expiry for non-tick entries
- TickActiveEffects fires DOT/HOT damage/healing each turn end
- GameEngine.EndTurn: tick → expire(end) after TurnEnd trigger;
  expire(start) after player switch, before TurnStart trigger

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-02-26 16:35:37 -05:00
be8c0844c6 Add AbilitySystem — core effect execution, trigger hooks, activate_ability handler
- AbilitySystem.cs: full rewrite — ActivateAbility, FireTrigger, FireCardEffects,
  ExecuteActions, ResolveTargets, ExecuteEffect (§5.1–5.10), condition evaluation,
  filter evaluation, trigger matching, value/affinity resolution
- GameState.cs: CardInstance gains AbilitiesJson, EffectsJson, AbilityUsesThisTurn,
  Genus; PlayerState gains SpAccumulationBonus, DrawPerTurnBonus and 12 action-
  restriction flags; GameState gains ActiveEffects list; new ActiveEffect class
- GameMessages.cs: GameActivateAbilityRequest/Response + AbilityTarget DTO
- GameEngine.cs: ActivateAbility public method; trigger hooks in ChannelCard,
  MoveUnit, Attack (UnitAttack + UnitDeath), Sacrifice, EndTurn (TurnEnd/TurnStart),
  Ascend, Transition; AbilitiesJson/EffectsJson copied in DefinitionToInstance,
  BuildPlayerState, ToFieldCard; Repentance/Instinct/Ruin now fire EffectsJson inline
- GameActivateAbilityHandler: game.activate_ability message handler
- ServiceRegistration: register GameActivateAbilityHandler

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-02-26 16:16:46 -05:00
dingo 2fe3803599 Interum manual push 2026-02-26 13:11:03 -05:00
b46f4e9157 Add Ascend, Transition, and Terramorpha implementations
- CardInstance: add Tier, PreviousTierId (ascension chain), TerramorphaMode
- GameEngine.Ascend (§6.7.2): any-zone search, tier+lineage validation, full HP/Def/MP on entry
- GameEngine.Transition (§6.7.1): hand-only, Tier 1 guard, full HP/Def/MP on entry
- GameEngine.ChannelCard: Terramorpha path (Mono/Di/Tri tile count + adjacency + affinity push);
  non-Spirit, non-Terramorpha cards now correctly go to Discard instead of Field
- GamePlayCardRequest: add TargetTiles for multi-tile Terramorpha; handler routes accordingly
- CardInstanceDto: expose Tier and TerramorphaMode to clients
- New handlers: game.ascend, game.transition

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-02-26 12:45:23 -05:00
9b6b7191f0 Add square grid system, positional combat, sacrifice, and Placement phase
Grid infrastructure (SOR.Game/Grid/):
- Coord — immutable (X,Y) struct with Manhattan distance, adjacency, BFS helpers
- Tile — mutable affinity slots (Base1/Base2) + occupancy tracking
- Board — 8×8 (configurable) grid, PlaceUnit/RemoveUnit/MoveUnit/BuildOccupancyMap
- Pathfinding — Walk/Flight BFS (GetReachableWithCost), Jump/Teleport range (GetJumpRange)
- LineOfSight — supercover DDA; occupied intermediate tiles block LOS
- AffinitySystem — full Resolve table for all 20+ affinities per affinity.md,
  PushAffinity, ApplyPlacementAffinity, IsAffinityValid (basic vs non-basic rules)

Combat (SOR.Game/Combat/):
- AttackSystem — Manhattan range + optional LOS validation (§6.10)
- SacrificeSystem — exact ST return formula from gameplay.md §6.15

Abilities (SOR.Game/Abilities/):
- AbilitySystem stub — future pass per abilities.md

Game engine / state changes:
- GamePhase: added Placement phase (before Draw)
- GameRuleSet + GameRules: added BoardWidth/BoardHeight (default 8×8)
- GameState: added Board, PlayerOneAccountId; CardInstance gains MovementType,
  MaxMp, MinAttackRange, MaxAttackRange, RequiresLos, MinChannelRange,
  MaxChannelRange, IsLeader (moved from FieldCard); FieldCard adds Position + CurrentMp
- [JsonPolymorphic] on CardInstance so FieldCard survives JSONB round-trip
- JsonStringEnumConverter added to GameEngine serializer options
- GameEngine.Initialize: creates Board + sets Placement phase; no opening draw yet
- GameEngine.PlaceArchSpirit: validates row, pushes affinity, triggers opening draw
  and SP gain when both players placed
- GameEngine.ChannelCard (was PlayCard): validates channeling range + affinity for Spirits
- GameEngine.MoveUnit: Walk/Flight BFS, Jump (1 MP/landing), Teleport (LOS + 1 MP)
- GameEngine.Attack: adds range+LOS validation via AttackSystem
- GameEngine.Sacrifice: adjacency + SacrificeSystem ST formula
- GameEngine.EndTurn: now also restores MP (§6.0 step 1) for next player
- ToDto: includes Board tiles with resolved affinities; CardInstanceDto gets Position,
  CurrentMp, MaxMp, MovementType

New handlers: game.place_arch_spirit, game.move_unit, game.sacrifice
Updated handlers: game.play_card (target tile), GameReadyHandler (new Initialize sig)
Migration: AddBoardDimensions (board_width/board_height on game_rule_sets)

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-02-26 11:22:30 -05:00
7ab11e6f46 Fix defense restore order + add StateVersion for client sync
Defense restore bug fix:
- EndTurn previously restored defense for the ENDING player's units (wrong)
- Per §6.0 start-of-turn order: defense restores for the player whose turn is STARTING
- IsExhausted still resets for the ending player (they finished acting)
- This prevents opponents attacking into fully-restored defense every turn

StateVersion on GameStateDto:
- NextActionSequence from GameState exposed as StateVersion in every state push
- Clients track lastSeen StateVersion; if push arrives with version > lastSeen+1,
  client calls game.get_state for a full board refresh
- game.get_state already returns full state — no additional server work needed

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-02-26 08:17:29 -05:00
682a525193 Fix gameplay engine rules + add RuleSet/CustomLobby system
Engine corrections (per gameplay.md + user spec):
- Opening draw: both players draw 6 cards at game start
- P1 skips Draw phase on turn 1 (already has opening hand);
  P2 draws once at start of their first turn → 7 cards total
- SP: starts at 0, accumulates +3/turn (never resets, no cap by default)
- ST: starts at 0, earned only through sacrifice (no per-turn grant)
- No entry sickness: units can attack/move/ability the turn they are summoned
- Defense restores to MaxDefense at start of each turn (§6.9.3)
- Rename Graveyard → Discard throughout (GameState, GameEngine, GameMessages)
- Remove IsEntrySick flag from CardInstance and CardInstanceDto

GameRuleSet / CustomLobby infrastructure:
- GameRuleSet DB entity: admin-configurable rules (IsRankedDefault, IsCustomDefault)
- GameRules record (SOR.Game): in-memory config embedded in GameState.Rules
- GameSession.RuleSnapshotJson: immutable per-session rule snapshot (jsonb)
- MatchmakerService: loads ranked ruleset and snapshots it into each GameSession
- GameReadyHandler: deserializes rule snapshot and passes rules to GameEngine.Initialize
- CustomLobby DB entity: host+guest, rule overrides, GameSessionId link
- CustomLobbyStatus enum: Open / Full / Started / Cancelled

Custom game handlers (4):
- game.custom.create — host creates lobby with optional rule overrides
- game.custom.join  — guest joins; when full, creates GameSession + pushes both players
- game.custom.leave — host cancels or guest leaves
- game.custom.list  — paged list of Open lobbies

Admin portal:
- /game/ranked-rules — edit the ranked play ruleset (auto-seeds default on first visit)
- /game/custom-lobbies — read-only view of active and recent custom lobbies
- NavMenu: added Ranked Rules + Custom Lobbies links under Game

Migration: AddGameRulesAndCustomLobby (game_rule_sets, custom_lobbies,
  rule_snapshot column on game_sessions)

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-02-26 07:55:32 -05:00
2058a47a92 Add matchmaking + gameplay services (SOR.Matchmaking + SOR.Game)
DB layer:
- Account.RankScore (int, default 1000) — ELO rank for matchmaking
- GameEnums: MatchmakingStatus, GameSessionStatus, GamePhase
- Entities: MatchmakingEntry, GameSession, GameActionLog
- GameDbContext (schema: game) + AddGameDatabase() registration
- Migrations: AddRankScore (Identity), InitialCreate (Game)

SOR.Matchmaking:
- MatchmakerService (BackgroundService) — 5s poll, ELO ±100→±500 range
- Handlers: matchmaking.join, matchmaking.leave, matchmaking.status
- Pushes MatchFoundPush to both players via IClientPush on match

SOR.Game:
- GameState / PlayerState / CardInstance / FieldCard JSONB model
- GameEngine (pure static): Init, Draw, PlayCard, Attack, EndTurn, Concede
- ELO delta (K=32) computed and applied on game end
- Handlers: game.ready, game.get_state, game.draw, game.play_card,
            game.attack, game.end_turn, game.concede
- State filtered per-viewer (opponent hand/deck hidden)
- GameOverPush with rank deltas to both players

Admin pages:
- /game/matchmaking — live queue stats, active entries, recent activity
- /game/sessions   — session stats, filterable by status/account

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-02-26 06:57:13 -05:00
b5c9385e73 Add CI/CD pipeline, Dockerfiles, and k8s/ArgoCD manifests
- Gitea Actions workflow: build sor-host + sor-admin, push to Harbor,
  auto-update image tags in k8s manifests (GitOps — ArgoCD watches deploy/k8s/)
- Dockerfile.host / Dockerfile.admin: multi-stage .NET 8 builds, non-root runtime
- deploy/k8s/: configmap, deployments, services, nginx ingress
  - hub.aeternalisgames.com → sor-host (WebSocket gateway)
  - admin.aeternalisgames.com → sor-admin (Blazor admin portal)
  - hub-tls for hub, cert-manager auto-provisions admin-tls
- deploy/secrets/: README + *.yaml.template files to populate (gitignored)
- deploy/argo/application.yaml: ArgoCD Application (namespace stone-server)
- Root .gitignore: excludes deploy/secrets/*.yaml (never commit populated secrets)

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-02-25 21:33:54 -05:00
4663003dd7 Add versioning, content, and chat presence/notifications services
- SOR.Versioning: version.check handler, ClientRelease entity + admin UI
- SOR.Content: incremental card sync (DefinitionVersion cursor via Postgres trigger),
  content.sync / content.sets / content.card handlers
- Chat: presence (account_presence) + notifications with unread count and mark-read
- CardDefinition: DefinitionVersion bigint (trigger-assigned) + IsRetired soft-delete
- 3 migrations applied to pg-forge-01 (Identity, Chat, Catalog)

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-02-25 20:35:35 -05:00