SummonToken: structured admin editor + affinity enforcement + art URLs

- AbilityBuilder.razor: replace raw JSON textarea with full structured
  editor for SummonToken effects. Supports two modes:
  • Existing Card — searchable autocomplete from Spirit card catalog
  • Custom Token — inline editor for all Spirit stats (name, affinity,
    health/defense/damage, movement type/MP, attack range, LOS, all
    permission flags, genus tags, abilities JSON, 2D art URL, 3D model URL)
  Compiles TileFilter[TileAffinityMatchesFilter] when affinity is non-Void,
  enabling client-side tile highlighting to match server enforcement.

- AbilitySystem.cs (SummonTokenEffect): validate that the target tile's
  affinity is compatible with the token's affinity before placing.

- GameState.cs (CardInstance): add Art2dUrl + ModelUrl so summoned tokens
  can carry visual asset references through the game state.

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-03-22 16:15:36 -04:00
co-authored by Claude Happy
parent 1831fd646c
commit 324537ded0
3 changed files with 484 additions and 5 deletions
@@ -1235,6 +1235,13 @@ public static class AbilitySystem
var proto = JsonSerializer.Deserialize<CardInstance>(ste.TokenDefJson, _jsonOpts);
if (proto is null) break;
// Enforce tile affinity: a token with a non-Void affinity may only be
// placed on a tile whose resolved affinity is compatible with the token.
if (!string.IsNullOrEmpty(proto.Affinity) && proto.Affinity != "Void"
&& Enum.TryParse<Affinity>(proto.Affinity, out var tokenAffinity)
&& !AffinitySystem.IsAffinityValid(tile, tokenAffinity))
break;
proto.InstanceId = Guid.NewGuid().ToString("N")[..8];
proto.CardType = "SpiritToken";
@@ -1307,6 +1314,9 @@ public static class AbilitySystem
MaxAttackRange = proto.MaxAttackRange,
RequiresLos = proto.RequiresLos,
AbilitiesJson = proto.AbilitiesJson,
Genus = proto.Genus is null ? null : [.. proto.Genus],
Art2dUrl = proto.Art2dUrl,
ModelUrl = proto.ModelUrl,
IsExhausted = false,
Position = position,
};