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>
This commit is contained in:
dingo
2026-04-19 13:02:24 -04:00
co-authored by Claude Happy
parent 3b8de2deac
commit 768dfcee86
18 changed files with 673 additions and 85 deletions
+1 -28
View File
@@ -126,46 +126,19 @@ public static class AbilitySystem
// ── Triggered ability firing ───────────────────────────────────────────────
/// <summary>
/// Resolve the EffectsJson action list on a non-unit card (Repentance, Instinct, Ruin)
/// Resolve the AbilitiesJson active ability list on a non-unit card (Repentance, Instinct)
/// immediately when it is channeled. The card itself is the source in the context.
/// </summary>
public static GameState FireCardEffects(GameState state, string actorId, CardInstance card,
IReadOnlyList<AbilityTarget>? clientTargets = null)
{
// 1. EffectsJson — backward-compatible flat action list.
// NOTE: Some content pipelines historically wrote AbilityDefinition[] into
// EffectsJson for Repentance/Instinct. When that happens, ParseEffects yields
// empty/no-op actions. We still attempt to execute active abilities from
// EffectsJson below as a compatibility path.
var actions = ParseEffects(card.EffectsJson)
.Where(a => a.Effects is { Length: > 0 })
.ToArray();
if (actions.Length > 0)
{
var ctx = new AbilityContext { State = state, ActorId = actorId, Source = card };
ExecuteActions(actions, ctx, clientTargets, requireClientTargets: true);
}
// 2. AbilitiesJson — Active abilities (e.g. Repentance / Instinct cards with targeting).
// 3. Compatibility fallback: if AbilitiesJson has no active entries, also try
// parsing active abilities from EffectsJson.
var activeDefs = ParseAbilities(card.AbilitiesJson)
.Where(d => d.Type == AbilityType.Active)
.ToList();
if (activeDefs.Count == 0)
{
var fallback = ParseAbilities(card.EffectsJson)
.Where(d => d.Type == AbilityType.Active)
.ToList();
if (fallback.Count > 0)
activeDefs = fallback;
}
foreach (var def in activeDefs)
{
var ctx = new AbilityContext { State = state, ActorId = actorId, Source = card };
// Keep condition and duration behavior aligned with ActivateAbility.
if (!ValidateSourceActivationConditions(def, ctx, card))
continue;