Files
sor/newCard-Cont.md
T
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

6.0 KiB
Raw Blame History

newCard-Cont.md — Ability Revamp Continuation Plan

Gap analysis from last 7 commits (phases 0–6). Items ordered by fix priority.


Critical Bugs (silent runtime failures)

1. [PolyType] attributes misplaced — Effects.cs:284–318

The new effect type registrations appear after public abstract class Effect { } (line 101). In C#, floating attributes attach to the next class declaration (AscendFromZoneEffect, line 324), not to Effect. The polymorphic JSON converter never learns about ~12 new effect types. Deserialization will silently fail or throw at runtime for any card using these effects.

Fix: Move all lines 284–318 to just before line 101 (before the Effect class declaration).

  • Done

2. SpiritToken exclusions incomplete

BazaarBuyPrebuiltDeckHandler.cs:60 and CollectionSelectStarterDeckHandler.cs:84 grant all deck cards without filtering out SpiritToken. CollectionAddCardHandler.cs:71 already blocks it but these two paths do not.

Fix: Add SpiritToken guard to both handlers (same pattern as CollectionAddCardHandler).

  • Done

3. CostGroup not paid — AbilitySystem.cs:115–118

ActivateAbility checks def.Cost only. def.CostGroup is never read, never executed. Costs authored in the new builder are silently skipped.

Fix: After existing def.Cost block, add PayCostGroup(def.CostGroup, ...) path with PendingCostGroupPick pause support. Wire into ActivateAbility.

  • Done

Major Missing Subsystems

4. PendingInteraction envelope — GameState.cs:97–109

Only PendingTriggeredTarget and PendingCostPick exist. Full interactive-pause protocol requires:

  • PendingActionGroupPick (OR/XOR branch selection)
  • PendingCostGroupPick (CostGroup interactive payment)
  • PendingBranchPick (ChooseOne with non-self chooser)
  • PendingTilePick, PendingPlayerPick, PendingRevealChoicePick

Fix: Add pending state types + properties to GameState. Wire handler endpoints.

  • Done

5. Phase 5 new effects are model-only

Zero engine switch cases for: AscendFromZoneEffect, TransitionFromZoneEffect, ModifyChannelRangeEffect, RelocateRuinEffect, ActivateRuinAbilityEffect, DisableRuinForDurationEffect, ChannelCardFromZoneEffect, CloneSpiritAsTokenEffect, DestroyTokenEffect, SkipTurnEffect, StackDeckEffect, SearchAndPlaceEffect, ChangeAttackTypeEffect, ObstructMovementTypeEffect.

All fall through ExecuteEffect switch silently.

Fix: Add engine switch cases for each. Some are full implementations; complex ones (AscendFromZone, ChannelCardFromZone, StackDeck) need deeper game logic.

  • Done

6. ActionGroup recursion missing — AbilitySystem.cs:651–658

GetEffectiveActions returns only ag.Actions (top-level leaf array). Nested ag.Groups are never traversed. AND-logic and recursive trees are silently ignored.

Fix: Recursively flatten AND groups; for OR/XOR emit PendingActionGroupPick instead of random-picking.

  • Done

7. ChooseOne ChooserRole + TargetSelector.Chooser unimplemented

  • ChooseOne.ChooserRole: defaults to branch 0; no PendingBranchPick, no opponent/random logic. AbilitySystem.cs:700–709.
  • TargetSelector.Chooser: ResolveTargets uses selector.Ownership but never reads selector.Chooser. Random/Self/Opponent/Ally chooser logic unimplemented. AbilitySystem.cs:828+.

Fix: Emit PendingBranchPick for non-Self choosers. Branch on selector.Chooser in ResolveTargets.

  • Done

Structural Model Issues

8. SearchDeckEffect.ThenAction should be ActionGroup?

Effects.cs:196 — currently Action?. Per spec, should be ActionGroup? to support recursive search-then-action trees.

Fix: Change type, update all usages/serialization.

  • Done

9. ApplyOnEventEffect.Effects should be recursive tree

Effects.cs:479 — currently Effect[]. Should be an action/effect tree, not a flat effect array.

Fix: Change Effect[] Effects to Action[] Actions (ActionGroup wrapping supported by Action model), update engine ApplyOnEvent handling.

  • Done

Missing Tooling

10. EffectsJsonCutover tool missing

Phase 2 migration dropped EffectsJson but no conversion tool exists to rewrite existing card JSON (pre-revamp AbilitiesJson shape) to the new ability shape. SOR.Tools/Migrations/EffectsJsonCutover.cs was planned but not created.

Fix: Create the conversion tool. Read cards with legacy ability format, map to new ActionGroup/CostGroup shape, write back.

  • Done

11. AbilityBuilder is still form-style (Phase 4 canvas not built)

AbilityBuilder.razor is still a form-based builder. The Phase 4 spec called for a canvas-based drag/pan/zoom node editor with SVG connection paths, node palette, and nested ActionGroup/CostGroup editors.

Fix: Implement nested sub-group support. Added ActionGroupDraft class, SubGroups property on AbilityDraft, UI section for sub-groups in each ability, Compile() emits Groups[], and ParseJson loads Groups[] back into SubGroups.

  • Done

Summary Table

# Item File(s) Status
1 Fix misplaced [PolyType] attrs Effects.cs [x]
2 SpiritToken guard in prebuilt/starter deck handlers BazaarBuyPrebuiltDeckHandler.cs, CollectionSelectStarterDeckHandler.cs [x]
3 Wire CostGroup payment in ActivateAbility AbilitySystem.cs [x]
4 PendingInteraction envelope (ActionGroupPick, BranchPick, etc.) GameState.cs, handlers [x]
5 Phase 5 engine switch cases AbilitySystem.cs [x]
6 ActionGroup recursion in GetEffectiveActions AbilitySystem.cs [x]
7 ChooseOne ChooserRole + TargetSelector.Chooser AbilitySystem.cs [x]
8 SearchDeckEffect.ThenAction → ActionGroup? Effects.cs [x]
9 ApplyOnEventEffect.Effects → recursive tree Effects.cs [x]
10 EffectsJsonCutover tool SOR.Tools/ [x]
11 Canvas AbilityBuilder — nested sub-group support AbilityBuilder.razor [x]