Commit Graph
41 Commits
Author SHA1 Message Date
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
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
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
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
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
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 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
348c37b9b5 Add SOR.Bazaar service — store, P2P marketplace, auction house, cosmetics
New project: SOR.Bazaar (12 message handlers)
  Store:       get_store, buy_booster_pack, buy_prebuilt_deck, buy_cosmetic, get_my_balance
  Marketplace: get_listings, get_my_listings, list_card, cancel_listing,
               buy_listing (shared-tx atomicity), place_bid (shared-tx + refund),
               get_transactions

New DB entities:
  BazaarDb:    Cosmetic, PurchaseRecord, BoosterPackCardGrant, AuctionBid
  CollectionDb: PlayerCosmetic
  IdentityDb:  Account.OriginPoints

BoosterPack gets CardSetId for set-scoped card pool draws.
BazaarEnums: PurchaseProductType, CosmeticType.

3 EF migrations applied to pg-forge-01:
  AddOriginPoints, AddBazaarCosmetics, AddPlayerCosmetics

Admin pages: CosmeticsPage, CosmeticEditor, PurchaseRecordsPage (with
  expandable booster pack card grant rows), NavMenu Bazaar submenu updates.

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 19:02:59 -05:00
2cac55cbd9 Add starter deck system and AI art tracker
- PlayerCard.IsTradeable (default true; false for starter deck grants)
- PrebuiltDeck.IsStarterDeck flag + index
- Account.StarterDeckSelectedAt one-time onboarding gate
- CardAsset.IsAiGenerated + CardAnimationBinding.IsAiGenerated
- Handlers: CollectionGetStarterDecks, CollectionSelectStarterDeck
- CollectionGetCards passes IsTradeable through to PlayerCardDto
- Admin: PrebuiltDeckEditor Starter checkbox, CardEditor AI Generated
  checkboxes on assets and animation rows
- Admin: /content/ai-assets AI Art Tracker page + NavMenu entry
- 4 EF migrations applied to pg-forge-01

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 14:46:00 -05:00
3e4a07d4b5 Fix tier-chain warning to distinguish lineage mismatch vs missing intermediate tier
Previously all gaps produced "X is missing" — but if the missing previous
tier is Tier 1 and is not the deck's primary, the player can never add it
(Tier 1 ArchSpirits are blocked from the card list). The message was
technically correct but actionably wrong.

Two distinct messages now:
- Different lineage: "X (Tier N) belongs to a different ArchSpirit lineage
  than your primary and cannot be ascended to in this deck."
- Missing intermediate: "X (Tier N) is in the deck but Y is missing.
  Add the intermediate tier to enable ascension."

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 13:30:28 -05:00
c6dc56a350 Add chat service, collection clone/tier rules, social graph
SOR.Chat (new project):
- 10 WebSocket message handlers: send, get_channels, get_messages,
  dm_open, friend_request, friend_respond, friend_remove, block,
  unblock, get_social
- Cursor-based pagination for message history
- Block checks on DM send and dm_open
- Social graph: friends / pending requests (in+out) / blocked list
- Batch identity DB lookups for display names

Collection updates:
- clone_deck handler (copy deck + re-validate)
- Tier-chain validation: deck ArchSpirit must be Tier 1 (hard rule);
  warn on Tier 2+ card without previous tier present (soft warning)
- Tier 2+ ArchSpirits now allowed in card list as ascension targets
- ValidationWarnings field added to DeckSummaryDto + DeckDetailDto

Database:
- CardDefinition.PreviousTierId self-reference FK for ascension chains
- FriendRequest + BlockedUser entities in chat schema
- ChatChannelType.System + FriendRequestStatus enum values
- Migrations: AddArchSpiritTierChain (catalog), AddSocialGraph (chat)

Admin portal:
- ChatOverview (/chat) — stats + channel list with type filter
- ChatChannelViewer (/chat/channel/{id}) — message history + system
  message compose for admins
- SocialModerationPage (/chat/social) — friend/block lookup + actions
- NavMenu: Chat section with Social Graph sub-item

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 13:16:43 -05:00
0198aec9e5 Add collection service — deck management + card inventory
SOR.Collection project (new):
- 8 message handlers over WebSocket: get_cards, get_decks, get_deck,
  create_deck, rename_deck, delete_deck, add_card, remove_card
- Deck construction rules (DeckRules.cs): min 20 / max 40 cards,
  max 4 copies per definition, max 20 decks per player
- add_card validates ownership (player must own enough physical copies),
  copy limit, deck size limit, and rejects ArchSpirits from the card list
- RefreshValidityAsync recalculates Deck.IsValid after every mutation
- Cross-context lookups (CollectionDbContext + CatalogDbContext) with
  batch queries — never N+1

Admin portal pages (new):
- /collection — overview stats (total cards, total decks, valid decks,
  unique players) + account ID lookup
- /collection/player/{accountId} — full player collection viewer:
  paginated card grid with name/type/affinity/rarity/foil/serial filters,
  deck list with expanded card tables, Grant Card modal (search + foil
  toggle, grants 1–100 copies), revoke individual card instances

Wiring:
- SOR.slnx + SOR.Host.csproj: added SOR.Collection project reference
- Program.cs: uncommented collection service registration
- NavMenu: added Collection item

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 12:28:17 -05:00
925b2b1b3b Add Bazaar store products — booster packs, prebuilt decks, masked listings
- BoosterPack entity: dual pricing (OP + USD), JSONB slot distribution,
  availability window, CDN image, IsActive flag
- PrebuiltDeck entity: dual pricing, ArchSpirit reference (denormalized),
  availability window, CDN image, card list (PrebuiltDeckCard)
- BazaarListing.IsMasked: blind/mystery market — buyers see rarity+type only
- BazaarDbContext: new DbSets, EF config (jsonb column, unique indexes,
  cascade delete on deck cards)
- Migration: AddBazaarStoreProducts (applied to pg-forge-01)
- Admin UI: BoosterPackList, BoosterPackEditor (slot editor, image upload),
  PrebuiltDeckList, PrebuiltDeckEditor (cross-context card search, ArchSpirit picker)
- BazaarOverview: add active packs/decks stat cards with manage links
- NavMenu: add Booster Packs + Prebuilt Decks sub-items under Bazaar

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 10:16:09 -05:00
ee4ec43a57 Add CDN layer, harden admin unlock UI, scrub credentials from git
SOR.Cdn (new project):
- ICdnClient / HttpCdnClient — POST /upload?folder= + DELETE /files/{path}
- Typed HttpClient, X-Api-Key auth, 100 MB stream support
- CdnOptions: PublicBaseUrl, UploadBaseUrl, ApiKey (all via k8s env vars)

CardEditor (Assets tab):
- Upload button per asset/animation — streams file through Blazor Server SignalR
  to CDN; auto-fills CdnUrl + MimeType on success
- SignalR MaximumReceiveMessageSize raised to 100 MB for large 3D model uploads
- accept="image/*" for Art2D, ".glb,.gltf,.fbx" for Model3D and animations

AccountDetail:
- Distinguish auto-lockout (≤ 1 h, yellow badge) from admin ban (> 1 h, red badge)
- "Force Unlock" clears lockout immediately + resets failed-attempt counter
- "Unban" for admin-set bans; both call SetLockoutEndDateAsync(null)

Auth lockout: 15 min → 30 min (SOR.Auth + SOR.Admin both updated)

Credentials:
- Removed hardcoded Postgres/Redis creds from all committed appsettings.json
- Production values come from k8s secret env vars (ASP.NET Core env override)
- Added appsettings.Development.json + appsettings.*.Local.json to .gitignore

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 09:42:30 -05:00
1974dffdb6 Implement Auth service — login, register, sessions, account properties, OAuth stubs
- auth.proto: add account property CRUD messages + OAuthProvider enum + LoginWithOAuth
  (all OAuth providers disabled via Redis feature flags: oauth_<provider>_enabled)
- SOR.Auth: full AuthGrpcHandler — password auth, session tokens (32-byte random,
  SHA-256 hash in Postgres, raw token in Redis with TTL), ValidateToken with
  Redis fast-path + Postgres slow-path fallback, Logout with dual revocation
- AccountProperty entity: flexible key-value bag per account (snake_case keys,
  string values); upsert semantics; indexed on (AccountId, Key)
- SOR.Auth/ServiceRegistration: registers Identity DbContext + UserManager + roles
- SOR.Host/appsettings.json: add Postgres Default connection string
- AddAccountProperties migration applied to pg-forge-01

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 08:07:19 -05:00
6f9ed0668f Add EF Core migrations and SuperAdmin seeder
- Generated InitialCreate migrations for all 5 DbContexts:
  identity, catalog, collection, bazaar, chat (separate Postgres schemas)
- Applied to pg-forge-01 (172.10.1.127) — all schemas live
- Program.cs: SeedAsync() creates SuperAdmin + Admin roles and seeds
  initial SuperAdmin account on startup if none exists
  (email/password overridable via Admin:Email / Admin:Password config)

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 07:52:30 -05:00
ee2891d38e Add database layer (EF Core + Postgres) and Blazor Server admin site
- SOR.Database: 5 bounded-context DbContexts (identity, catalog, collection,
  bazaar, chat), all entities/enums, JSONB for card abilities, ServiceRegistration
  with per-context connection string fallback to "Default"
- SOR.Admin: Blazor Server (.NET 8) — card editor, account management, bazaar
  overview, feature flags; Identity + cookie auth; FallbackPolicy requires
  Admin/SuperAdmin role; login via minimal API form POST endpoint
- Directory.Packages.props: add Microsoft.AspNetCore.Identity.EntityFrameworkCore
- SOR.slnx: add SOR.Admin + SOR.Database to solution (11 projects, 0 errors, 0 warnings)

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 07:48:24 -05:00
d21adbc8d0 Add networking foundation — 9-project C# solution (compiles clean)
Implements the modular networking layer for SOR Server:
- SOR.Networking.Abstractions: pure interfaces (ITransport, IClientConnection,
  IMessageSerializer, IMessageDispatcher, IMessageHandler, IEventBus, IClientPush)
- SOR.Networking.WebSocket: ITransport + IClientConnection over System.Net.WebSockets
- SOR.Networking.Nats: IEventBus over NATS.Net (INatsConnection)
- SOR.Networking.Redis: IClientPush over Redis Pub/Sub
- SOR.Shared: ServiceResult<T>, RedisKeys, NatsSubjects, ServerMessage, JSON serializer
- SOR.Shared.Proto: auth.proto with gRPC AuthService contract
- SOR.Gateway: accept loop, auth handshake, dispatcher, Redis push subscriber
- SOR.Auth: stub gRPC handler (placeholder responses)
- SOR.Host: multi-service runner via ENABLED_SERVICES env var; wires all DI

All concrete implementations are wired exclusively in SOR.Host — every transport,
broker, and push implementation can be swapped by changing only Program.cs.

dotnet build SOR.slnx → 0 errors, 0 warnings

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-24 21:01:38 -05:00
0f95a0721b Add C# programming architecture and update tech stack
- Server/architecture.md: full programming architecture reference in C# (.NET 8)
  covering repo/project structure, three-layer handler→service→repository pattern,
  multi-service runner (ENABLED_SERVICES env var for N services per box), DI,
  config (IOptions), gRPC handler pattern, NATS pub/sub, Redis, EF Core + PostgreSQL,
  Serilog logging, error handling (ServiceResult + exceptions), health checks,
  testing patterns (xUnit + Moq + FluentAssertions), naming conventions, and hard rules
- Server/initial-plan.md: add C# 12 (.NET 8), EF Core, Serilog to tech stack table;
  add C# to Decided table; reference architecture.md

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-24 13:46:44 -05:00
acacb1e03f Add server architecture initial plan and legal TODO
- Draft full server architecture in Server/initial-plan.md covering all
  services: Gateway, Auth, Game, Chat, Collection, Bazaar, Admin,
  Leaderboard, Content, Web, and CDN/Asset Pipeline
- Tech stack decisions: PostgreSQL, Redis, NATS, gRPC, Ceph (RADOSGW),
  Kubernetes, Stripe (implemented but disabled)
- Chat persistence: 30-day PostgreSQL hot window, cold archive to remote MySQL
- Leaderboard: Redis Sorted Sets for live rankings, PostgreSQL for history
- Asset pipeline: Admin card builder → Ceph origin → CDN → client
- Create Shared/legal.md with prioritized legal TODO list covering TOS,
  EULA, Privacy Policy, GDPR, Stripe/PCI compliance, CCPA, Cookie Policy,
  and COPPA

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-23 23:46:06 -05:00
dingo bbbb10d8d9 Adding stub for Server to git 2026-02-21 17:54:23 -05:00