From 70df0e0b33549b82e2424020f4550db1e0a581e2 Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 12 Apr 2026 19:10:16 -0400 Subject: [PATCH] AI picks prebuilt starter deck; admin deck-per-difficulty config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AiDeckResolver: resolves which prebuilt deck an AI uses for a given difficulty. Checks AiDeckAssignment table first (admin-configured), then falls back to a random active starter deck. Creates/updates a real Deck row in CollectionDb so GameReadyHandler's standard path works unchanged. - AiDeckAssignment entity + EF migration (ai_deck_assignments table): admin maps Difficulty 1-10 → PrebuiltDeckId; null = "random starter". - GameAddAiHandler: replaced direct Deck lookup with AiDeckResolver.ResolveAsync. - AiSeedStartupService: removed AiDeckSeeder call — decks are resolved per-game from prebuilt decks, not pre-seeded with placeholder cards. - ServiceRegistration: registers AiDeckResolver as Scoped. - Admin: new /ai/deck-config page (AiDeckConfigPage) showing a D1-D10 table with prebuilt deck dropdowns; saved via upsert. Added to AI nav section. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../SOR.Admin/Components/Layout/NavMenu.razor | 5 + .../Pages/Ai/AiDeckConfigPage.razor | 179 +++++ .../src/SOR.Ai/Handlers/GameAddAiHandler.cs | 20 +- Server/src/SOR.Ai/Lobby/AiDeckResolver.cs | 146 ++++ .../SOR.Ai/Seeding/AiSeedStartupService.cs | 13 +- Server/src/SOR.Ai/ServiceRegistration.cs | 2 + .../SOR.Database/Contexts/GameDbContext.cs | 7 + .../Entities/Game/AiDeckAssignment.cs | 20 + ...0412230253_AddAiDeckAssignment.Designer.cs | 632 ++++++++++++++++++ .../20260412230253_AddAiDeckAssignment.cs | 38 ++ .../Game/GameDbContextModelSnapshot.cs | 16 + 11 files changed, 1056 insertions(+), 22 deletions(-) create mode 100644 Server/src/SOR.Admin/Components/Pages/Ai/AiDeckConfigPage.razor create mode 100644 Server/src/SOR.Ai/Lobby/AiDeckResolver.cs create mode 100644 Server/src/SOR.Database/Entities/Game/AiDeckAssignment.cs create mode 100644 Server/src/SOR.Database/Migrations/Game/20260412230253_AddAiDeckAssignment.Designer.cs create mode 100644 Server/src/SOR.Database/Migrations/Game/20260412230253_AddAiDeckAssignment.cs diff --git a/Server/src/SOR.Admin/Components/Layout/NavMenu.razor b/Server/src/SOR.Admin/Components/Layout/NavMenu.razor index 912506d..e3f611c 100644 --- a/Server/src/SOR.Admin/Components/Layout/NavMenu.razor +++ b/Server/src/SOR.Admin/Components/Layout/NavMenu.razor @@ -178,6 +178,11 @@ Calibration +