Feature: card unit SFX + genus multi-select + CardEditor UX fixes

- CardDefinition: add MoveSoundUrl, DamagedSoundUrl, BlockedSoundUrl,
  AttackSoundUrl, DeathSoundUrl columns (nullable text)
- Migration 20260317100000_AddCardUnitSounds: 5 new columns on card_definitions
- CardDefinitionDto + ContentDtoMapper: expose 5 SFX fields to client
- CardEditor:
  - Genus: replace plain text input with DB-backed checkbox multi-select
    (loads distinct tags from all cards; add new tags inline)
  - Channel range (Min/Max): now ArchSpirit-only (removed from Spirit)
  - CanUseAbility / RequiresLos: default true for display & new cards
  - Assets tab: Unit Sound Effects section (5 CDN URL inputs)
  - model-viewer script injected lazily so 3D preview renders

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-17 09:36:18 -04:00
co-authored by Claude Happy
parent 3ba33275e3
commit c105120dc6
7 changed files with 765 additions and 23 deletions
@@ -89,6 +89,13 @@ public sealed class CardDefinition
/// </summary>
public string? ModelTintColor { get; set; }
// ── Unit sound effects (card-level SFX CDN URLs) ────────────────────────
public string? MoveSoundUrl { get; set; }
public string? DamagedSoundUrl { get; set; }
public string? BlockedSoundUrl { get; set; }
public string? AttackSoundUrl { get; set; }
public string? DeathSoundUrl { get; set; }
// ── Ability / Effect data (JSONB) ────────────────────────────────────────
/// <summary>JSONB array of AbilityDefinition objects (ArchSpirit, Spirit, Ruin).</summary>
public string? AbilitiesJson { get; set; }
@@ -0,0 +1,502 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SOR.Database.Contexts;
#nullable disable
namespace SOR.Database.Migrations.Catalog
{
[DbContext(typeof(CatalogDbContext))]
[Migration("20260317100000_AddCardUnitSounds")]
partial class AddCardUnitSounds
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("catalog")
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ActionName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AnimationCdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AnimationTrackName")
.HasColumnType("text");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CastSoundCdnUrl")
.HasColumnType("text");
b.Property<string>("ImpactSoundCdnUrl")
.HasColumnType("text");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("CardDefinitionId", "ActionName")
.IsUnique();
b.ToTable("card_animation_bindings", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AssetType")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.Property<string>("MimeType")
.HasColumnType("text");
b.Property<string>("ModelFacingDirection")
.HasColumnType("text");
b.Property<string>("ModelTintMaskUrl")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CardDefinitionId", "AssetType");
b.ToTable("card_assets", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AbilitiesJson")
.HasColumnType("jsonb")
.HasColumnName("abilities");
b.Property<string>("Affinity")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AttackSoundUrl")
.HasColumnType("text");
b.Property<string>("AttackType")
.HasColumnType("text");
b.Property<string>("BlockedSoundUrl")
.HasColumnType("text");
b.Property<bool?>("CanAttack")
.HasColumnType("boolean");
b.Property<bool?>("CanBeAttacked")
.HasColumnType("boolean");
b.Property<bool?>("CanBeBlocked")
.HasColumnType("boolean");
b.Property<bool?>("CanBeObstructed")
.HasColumnType("boolean");
b.Property<bool?>("CanBeSacrificed")
.HasColumnType("boolean");
b.Property<bool?>("CanDefend")
.HasColumnType("boolean");
b.Property<bool?>("CanMove")
.HasColumnType("boolean");
b.Property<bool?>("CanUseAbility")
.HasColumnType("boolean");
b.Property<string>("CardType")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("CollectorNumber")
.HasColumnType("integer");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int?>("Damage")
.HasColumnType("integer");
b.Property<string>("DamagedSoundUrl")
.HasColumnType("text");
b.Property<string>("DeathSoundUrl")
.HasColumnType("text");
b.Property<long>("DefinitionVersion")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasDefaultValue(0L);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("EffectsJson")
.HasColumnType("jsonb")
.HasColumnName("effects");
b.Property<string[]>("Genus")
.HasColumnType("text[]");
b.Property<bool>("IsPublished")
.HasColumnType("boolean");
b.Property<bool>("IsRetired")
.HasColumnType("boolean");
b.Property<int?>("MaxAttackRange")
.HasColumnType("integer");
b.Property<int?>("MaxChannelRange")
.HasColumnType("integer");
b.Property<int?>("MaxDefense")
.HasColumnType("integer");
b.Property<int?>("MaxHealth")
.HasColumnType("integer");
b.Property<int?>("MinAttackRange")
.HasColumnType("integer");
b.Property<int?>("MinChannelRange")
.HasColumnType("integer");
b.Property<float?>("ModelScale")
.HasColumnType("real");
b.Property<string>("ModelTintColor")
.HasColumnType("text");
b.Property<string>("MoveSoundUrl")
.HasColumnType("text");
b.Property<int?>("MovementPoints")
.HasColumnType("integer");
b.Property<string>("MovementType")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("OtherCostsJson")
.HasColumnType("jsonb")
.HasColumnName("other_costs");
b.Property<Guid?>("PreviousTierId")
.HasColumnType("uuid");
b.Property<string>("Rarity")
.IsRequired()
.HasColumnType("text");
b.Property<bool?>("RequiresLos")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("RetiredAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("SetId")
.HasColumnType("uuid");
b.Property<int>("SpCost")
.HasColumnType("integer");
b.Property<int>("StCost")
.HasColumnType("integer");
b.Property<string>("TerramorphaMode")
.HasColumnType("text");
b.Property<int?>("Tier")
.HasColumnType("integer");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Affinity");
b.HasIndex("CardType");
b.HasIndex("DefinitionVersion");
b.HasIndex("Name");
b.HasIndex("PreviousTierId");
b.HasIndex("Rarity");
b.HasIndex("SetId");
b.HasIndex("IsPublished", "SetId");
b.ToTable("card_definitions", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateOnly?>("ReleaseDate")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("Code")
.IsUnique();
b.ToTable("card_sets", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CdnUploadRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ContentType")
.HasColumnType("text");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.Property<string>("ObjectKey")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Prefix")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("UploadedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("IsAiGenerated");
b.HasIndex("ObjectKey")
.IsUnique();
b.HasIndex("Prefix");
b.ToTable("cdn_upload_records", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.GameAudioConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Context")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("TrackCdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TrackName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Context");
b.HasIndex("IsActive");
b.ToTable("game_audio_configs", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileBottomModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CdnKey")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("PublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("IsActive");
b.ToTable("tile_bottom_models", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileModelBinding", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Affinity")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ModelCdnKey")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ModelPublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Shape")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TexturePublicUrl")
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Affinity", "Shape")
.IsUnique();
b.ToTable("tile_model_bindings", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
.WithMany("AnimationBindings")
.HasForeignKey("CardDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CardDefinition");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
.WithMany("Assets")
.HasForeignKey("CardDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CardDefinition");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "PreviousTier")
.WithMany()
.HasForeignKey("PreviousTierId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("SOR.Database.Entities.Catalog.CardSet", "Set")
.WithMany("Cards")
.HasForeignKey("SetId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("PreviousTier");
b.Navigation("Set");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.Navigation("AnimationBindings");
b.Navigation("Assets");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
{
b.Navigation("Cards");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,78 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Catalog
{
/// <inheritdoc />
public partial class AddCardUnitSounds : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "AttackSoundUrl",
schema: "catalog",
table: "card_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "BlockedSoundUrl",
schema: "catalog",
table: "card_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "DamagedSoundUrl",
schema: "catalog",
table: "card_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "DeathSoundUrl",
schema: "catalog",
table: "card_definitions",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "MoveSoundUrl",
schema: "catalog",
table: "card_definitions",
type: "text",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AttackSoundUrl",
schema: "catalog",
table: "card_definitions");
migrationBuilder.DropColumn(
name: "BlockedSoundUrl",
schema: "catalog",
table: "card_definitions");
migrationBuilder.DropColumn(
name: "DamagedSoundUrl",
schema: "catalog",
table: "card_definitions");
migrationBuilder.DropColumn(
name: "DeathSoundUrl",
schema: "catalog",
table: "card_definitions");
migrationBuilder.DropColumn(
name: "MoveSoundUrl",
schema: "catalog",
table: "card_definitions");
}
}
}
@@ -113,9 +113,15 @@ namespace SOR.Database.Migrations.Catalog
.IsRequired()
.HasColumnType("text");
b.Property<string>("AttackSoundUrl")
.HasColumnType("text");
b.Property<string>("AttackType")
.HasColumnType("text");
b.Property<string>("BlockedSoundUrl")
.HasColumnType("text");
b.Property<bool?>("CanAttack")
.HasColumnType("boolean");
@@ -153,6 +159,12 @@ namespace SOR.Database.Migrations.Catalog
b.Property<int?>("Damage")
.HasColumnType("integer");
b.Property<string>("DamagedSoundUrl")
.HasColumnType("text");
b.Property<string>("DeathSoundUrl")
.HasColumnType("text");
b.Property<long>("DefinitionVersion")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
@@ -199,6 +211,9 @@ namespace SOR.Database.Migrations.Catalog
b.Property<string>("ModelTintColor")
.HasColumnType("text");
b.Property<string>("MoveSoundUrl")
.HasColumnType("text");
b.Property<int?>("MovementPoints")
.HasColumnType("integer");
@@ -365,6 +380,33 @@ namespace SOR.Database.Migrations.Catalog
b.ToTable("game_audio_configs", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileBottomModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CdnKey")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("PublicUrl")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("IsActive");
b.ToTable("tile_bottom_models", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileModelBinding", b =>
{
b.Property<Guid>("Id")