Files
sor/Server/src/SOR.Database/Entities/Identity/Account.cs
T
139ba5fbf0 Implement SOR.Ai Phase 1: project scaffold, transport, seeding, lobby handlers, session manager
- New SOR.Ai project with AI account/deck seeding (50 accounts: 10 difficulty × 5 strategy)
- AiNoOpClientConnection + AiClientMessage: AI invokes game handlers in-process
- AiPlayerSessionManager: BackgroundService subscribing to GameStarted/AiTurnStarted/GameEnded
- AiPlayerSession: sends game.ready and executes turns (Phase 1 stub: pass immediately)
- Lobby handlers: game.ai.add, game.ai.remove, game.ai.configure
- IAiAccountRegistry in SOR.Shared to break circular dependency with SOR.Game
- GameEndTurnHandler + GameReadyHandler publish AiTurnStarted event when AI is active player
- Account entity: IsAi, AiDifficulty, AiStrategy columns
- CustomLobby entity: AiSlotsJson column

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-12 15:13:38 -04:00

72 lines
2.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace SOR.Database.Entities.Identity;
using Microsoft.AspNetCore.Identity;
/// <summary>
/// Extends ASP.NET Core Identity's IdentityUser with SOR-specific profile fields.
///
/// Identity manages: email, password hash, lockout, two-factor, external logins.
/// We add: display name (in-game handle), avatar CDN URL, audit timestamps.
///
/// Ban handling uses Identity's built-in LockoutEnd + LockoutEnabled — no
/// separate ban table needed for basic bans. A separate audit log of ban
/// actions can be added later.
/// </summary>
public sealed class Account : IdentityUser<Guid>
{
/// <summary>Publicly visible in-game display name (not the login email).</summary>
public string? DisplayName { get; set; }
/// <summary>CDN URL to the player's avatar image.</summary>
public string? AvatarCdnUrl { get; set; }
/// <summary>UTC time the account was first created.</summary>
public DateTimeOffset CreatedAt { get; set; }
/// <summary>UTC time of the most recent successful login.</summary>
public DateTimeOffset? LastLoginAt { get; set; }
/// <summary>
/// Set when the player completes the starter deck selection during onboarding.
/// Null means they have not yet chosen their starter deck.
/// </summary>
public DateTimeOffset? StarterDeckSelectedAt { get; set; }
/// <summary>
/// In-game earned currency balance (Origin Points / Gold).
/// Earned through gameplay; can also be purchased from the bazaar store.
/// Spent on booster packs, prebuilt decks, cosmetics, and P2P listings.
/// </summary>
public int OriginPoints { get; set; }
/// <summary>
/// ELO-style rank score used for matchmaking.
/// Starts at 1000. Adjusted after each ranked game using K=32 factor.
/// </summary>
public int RankScore { get; set; } = 1000;
/// <summary>
/// When true, this account is excluded from the public leaderboard.
/// Use for bots, dev accounts, and internal test accounts.
/// </summary>
public bool IsHiddenFromLeaderboard { get; set; }
// ── AI account fields ─────────────────────────────────────────────────────
/// <summary>
/// True for AI-controlled virtual accounts (seeded by SOR.Ai at startup).
/// AI accounts are excluded from ranked matchmaking, leaderboards, and ELO updates.
/// They join custom lobbies as AI seats and submit game actions in-process.
/// </summary>
public bool IsAi { get; set; }
/// <summary>AI difficulty tier (1–10). Null for human accounts.</summary>
public int? AiDifficulty { get; set; }
/// <summary>
/// AI strategy archetype: "Aggressive" | "Control" | "Balanced" | "Ramp" | "Swarm".
/// Null for human accounts.
/// </summary>
public string? AiStrategy { get; set; }
}