Commit Graph
71 Commits
Author SHA1 Message Date
dingo 62763859a3 CDN 2026-03-03 18:39:20 -05:00
dingo ba04911acc CDN flag change 2026-03-03 17:05:27 -05:00
dingo 551610a8ee CDN Browser changes 2026-03-03 11:49:45 -05:00
dingo 8bf7da1092 CDN browser in Admin Portal 2026-03-03 11:26:59 -05:00
dingo d3411e54b5 Remove Starter Deck 2026-03-03 07:18:00 -05:00
dingo a3bcc71082 Client changes, admin portal, collection fixes. 2026-03-02 10:49:49 -05:00
dingo ffe1ec5094 Fixing Deck rules on server.... 2026-03-02 08:45:25 -05:00
dingo d3e39f9511 minor admin portal changes 2026-03-02 08:37:51 -05:00
cec6773a12 fix: NatsMessageRpcResponder SerializePayload must use CamelCase JSON options
SerializePayload was using default JsonSerializerOptions, so record properties
like GetStarterDecksResponse.Decks were serialized as "Decks" (PascalCase).
That JsonElement travels through the NATS reply back to the gateway, which
forwards it verbatim. The client reads p.get("decks", []) and finds nothing
→ "No starter decks available."

Fix: use the same PropertyNamingPolicy=CamelCase that SystemTextJsonSerializer
uses, so all payload field names arrive at the client in camelCase.

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-01 22:28:33 -05:00
5d4f0c3745 admin: fix CardEditor AddAsset/AddAnimation + Remove EF bugs
Same two classes of bug as PrebuiltDeckEditor:

1. AddAsset / AddAnimation — ValueGeneratedOnAdd sentinel mismatch:
   New entities with Id = Guid.NewGuid() added to a tracked ObservableHashSet
   are classified as Modified by EF, causing a 0-rows-affected UPDATE.
   Fix: Db.Entry(entry).State = EntityState.Added when !_isNew.

2. RemoveAsset / RemoveAnimation — redundant Db.Remove on detached entity:
   Id != Guid.Empty is always true (Guid.NewGuid() default). Removing an
   Added entity from the collection detaches it; calling Db.Remove re-attaches
   it as Deleted → DELETE on a non-existent row → DbUpdateConcurrencyException.
   Fix: removed the explicit Db.Remove calls; EF handles orphan deletion.

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-01 11:14:06 -05:00
9c4a1db8b1 admin: fix AddCard inserting 0 rows (EF ValueGeneratedOnAdd sentinel mismatch)
PrebuiltDeckCard.Id is configured as ValueGeneratedOnAdd; EF's sentinel for
Guid is Guid.Empty. When a new entity with Id = Guid.NewGuid() is added to
the tracked ObservableHashSet (_deck.Cards), EF interprets the non-empty Guid
as an existing row and tracks the entity as Modified instead of Added.
SaveChangesAsync then issues an UPDATE that finds 0 rows →
DbUpdateConcurrencyException.

Fix: call Db.Entry(entry).State = EntityState.Added immediately after adding
to the collection for existing (tracked) decks. For new decks the plain
List<> is not yet tracked so graph traversal in SaveAsync handles it.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-01 11:11:27 -05:00
0607f02e93 admin: fix RemoveCard DbUpdateConcurrencyException on save
PrebuiltDeckCard.Id is always a NewGuid() (never Guid.Empty), so the
old `if (entry.Id != Guid.Empty) Db.PrebuiltDeckCards.Remove(entry)`
guard was always true. When a user added a card then removed it before
saving, EF detached the Added entity from the collection, then the
explicit Db.Remove re-attached it as Deleted. SaveChangesAsync then
tried to DELETE a row that was never inserted → DbUpdateConcurrencyException.

Drop the explicit remove call entirely. EF Core automatically marks
Unchanged orphans as Deleted when removed from a required relationship
collection, and simply detaches Added orphans — both are the correct
outcomes without any extra Db.Remove.

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-01 09:22:38 -05:00
dingo 59af920479 admin fixes 2026-03-01 08:09:49 -05:00
773fc6a349 admin/client: fix deck editor concurrency, live search, iOS autofill
PrebuiltDeckEditor.razor:
- Add Db.ChangeTracker.Clear() at OnInitializedAsync start to prevent
  stale Deleted/Modified entities from prior circuit pages causing
  DbUpdateConcurrencyException on save
- Replace @bind + button-only search with @oninput + 300ms debounce for
  both card and arch-spirit search inputs (results appear as you type;
  search button retained as manual fallback)
- Clearing the input immediately clears previous results

LoginScreen.tscn:
- Set virtual_keyboard_type = 5 (EMAIL_ADDRESS) on EmailInput and
  RegEmailInput so Godot's experimental virtual keyboard creates
  <input type="email"> instead of type="text" on mobile/web

export_presets.cfg:
- Extend head_include with a MutationObserver that watches for virtual
  keyboard INPUT elements and sets autocomplete="username" on email
  inputs and autocomplete="current-password" on password inputs,
  enabling iOS Face ID / Touch ID password vault autofill

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-28 23:00:13 -05:00
10c0593120 Single-session login policy + fix deck editor card search
Auth (single-session policy):
- AuthGrpcHandler.Login now calls RevokeAllSessionsForUserAsync before
  CreateSessionAsync. When a user logs in on a new device, all existing
  sessions are revoked in Redis (token keys deleted) and marked RevokedAt
  in Postgres. The old device will fail auth.hello on its next reconnect
  and return to the login screen automatically.

Admin (PrebuiltDeckEditor):
- SearchCardsAsync and SearchArchSpiritsAsync were using .Contains() which
  compiles to a case-sensitive PostgreSQL LIKE. Changed to EF.Functions.ILike
  so card names can be found regardless of capitalisation.

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-28 21:52:36 -05:00
502f1c16f6 Fix content.sync cartesian explosion and gateway timeout
- Add .AsSplitQuery() to ContentSyncHandler to prevent the cartesian
  product join caused by two collection .Include()s (Assets + AnimationBindings).
  EF was executing a single JOIN that multiplied result rows per card,
  causing replies to arrive 10+ seconds late and gateway timeouts.
- Bump Gateway__RemoteDispatchTimeoutMs from 10000 → 15000ms in configmap
  to give worker pods headroom on cold starts (EF model compilation +
  first DB query can take 3-5 seconds on a fresh pod).

NOTE: restart gateway pods after deploying to pick up the new timeout value:
  kubectl rollout restart deployment/sor-gateway -n stone-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-02-28 19:05:32 -05:00
dingo 76e50b5be9 NATS 2026-02-28 17:02:43 -05:00
dingo d1a555cce7 Changing packet dispatch, packets dying on gateway and not being relayed, missed a nullable 2026-02-28 15:14:36 -05:00
dingo 285d67374e Changing packet dispatch, packets dying on gateway and not being relayed 2026-02-28 15:10:49 -05:00
fd8fe950f8 Add Grant Card section to AccountDetail admin page
Search card definitions by name (ILike, top 20), click a row to select,
set quantity (1–99), toggle Tradeable + Foil, then Grant.
Creates PlayerCard rows directly in CollectionDbContext.
Injects CatalogDbContext + CollectionDbContext (both already registered).

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-02-28 13:45:37 -05:00
a24e3ea17c Add Account Properties card to AccountDetail admin page
Shows all key-value properties for an account in a table with
inline editing (pencil → edit field → save/cancel) and delete per row.
Add-new form below the table: key + value → Add button.
Duplicate-key guard prevents adding an existing key; existing entries
must be edited rather than added again.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-02-28 13:24:29 -05:00
bdd6e59dfe Add starter deck flow, admin force-logout + rename, shop flag
Auth chain:
- auth.proto: add needs_starter_deck to Login/Register/ValidateToken responses
- auth.proto: add RevokeAllSessions RPC
- AuthGrpcHandler: populate NeedsStarterDeck from Account.StarterDeckSelectedAt
- AuthGrpcHandler: track tokens in UserSessions Redis SET on create/logout
- AuthGrpcHandler: implement RevokeAllSessions (Redis + Postgres)
- IGatewayAuthValidator / GatewayAuthValidator: thread NeedsStarterDeck through tuples
- ConnectionLoop: include needsStarterDeck in auth ack payload

Client:
- Auth.gd: store needs_starter_deck from auth reply; clear on logout
- login_screen.gd: route to StarterDeckScreen when needs_starter_deck = true
- scenes/starter_deck/: new StarterDeckScreen (fetch decks → pick → confirm → InitScreen)

Admin panel:
- AccountDetail.razor: Force Logout All Sessions card (Redis + Postgres revoke)
- AccountDetail.razor: Change Display Name form with uniqueness check
- SOR.Admin: add StackExchange.Redis package + DI registration
- PrebuiltDeckEditor.razor: split into IsStarterDeck + IsAvailableInShop checkboxes
- PrebuiltDeck.cs: add IsAvailableInShop field
- Migration: AddPrebuiltDeckShopFlag

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-28 13:08:08 -05:00
dingo 4be98fd8a0 Register auth data protection services 2026-02-28 11:01:31 -05:00
dingo aed40398b8 Bind public gateway port explicitly 2026-02-28 10:46:48 -05:00
dingo 13402c8551 Split auth gRPC onto internal listener 2026-02-28 10:38:18 -05:00
dingo 9a3eef7d20 gRPC TSing, reverting 2026-02-28 10:14:17 -05:00
dingo d2398af01c gRPC Additional Logging 2026-02-28 09:13:14 -05:00
dingo 62c52dd589 Revert 2026-02-28 09:03:30 -05:00
dingo ec0dcf338a Working on gRPC issue 2026-02-28 08:46:47 -05:00
dingo 0945208e48 gRPC Error 2026-02-28 08:40:05 -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
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