using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Server.Data.Entities;
///
/// Persistent player character with stats and equipment for dungeon crawler
///
[Table("dungeon_characters")]
public class DungeonCharacter
{
[Key]
public ulong Id { get; set; }
[Required]
public ulong AccountId { get; set; }
[Required]
[MaxLength(32)]
public string Name { get; set; } = "";
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime LastPlayedAt { get; set; } = DateTime.UtcNow;
// Progression
public int Level { get; set; } = 1;
public long Experience { get; set; } = 0;
public int UnspentStatPoints { get; set; } = 5; // Start with 5 points
// Core Stats (5 points per level to distribute)
public int Strength { get; set; } = 1; // Physical damage, heavy equipment
public int Intelligence { get; set; } = 1; // Spell damage, magical equipment
public int Wisdom { get; set; } = 1; // Max mana, XP bonus, spell learning
public int Endurance { get; set; } = 1; // Max HP, max stamina, regen rate
public int Dexterity { get; set; } = 1; // Move speed, attack speed, light equipment
// Derived stats (calculated from base stats)
[NotMapped] public int MaxHealth => 50 + (Endurance * 10);
[NotMapped] public int MaxMana => 20 + (Wisdom * 8);
[NotMapped] public int MaxStamina => 50 + (Endurance * 5);
[NotMapped] public float XpBonus => 1.0f + (Wisdom * 0.02f); // 2% per WIS
[NotMapped] public float MoveSpeed => 100f + (Dexterity * 2f);
[NotMapped] public float AttackSpeed => 1.0f + (Dexterity * 0.02f);
[NotMapped] public float RegenRate => 1.0f + (Endurance * 0.1f); // HP/Mana/Stamina regen multiplier
// Current state (saved on logout/death)
public int CurrentHealth { get; set; } = 50;
public int CurrentMana { get; set; } = 20;
// Equipment slots (ItemId references, null = empty)
public ulong? EquippedWeapon { get; set; }
public ulong? EquippedOffhand { get; set; }
public ulong? EquippedHead { get; set; }
public ulong? EquippedChest { get; set; }
public ulong? EquippedLegs { get; set; }
public ulong? EquippedBoots { get; set; }
public ulong? EquippedGloves { get; set; }
public ulong? EquippedAccessory { get; set; }
// Lifetime stats
public int TotalKills { get; set; }
public int TotalDeaths { get; set; }
public int PlayersKilled { get; set; }
public int DungeonsCompleted { get; set; }
public int BossesKilled { get; set; }
// Soft delete
public bool IsDeleted { get; set; } = false;
// Navigation
public virtual Account? Account { get; set; }
public virtual ICollection Inventory { get; set; } = new List();
public virtual ICollection Stash { get; set; } = new List();
public virtual ICollection LearnedSpells { get; set; } = new List();
}