Commit Graph
597 Commits
Author SHA1 Message Date
d2a4639007 feat(website): add k8s deployment, service, ingress rules and CI for SOR.Website
- deployment-website.yaml + service-website.yaml: new ClusterIP deployment
  for sor-website image; injects only the three secrets it needs (Postgres,
  Redis, Cdn__PublicBaseUrl) — no NATS or ENABLED_SERVICES
- ingress.yaml: add TLS + rules for aeternalisgames.com and www.aeternalisgames.com
  pointing to sor-website service
- appsettings.json: remove localhost ConnectionStrings (dev defaults already
  live in appsettings.Development.json; prod values come from k8s secrets)
- build-push.yml: build and push sor-website image from Dockerfile.website
- build-push-client.yml: add paths filter so Godot export only runs on
  Client/** changes; add --network host to docker build

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-23 06:30:13 -04:00
Shard 4ead96be0c Adjust website deployment image, service port 443, and GoDaddy issuer 2026-04-23 01:47:02 +00:00
Shard afd595fcc8 Add SOR website deployment/service and ingress; align Argo revision 2026-04-23 00:13:06 +00:00
aaab114a3e feat(website): add Dockerfile.website
Multi-stage build matching Dockerfile.admin pattern:
- Stage 1: restore only changed .csproj files (layer cache),
  then publish Release build
- Stage 2: aspnet:8.0 runtime, non-root appuser, port 8080

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-22 19:51:04 -04:00
c972b8687e feat(website): stand up SOR.Website public game site
Adds the complete SOR.Website ASP.NET Core Razor Pages project:

Security architecture:
- SecurityHeadersMiddleware sets strict CSP (script-src/style-src 'self',
  form-action 'self', frame-ancestors 'none', object-src 'none')
  — all XSS injection is dead on arrival
- __Host- cookie prefix on session + CSRF cookies (forces Secure, Path=/,
  no Domain — prevents subdomain-compromise cookie theft)
- Anti-forgery tokens on every POST by default (Razor Pages default)
- AuthorizeFolder("/Account") — unauthenticated access to any /account/*
  redirected to login at the routing layer, no per-page [Authorize] needed
- Rate limiting per-IP: login (10/5min), register (5/hr), reset (3/15min)
- Open redirect prevention: all returnUrl values checked with Url.IsLocalUrl
- Anti-enumeration: ForgotPassword/Register never reveal whether email exists
- Account lockout: 5 failed login attempts → 30min lockout
- ChangePasswordAsync requires current password before accepting new one
- Leaderboard only projects DisplayName + RankScore (email/ID never exposed)
- Data Protection keys in Redis (shared key ring across pods)
- ForwardedHeaders middleware for accurate IP under TLS-terminating ingress

Pages implemented:
- Public: Home, Story, How To Play, Cards (catalog + detail), Leaderboard,
  AI Assets (explanation + report), News, Support, Privacy, Terms, Webclient
- Auth: Login, Register, Logout (POST-only), ForgotPassword, ResetPassword,
  VerifyEmail — all with rate limiting and anti-enumeration controls
- Account (auth-gated): Overview, Profile (display name), Security
  (change password), Game stats

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-22 19:51:04 -04:00
Shard 08ef638950 Add Argo website info and ingress OIDC header buffer tuning 2026-04-22 20:27:52 +00:00
ad82ac6a76 docs(admin): comprehensive help section update in AbilityBuilder
Rewrote the help offcanvas to cover every feature of the ability system:
- Canvas Mode usage guide (new section)
- Action Groups AND/OR/XOR with Chooser Role (new section)
- Costs with Cost Type and PickMode tables (new section)
- Conditions expanded with all types and key parameters
- Trigger-Specific Fields expanded into full reference table
- Effects Categories table grouping all effects
- Duration Types, Targeting, Filters updated/improved

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-22 15:34:10 -04:00
15f9b0c9a8 fix(ability-builder): add Condition palette button in canvas mode
The Conditions node only renders when count > 0, so there was no way to
add the first condition from the canvas. The "Add Node" palette now has a
Condition button that adds a blank ConditionDraft, lays out the node, and
auto-selects it so the inspector opens immediately for editing.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-22 08:40:01 -04:00
e3e9ca66cf feat(ability-builder): full inspector parity with form view in canvas mode
Every canvas node now exposes all editable properties and delete actions
in the right-hand Inspector panel:

Meta node
  - Duration override (all types, ForNTurns N)
  - Aura type: AuraRangeMin/Max, On-Leave mode radios, linger duration

Trigger node
  - Trigger-specific parameter fields (RenderTriggerFields) wired in after
    the event type select; was previously missing entirely

Cost node (new)
  - CostGroup Logic Op + Chooser Role
  - Inline per-cost type select + amount input + per-entry delete button
  - Add Cost button

Conditions node (new)
  - Per-condition type, subject, parameter fields (RenderConditionFields)
  - Per-entry delete button
  - Add Condition button

Sub-group node
  - Delete Sub-Group button

Action / sg-action node
  - Target Filter dropdown
  - Action-level Conditions section (add / edit type+subject+params / delete)
  - Delete Action button

Effect / sg-effect node
  - Full effect parameter fields (RenderEffectFields) replacing the old
    "Switch to Form View" placeholder
  - SummonToken redirects to Form View (token editor is too wide for panel)
  - Delete Effect button

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-21 20:32:42 -04:00
2575d700f4 fix(ability): apply cost.Filters to interactive pick candidates and resume validation
PayCosts now filters rawCandidates through FiltersMatch before building
CandidatesJson, so only eligible cards are offered to the picker.

ResumeCostPick now deserialises FiltersJson, resolves the source unit early
for a complete filter context, and validates each client-selected card against
the stored filters before executing the cost — rejecting invalid selections
with INVALID_COST_PICK_SELECTION.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-21 17:28:20 -04:00
7a917cf93b fix(ability-prompts): fix 3 client wiring gaps
1. JSON case normalization
   Parse CostGroupJson, ActionGroupJson, BranchesJson, RevealedCardsJson
   through _normalize_keys in game_screen.gd — server serialises these
   inner payloads with _jsonOpts (no naming policy = PascalCase), but the
   client was reading lowercase keys, producing empty option lists.

2. Cost pick candidate list
   - Add CandidatesJson to PendingCostPick; populated in AbilitySystem.PayCosts
     with the actor's eligible cards (hand for DiscardFromHand, field spirits
     for SendSpiritFromBattlefieldToDiscard / DealDamageToOwnSpirit).
   - Thread CandidatesJson through CostPickRequestPush → GameHandlerBase push.
   - Client _on_cost_pick_request now uses candidatesJson from the push instead
     of Game.get_my_player().hand, fixing opponent-pick and battlefield-cost UIs.

3. Reconnect recovery via game.get_state
   - Extract all pending-prompt pushes into static PushPendingPromptsAsync in
     GameHandlerBase (called from PushStateToPlayersAsync as before).
   - Inject IClientPush into GameGetStateHandler; call PushPendingPromptsAsync
     after building the reply so any active pause prompt is re-sent to the
     chooser on manual state sync / reconnect.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-21 17:13:04 -04:00
c45db289ad feat(ability-prompts): wire all 8 pending pick types end-to-end
Server:
- GameMessages.cs: add push DTOs for CostGroupPick, ActionGroupPick,
  BranchPick, TargetPick, TilePick, PlayerPick, RevealChoicePick
- GameHandlerBase.PushStateToPlayersAsync: push all 8 pending types
  (including existing CostPick which was missing its push) to the
  chooser player after every state update and on reconnect

Client:
- Game.gd: add 8 signals, 8 send functions, 8 push routes matching
  game.ability.{cost,cost_group,action_group,branch,target,tile,player,
  reveal_choice}_pick_request
- game_screen.gd: add handlers for all 8 types:
  - cost_pick: hand-card selection panel with confirm
  - cost_group_pick / action_group_pick: option-button panels
  - branch_pick: same UI as local ChooseOne but sends game.branch_pick
  - target_pick: reuses ABILITY_TARGET mode, flag routes to game.target_pick
  - tile_pick: highlights valid tiles, click sends game.tile_pick
  - player_pick: player-button panel from server-supplied validPlayerIds
  - reveal_choice_pick: click-to-order card list, sends game.reveal_choice_pick

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-21 17:02:12 -04:00
9772679a2f feat(ability-builder): add delete buttons to all visual canvas nodes
Cost node rows now have per-item × buttons. Conditions node has a
clear-all × in the header. Sub-group action and sub-group effect nodes
both have × buttons in their headers.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-21 12:38:21 -04:00
473e5b075e fix(abilities): nested pause during intra-action replay captures correct remainder
When ApplyIntraActionContinuation replays IntraActionStep items and a step's
effect itself pauses (emitting PendingTilePick / PendingPlayerPick /
PendingRevealChoicePick), the new pause model may already have an
IntraActionContinuationJson written by BuildIntraActionContinuationJson.
That value is wrong in the replay context because BuildIntraActionContinuationJson
assumes all remaining targets get the same homogeneous effect list, whereas
IntraActionStep items each carry their own per-step effect list.

Fix: convert ApplyIntraActionContinuation loops to indexed, set ctx position
fields (CurrentEffectIndex, CurrentActionAllEffects, CurrentActionTargets,
CurrentTargetIndex, CurrentActionDuration) per iteration for consistency, then
after any nested pause override the IntraActionContinuationJson directly via
new SetPendingIntraActionContinuation helper.  The override is built from the
precise remaining slice:
  - remaining effects on the current step's target  (effects[(ei+1)..])
  - all remaining steps as-is                       (steps[(si+1)..])
This is correct regardless of whether different steps have different effect lists.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-21 11:30:01 -04:00
0b7742f724 fix(abilities): general intra-action continuation for effect-level pauses
Previously, pausing effects (CloneSpiritAsToken/TargetTile,
ChannelCardFromZone/TargetTile+Choice, StackDeck interactive) only stored
the outer action-sequence continuation. Any effects after the pausing one on
the same target, and any remaining targets in the same action, were silently
dropped on resume. This commit makes pause/resume fully general.

Mechanism:
- New IntraActionStep private class: { TargetRef, EffectsJson }
- BuildIntraActionContinuationJson(currentTarget, ctx) captures:
    • remaining effects on the paused target (effects[effectIndex+1..])
    • all effects applied to each remaining target (targets[targetIndex+1..])
- ApplyIntraActionContinuation applies those steps at resume time before
  the outer continuation actions
- FindTargetByRef / GetTargetRef round-trip any resolved target type
  (FieldCard, CardInstance, PlayerState, Coord) through a string ref

AbilityContext gains 5 per-iteration tracking fields set by ExecuteSingleAction:
  CurrentEffectIndex, CurrentTargetIndex, CurrentActionTargets,
  CurrentActionAllEffects, CurrentActionDuration

ExecuteSingleAction target/effect loops converted from foreach to indexed
for-loops so ctx position fields stay in sync with each ExecuteEffect call.

IntraActionContinuationJson added to PendingTilePick, PendingPlayerPick,
and PendingRevealChoicePick. All three pause-emitting cases (CloneSpiritAsToken,
ChannelCardFromZone x2, StackDeck) populate it. All three resume methods
(ResumeTilePick, ResumePlayerPick, ResumeRevealChoicePick) call
ApplyIntraActionContinuation before executing outer continuation.

ChannelCardFromZone player-pick-to-tile-pick chain now forwards
IntraActionContinuationJson so it survives a double-pause sequence.

The "DESIGN CONSTRAINT: pausing effects must be terminal" comment is removed
as it is no longer 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-04-21 11:12:57 -04:00
ac0215fab3 fix(abilities): pause/resume ordering and continuation correctness
Issue 1 — ActionGroup AND continuation ordering:
  The old code prepended `all` (preceding AND-group actions) into
  ContinuationActionsJson, so resume ran [chosen, preceding, outer] instead
  of the correct [preceding, chosen, outer].  Fix: add PrecedingActionsJson
  to PendingActionGroupPick; AND-case stores preceding there (prepending to
  any inner-group preceding); ResumeActionGroupPick reads it and uses
  preceding.Concat(chosen).Concat(continuation) for final execution.
  Nested remaining-group pauses also accumulate preceding correctly.

Issue 2 — Effect-level pause terminal contract:
  Documented as a design constraint: pausing effects (CloneSpiritAsToken
  TargetTile, ChannelCardFromZone TargetTile/Choice) must be last in their
  action's Effects list.  Remaining effects / remaining targets are silently
  dropped on pause.  No functional change; constraint is now explicit in code.

Issue 3 — StackDeck pause loses continuation:
  PendingRevealChoicePick already had ContinuationActionsJson/RangeJson/
  ForceDurationJson fields but StackDeckEffect never populated them and
  ResumeRevealChoicePick never executed them.  Both are now fixed: pause
  stores ctx.ContinuationActions + ctx.ActivationRange + duration; resume
  runs ExecuteActions on the stored continuation after ordering the deck.

Issue 4 — ResumeTargetPick ActionIndex=0 contract:
  Added a clear CONTRACT comment: the paused action replays at index 0, so
  the client must submit targets with ActionIndex=0 in its response.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-21 07:43:22 -04:00
0e85441fa1 feat(phase10): ChannelCardFromZone, ObstructMovementType, and pause-model completions
- Implement ChannelCardFromZoneEffect: zone lookup, dest-player resolution
  (Self/Target/Opponent/Ally/Random/Choice), channel-range tile selection,
  affinity check, cost deduction, KeepInZone, TargetTile pause, board
  placement with aura/passive hooks and Channeled trigger
- Add PendingPlayerPick.EffectType="ChannelCardFromZone" dispatch in
  ResumePlayerPick: random-tile path + chained PendingTilePick for
  TargetTile=true
- Add ResumeTilePick case "ChannelCardFromZone": place card at chosen tile
  under DestPlayerAccountId, affinity/cost/KeepInZone-aware
- Implement ObstructMovementTypeEffect: stores ActiveEffect marker;
  ApplyReversal is no-op (duration:null guard); BuildBlockedSet extended
  via AbilitySystem.GetUnitsObstructingMovementType to honour obstructors
  for pathfinding (e.g. Walk unit blocking Flight paths)
- Add PendingTilePick.DestPlayerAccountId and .EffectJson fields
- Add PendingPlayerPick.EffectJson field
- Thread ctx.ContinuationActions + ctx.ActivationRange through
  AbilityContext so ExecuteEffect can populate pause models without an
  extra method parameter

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-21 07:34:17 -04:00
95c01cffb5 feat(phase9): ability system gap fixes -- pause propagation, handlers, chooser, aura actions
- Fix pause propagation: ExecuteActions for-loop breaks on HasPendingInteraction();
  effect loop in ExecuteSingleAction also stops when any pending state is set
- Add HasPendingInteraction() helper to GameState covering all 7 pending types
- Create 4 missing handlers: GameCostGroupPickHandler, GameActionGroupPickHandler,
  GameBranchPickHandler, GameRevealChoicePickHandler + register in ServiceRegistration
- Add corresponding request/response records to GameMessages.cs
- Fix ActionNeedsClientTargets: short-circuit false when Chooser == Random
- Add ChooserActorId to PendingTriggeredTarget; FireTrigger sets it to opponent/ally
  when Chooser.Opponent/Ally; GameHandlerBase pushes to ChooserActorId
- ResumeTriggeredAbility validates against ChooserActorId (falls back to ActorId)
- Fix ApplyOnEventEffect: Action[] -> ActionGroup?; PendingDeferredEffect gains
  ActionGroupJson field; deferred firing uses ResolveActionGroup + ExecuteActions
- Wire OnEnterAuraActions / OnLeaveAuraActions into FireAuraTransition (one-shot,
  restricted to the entering/leaving unit)

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-21 06:09:32 -04:00
80b92b17b9 feat(phase8): complete remaining 3 gaps -- pending types, StackDeck interactive, canvas builder
Pending interaction coverage:
- Add PendingTilePick model (tile-select pause for effects like CloneSpiritAsToken TargetTile)
- Add PendingPlayerPick model (player-select pause for ChannelCardFromZone UnderControlOf: Choice)
- Add PendingRevealChoicePick model (reveal-and-order pause for StackDeck interactive path)
- Add all three as nullable properties on GameState

StackDeckEffect interactive flow:
- Replace random-shuffle fallback with chooser-aware branching
- Self/Opponent chooser: remove top N from deck, emit PendingRevealChoicePick pause
- Random/empty chooser: random shuffle fallback (unchanged)
- Add ResumeRevealChoicePick(): restore deck in chooser's ordered indices; unspecified
  cards placed beneath chosen cards preserving relative order

Canvas AbilityBuilder (Phase 4 spec):
- Add @inject IJSRuntime + @implements IAsyncDisposable to AbilityBuilder.razor
- Add sorAdmin.abilityBuilder JS shim in admin.js: non-passive wheel listener (zoom),
  pinch-to-zoom via touch distance delta, cleanup on dispose
- Canvas mode toggle button in form toolbar ("Visual Canvas")
- Full canvas layout: left panel (ability list + node palette), main canvas, right inspector
- Dark canvas background (#111827), CSS transform pan+zoom (translate then scale)
- SVG bezier edge overlay connecting node flow (Meta→Range/Trigger→Cost→Cond→ActionGroup
  →Actions→Effects, ActionGroup→SubGroups→their Actions→their Effects)
- Node types: Meta (blue), Range (teal), Trigger (purple), Cost (amber), Conditions (yellow),
  ActionGroup (dark green), Action (green), Effect (red), SubGroup (dark green), SubGroupAction,
  SubGroupEffect -- each draggable, click-to-select
- Inspector panel: inline editing for all node types (type/name/desc, range fields, trigger
  event, group logic op, action target selector, effect type picker)
- AutoLayoutAbility() positions nodes on first focus; SetPos() preserves drag positions
- Zoom/pan: toolbar +/- buttons + scroll wheel (via JS) + middle-mouse drag
- OnCanvasWheel [JSInvokable] + DisposeAsync cleanup
- Form view toggle restores full form; JSON preview always visible

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-20 20:27:20 -04:00
1d5ae4aa20 feat(phase7): complete ability revamp gap items 1-11
- Fix [PolyType] attribute placement bug in Effects.cs (silent poly-deser failure)
- Add SpiritToken guard to BazaarBuyPrebuiltDeck and CollectionSelectStarterDeck handlers
- Wire CostGroup payment into ActivateAbility with PendingCostGroupPick pause support
- Add PendingActionGroupPick, PendingCostGroupPick, PendingBranchPick models + GameState props
- Add Phase 5 engine switch cases: ModifyChannelRange, RelocateRuin, ActivateRuinAbility,
  DisableRuinForDuration, CloneSpiritAsToken, DestroyToken, SkipTurn, ModifyCardsDrawnThisTurn,
  StackDeck, SearchAndPlace, ChangeAttackType, ObstructMovement, AscendFromZone stubs
- Add ActionGroup recursion (ResolveActionGroup AND-flatten / OR-XOR interactive pick)
- Add ResumeActionGroupPick, ResumeCostGroupPick, ResumeBranchPick methods
- Add ChooseOne ChooserRole branching + TargetSelector.Chooser (Random early-return)
- Change SearchDeckEffect.ThenAction → ThenGroup: ActionGroup?
- Change ApplyOnEventEffect.Effects → Actions: Action[]
- Add SOR.Tools console project with cutover-abilities command (EffectsJsonCutover)
- AbilityBuilder: add ActionGroupDraft, SubGroups, Compile Groups[], ParseJson Groups[],
  CompileActionNode/ParseActionNode helpers, nested sub-group UI section
- Add Tile.RuinDisabledUntilTurn, PlayerState.SkipTurnCount/CardsDrawnThisTurnBonus,
  CardInstance.AttackType nullable override
- Add SOR.Tools to solution

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-20 19:47:38 -04:00
2d9e9e7347 feat(phase6-AB): Ruin client preflight check and channel confirmation dialog
Phase 6-B — Preflight check in _channel_ruin():
Iterate board tiles before sending play_card; skip any tile that already
has a ruinId (non-null, non-empty) or that doesn't match the card's
affinity. If zero valid tiles exist, show an AcceptDialog
"No valid tile available for this Ruin." and abort the send.

Phase 6-A — Confirmation dialog in _confirm_channel_ruin():
After passing preflight, show ConfirmationDialog "Channel Ruin /
Ruin placement is random. Continue?" with Channel / Cancel buttons.
Only calls Game.send_play_card on explicit confirm.

Replaces the previous immediate Game.send_play_card(iid, 0, 0) on click.
Follows the existing _confirm_ascend / _confirm_transition dialog pattern.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-20 14:13:05 -04:00
178f5612a8 feat(phase5+6): engine ActionGroup compat, new conditions, Ruin bug fixes
Phase 5.1a — ActionGroup backward-compat in AbilitySystem:
- Add GetEffectiveActions(def): prefers ActionGroup.Actions (AND=sequential,
  OR/XOR=random pick); falls back to obsolete def.Actions for pre-Phase-1 rows.
- Wire all FireAbility, FireCardEffects, FireTrigger, FireRuinAbilities call
  sites to use GetEffectiveActions instead of def.Actions directly.

Phase 5.9 — 12 new EvaluateCondition cases (§6.6):
UnitTypeIs, OwnershipIs, IsThisCard, UnitPropertyCompare, PlayerPropertyCompare,
HandContainsCount, CardDefinitionCountInZone, IsInRangeOfUnit, TileOccupant,
SurroundingTile, SPAccumulationCompare, CostOfCardsInHand.
Add CompareInt(Comparator, int, int) helper to DRY up comparator switch.

Phase 6-D — Fix double-fire of source Ruin's OnRuinActivation abilities:
Insert source-skip guard in FireTrigger after TriggerMatches check:
skip OnRuinActivationTrigger on the card whose InstanceId == occurrence.Data.SourceId.
FireRuinAbilities already executed the chosen ability directly; the subsequent
FireTrigger is only for observer cards.

Phase 6-C — Ruin tile placement must not overwrite existing Ruins (GameEngine.cs):
Add `&& t.RuinId == null` to the validTiles Where clause.
Change error code NO_VALID_TILE → NO_VALID_RUIN_TILE for this path.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-20 13:57:15 -04:00
da220f353d feat(phase4): ability builder revamp -- ActionGroup/CostGroup/TargetChooser + Phase 1 effects/conditions
- AbilityDraft: ActionGroupLogicOp/ChooserRole + CostGroupLogicOp/ChooserRole fields
- ActionDraft: Chooser field (Self/Opponent/Random) on TargetSelector
- EffectDraft: Zone, IgnoreCost, DestinationScope, AttackType new fields
- ConditionDraft: PropertyName, Value, CostType new fields
- Compile(): emits ActionGroup (replaces flat Actions[]) and CostGroup (replaces flat Cost[])
- ParseJson(): reads both new ActionGroup/CostGroup and legacy flat arrays
- New effects: AscendFromZone, TransitionFromZone, ModifyChannelRange, RelocateRuin,
  ActivateRuinAbility, DisableRuinForDuration, ChannelCardFromZone, CloneSpiritAsToken,
  DestroyToken, ModifySacrificeTokenReturn, SkipTurn, ModifyCardsDrawnThisTurn,
  StackDeck, SearchAndPlace, ChangeAttackType, ObstructMovementType
- New conditions: UnitTypeIs, OwnershipIs, IsThisCard, UnitPropertyCompare,
  PlayerPropertyCompare, HandContainsCount, CardDefinitionCountInZone,
  IsInRangeOfUnit, TileOccupant, SurroundingTile, SPAccumulationCompare, CostOfCardsInHand
- UI: ActionGroup LogicOp/Chooser above actions list; Chooser in each action target row;
  CostGroup LogicOp/Chooser in cost editor header

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-19 16:10:06 -04:00
405be9790a feat(phase3): card editor accordion revamp -- type-contextual, SpiritToken support
- Replace tab navigation with Bootstrap accordion (all sections open by default)
- Type-contextual Stats section: ArchSpirit+Spirit+SpiritToken show combat/movement/
  flags/genus; Terramorpha shows mode selector; Repentance/Instinct show RequiresLOS
  checkbox only with note about ArchSpirit LOS origin (Resolved Decision #6)
- CanBeSacrificed flag hidden for ArchSpirit (Spirit and SpiritToken only)
- Section completion badges: green check when Name filled / abilities JSON present /
  assets added
- Abilities section badge shows constraint reminder for Repentance/Instinct
- Replace _tabs string array with _openSections HashSet + ToggleSection helper
- Remove stale EffectsJson/CardType branching in save logic (already done Phase 2)

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-19 13:06:21 -04:00
768dfcee86 feat(phase2): ability revamp DB migration -- add SpiritToken, drop EffectsJson
- Add CardType.SpiritToken enum value (stored as text, no Postgres enum change)
- Drop catalog.card_definitions.effects column (migration 20260419170135)
  with safety-pass to copy any remaining effects -> abilities before drop
- Remove CardDefinition.EffectsJson property and CatalogDbContext mapping
- Remove CardInstance.EffectsJson snapshot from GameState/GameEngine
- Remove EffectsJson from all DTOs: UnitDelta, CardUpdateDto, ContentCardDto
- Remove EffectsJson from GameStateDiffer, ContentDtoMapper, CardEditor, CardReport
- Simplify AbilitySystem.FireCardEffects to use AbilitiesJson only (no fallback)
- Enforce SpiritToken exclusion in CollectionAddCardHandler (deck builds)
- Enforce SpiritToken exclusion in BazaarBuyBoosterPackHandler (pack draws)

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-19 13:02:24 -04:00
3b8de2deac feat(phase1): ability model expansion -- ActionGroup, CostGroup, new conditions/effects/filters
Action.cs:
  - TargetChooser enum (Self/Opponent/Ally/Random) + TargetSelector.Chooser field
    separates "whose entities qualify" from "who makes the selection"
  - ActionGroup { LogicOp(And/Or/Xor), ChooserRole, Actions[], Groups[] }
    replaces flat Action[] on AbilityDefinition; supports recursive AND/OR/XOR
  - ActionGroupLogicOp enum
  - CostGroup { LogicOp(And/Or/Xor), ChooserRole, Entries[], Groups[] }
    replaces flat CostEntry[] on AbilityDefinition
  - CostGroupLogicOp enum
  - ChooseOne.ChooserRole (within-action effect branching chooser)

AbilityDefinition.cs:
  - ActionGroup? (replaces Actions[]; old field kept [Obsolete] for migration reads)
  - CostGroup? (replaces Cost[]; old field kept [Obsolete] for migration reads)
  - OnEnterAuraActions / OnLeaveAuraActions (ActionGroup? each)

Triggers.cs:
  - OnChanneledTrigger.CardDefinitionId (specific card filter)
  - OnRuinActivationTrigger.OccupantFilters / OnUnitOccupyRuinTrigger.OccupantFilters
  - AmountComparator (Comparator enum) on OnDamageDealtTrigger, OnDamagePreventedTrigger,
    OnHealedTrigger, BeforeDamageAppliedTrigger, OnUnitMPSpentTrigger

Conditions.cs: 12 new condition types (UnitTypeIs, OwnershipIs, IsThisCard,
  UnitPropertyCompare, PlayerPropertyCompare, HandContainsCount,
  CardDefinitionCountInZone, IsInRangeOfUnit, TileOccupant, SurroundingTile,
  SPAccumulationCompare, CostOfCardsInHand)

Effects.cs: 16 new effect types across ArchSpirit zone ops (AscendFromZone,
  TransitionFromZone, ModifyChannelRange), Ruin ops (RelocateRuin,
  ActivateRuinAbility, DisableRuinForDuration), enhanced channeling
  (ChannelCardFromZone), token/spirit (CloneSpiritAsToken, DestroyToken,
  ModifySacrificeTokenReturn), player (SkipTurn, ModifyCardsDrawnThisTurn),
  zone (StackDeck, SearchAndPlace), unit (ChangeAttackType, ObstructMovementType).
  PreventDeathEffect + PreventNextDamageEffect extended with new fields.

Filters.cs: 3 new filter types (Ownership, UnitProperty, TileOccupancy)

AbilitySystem.cs + ActionCandidateGenerator.cs: #pragma disable CS0618 --
  authorized readers of backwards-compat obsolete 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-04-19 12:35:55 -04:00
2d02567baa chore(phase0): delete AbilityBuilderR2-Draft and AbilityBuilderR3 draft pages
No router or NavMenu references found. Safe 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-04-19 12:01:16 -04:00
ad98116973 docs(plan): incorporate Ruin bug fixes as Phase 6
From Ruin-IssueResolution.md -- four fixes in priority order:

6-D (highest): stop double OnRuinActivation execution -- source Ruin's abilities
  fire once via FireRuinAbilities; FireTrigger must skip source unit to prevent
  the same abilities re-firing through the general trigger pipeline.
  Note: new ActivateRuinAbilityEffect (Phase 1.8/5.7) must use the same guard.

6-C: server enforce tile.RuinId == null in candidate set + NO_VALID_RUIN_TILE error code

6-B: client preflight -- compute valid no-ruin tiles before showing confirm dialog;
  block and show message if none available

6-A: client confirm dialog before channeling a Ruin card

Delivery note: Phase 6-D must land before Phase 5.7 so the source-skip guard
is in place before ActivateRuinAbilityEffect can trigger through the pipeline.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-19 11:58:42 -04:00
0f4593ac7c docs(plan): add ActionGroup model -- AND/OR/XOR action grouping at ability level
Introduces ActionGroup { LogicOp, ChooserRole, Actions[], Groups[] } to
replace the flat Action[] on AbilityDefinition. Mirrors CostGroup pattern.

- Axiom A updated: ActionGroup is the ability-level grouping; ChooseOne is
  the within-action effect-branching mechanism -- distinct and complementary
- Axiom B: adds PendingActionGroupPick to the Pending* prompt table
- Axiom C renamed to cover ActionGroup + ChooseOne + CostGroup all having ChooserRole
- Phase 1.3 (new): ActionGroup model, execution semantics (AND/OR/XOR), and
  clear distinction from ChooseOne with concrete examples
- Phase 1.10: AbilityDefinition gains ActionGroup, marks Actions [Obsolete]
  with backwards-compat read rule (wrap Actions in And group if ActionGroup null)
- Phase 4: ActionGroup node type added to palette, canvas layouts show the
  ActionGroup container with AND/OR/XOR header and nested Action children;
  ActionGroup property inspector section added
- Phase 5: 5.1a -- ActionGroup recursive descent in the engine

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-19 11:53:51 -04:00
3b37b15ff0 docs(plan): fix all review gaps -- active fields, trigger coverage, chooser semantics, animation
- Explicit Active ability field list: Range.Min/Max/RequiresLos/LinearOnly, UsesPerTurn
  (verify-and-expose pattern; fields already exist in model, must be wired in builder)
- Enumerate all 40 trigger types with explicit exists/new status table -- no more
  "most already exist" hand-waving
- Split TargetOwnership (whose entities qualify) from TargetChooser (who makes the
  pick); add TargetChooser enum + TargetSelector.Chooser field; map to PendingTargetPick
- Repentance/Instinct: exactly ONE ability per card, Name locked = card Name, no
  additional abilities permitted -- not just "first ability"
- Animation/sound: AbilityAnimationDefinition already on AbilityDefinition; builder
  must expose track name + cast/impact sound URLs in Meta node inspector
- Document CostEntry existing fields (PickMode, Filters) -- confirms no changes needed
- Rewrite entire file in ASCII-safe characters (no mojibake em-dash, arrows, box-drawing)

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-19 11:41:48 -04:00
8795794865 docs(plan): incorporate design decisions and interactive protocol spec
- Lock RecursiveAbility + FullClientPrompt as axioms (Axiom A/B/C)
- Resolve all 6 open questions: SpiritToken constraints, hard EffectsJson
  cutover (migration tool for ~100 cards, column drop), RequiresLOS via
  ArchSpirit as LOS origin, ChooseOne.ChooserRole confirmed, custom drag
- Expand Phase 5 with PendingBranchPick/TilePick/PlayerPick/RevealChoice,
  LOS engine rule, ChooserRole resolution paths

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-19 11:30:17 -04:00
f31aa1f477 docs(plan): add NewCard + Ability System revamp implementation plan
Phase breakdown covering: ability model expansion (cost groups, 12 new
conditions, 15 new effects, trigger enrichments, filter additions),
DB migration, mobile-first card editor revamp, visual node-canvas
ability builder, and engine update work items.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-19 11:05:56 -04:00
8f3911e881 feat(ability): implement AbilityBuilderR3 + engine additions
Engine:
- AbilityDefinition: add SourceZoneGate (zone-restricted triggers) and TriggerLimitPerGame
- Effects: add StatModOperator (Add/Subtract/Multiply/Divide/Percent) on all stat mod effects; reversal stored as delta
- Action/CostEntry: add CostPickMode enum (Random/SelfPick/EnemySeePick/EnemyRandomPick/EnemyPick)
- PendingCostPick: new model for interactive cost pause/resume (mirrors PendingTriggeredTarget)
- GameState: PendingCostPick field
- GameMessages: CostPickRequestPush, GameCostPickRequest, GameCostPickResponse records
- AbilitySystem: FireTrigger scans Hand/Discard/Deck when SourceZoneGate set; per-game trigger limit tracking; ApplyStatOperator helper; PayCosts/ResumeCostPick for interactive cost flow
- GameCostPickHandler + ServiceRegistration wiring

Admin:
- AbilityBuilderR3.razor: full ability builder at /cards/ability-builder-r3 (39 triggers, 69 effects, 32 conditions, form/canvas/mermaid modes, compiles to engine-native $type JSON)
- AbilityBuilderR2-Draft.razor: fix switch expression no-best-type error

Docs:
- BuilderR3.md: master plan document

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-18 20:15:13 -04:00
Shard 26fa4c810d docs(builder): expand BuilderR2 with exhaustive spec coverage checklist 2026-04-16 16:10:10 +00:00
Shard 9598db0582 docs(ability): add AbilitySystem R2 implementation blueprint 2026-04-16 15:54:28 +00:00
Shard d147a3a469 docs(ability): add trigger source-zone support (hand/discard/deck) 2026-04-16 15:53:05 +00:00
Shard 5ec62b9d42 docs(ability): normalize trigger matrix and reusable schema blocks 2026-04-16 15:39:21 +00:00
Shard 6d1c01cdb2 docs(ability): add v2 builder/card-flow product direction recap 2026-04-16 15:38:36 +00:00
Shard 796fe0b4d1 docs: add ability builder gaps and solutions 2026-04-16 00:55:19 +00:00
Shard ebf864b65d docs: add Ruin issue resolution plan 2026-04-16 00:43:52 +00:00
dingo f966643e31 Spectator fix 2026-04-15 13:35:15 -04:00
dingo 7a987e4347 Merge branch 'main' of https://git.aeternalisgames.com/dingo/SOR 2026-04-15 12:51:28 -04:00
dingo abf2c1d96c AI Match fix 2026-04-15 12:51:14 -04:00
Shard d4113a99be docs: add combined markdown report 2026-04-15 14:03:39 +00:00
afa9e73489 fix(hand): scroll throttle, deselect on spin/click-outside for all card modes
- Throttle hand scroll to one step per 150 ms so each wheel tick advances exactly one card
- Deselect selected card when clicking outside the hand area (deferred flag pattern so board clicks still play the card)
- Extend spin and click-outside deselect to cover TERRAMORPHA_SELECT and card-triggered ABILITY_TARGET (Repentance/Instinct), not just CARD_FROM_HAND
- Show Repentance/Instinct cards as visually selected in hand when in ABILITY_TARGET mode
- Drop stale spectator state_update pushes from wrong sessions
- Auto-create missing audio buses on Settings._ready to avoid bus-not-found errors

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-15 09:31:30 -04:00
573d8cf727 fix(spectate): move Game signal connections to top of _ready, null-safe IIDs
- Game.state_updated (and other game signals) now connected before any UI
  setup that could error. Previously they were at line ~340, after hand spin
  button setup — if anything between _configure_hand_spin_buttons and those
  connects threw, spectators would never receive live state pushes (no player
  actions to trigger ACK-based updates as fallback)
- _rebuild_hand now uses str(raw) if raw != null else "" for IID extraction;
  card.get("instanceId", "") returns null (not the default) when the key
  exists with a null value, which would error on append to Array[String]

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-14 23:42:28 -04:00
8649384997 fix(spectate): restore _rebuild_hand for spectators, fix typed Array filter
- Removed the outer _is_spectating guard on _rebuild_hand; blocking it
  entirely left _cached_hand_iids stale and skipped other bookkeeping
- Spectator early-exit now inside _rebuild_hand after updating the cache,
  clearing the display hand cleanly
- Replaced Array[Dictionary].filter() (returns untyped Array, silent type
  mismatch on reassignment) with explicit loops into typed Array[Dictionary]
- Same fix for the display_hand build: explicit typed loop instead of
  hand.filter() with Variant cast

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-14 23:30:37 -04:00
cdbcf5e2d1 feat(admin): end AI matches from admin portal
AiMatchService:
- GetActiveMatchesAsync: queries CustomLobbies joined to GameSessions
  to return all running AI vs AI sessions with display names.
- ForceEndMatchAsync: marks session Abandoned + lobby Completed; the AI
  polling loops detect the status change within ~1 s and exit cleanly.
- ActiveAiMatch DTO returned by both methods.

AiMatchPage:
- Active AI Matches section loads on page init and has a Refresh button;
  each row has an End button that calls ForceEndMatchAsync and refreshes.
- Created This Session table also gets an End button per row.
- Spinner shown on the End button while the request is in flight.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-14 23:27:46 -04:00
286ccf26c7 fix(spectate): skip hand rebuild and clear draw popups when spectating
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-14 23:24:28 -04:00
cbf1ff2ad5 fix(ui): move InGameSettings to CanvasLayer 15 so it renders above all HUD
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-14 23:13:17 -04:00