using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace DungeonCrawler.Data.Entities; /// /// Item template/definition - what an item IS /// [Table("item_definitions")] public class ItemDefinition { [Key] public int Id { get; set; } [Required] [MaxLength(64)] public string Name { get; set; } = ""; [MaxLength(256)] public string Description { get; set; } = ""; public ItemType Type { get; set; } public ItemRarity Rarity { get; set; } = ItemRarity.Common; public EquipmentSlot? EquipSlot { get; set; } // Null if not equippable // Stat requirements to equip/use public int RequiredStrength { get; set; } = 0; public int RequiredIntelligence { get; set; } = 0; public int RequiredWisdom { get; set; } = 0; public int RequiredDexterity { get; set; } = 0; public int RequiredLevel { get; set; } = 1; // Stat bonuses when equipped public int BonusStrength { get; set; } = 0; public int BonusIntelligence { get; set; } = 0; public int BonusWisdom { get; set; } = 0; public int BonusEndurance { get; set; } = 0; public int BonusDexterity { get; set; } = 0; public int BonusHealth { get; set; } = 0; public int BonusMana { get; set; } = 0; // Weapon stats public int MinDamage { get; set; } = 0; public int MaxDamage { get; set; } = 0; public float AttackRange { get; set; } = 0; // 0 = melee public DamageType DamageType { get; set; } = DamageType.Physical; // Armor stats public int Armor { get; set; } = 0; public int MagicResist { get; set; } = 0; // Consumable effects public int HealAmount { get; set; } = 0; public int ManaRestore { get; set; } = 0; public int StaminaRestore { get; set; } = 0; // Special public bool IsTeleportScroll { get; set; } = false; public int? TeachesSpellId { get; set; } // For spell tomes // Stacking public bool Stackable { get; set; } = false; public int MaxStack { get; set; } = 1; // Visuals public int SpriteId { get; set; } = 0; public bool IsEnabled { get; set; } = true; } /// /// Actual item instance owned by a character (inventory or equipped) /// [Table("character_items")] public class CharacterItem { [Key] public ulong Id { get; set; } public ulong CharacterId { get; set; } public int ItemDefinitionId { get; set; } public int Quantity { get; set; } = 1; public int SlotIndex { get; set; } // Inventory position (0-29 for example) public DateTime AcquiredAt { get; set; } = DateTime.UtcNow; // Navigation public virtual Character? Character { get; set; } public virtual ItemDefinition? Definition { get; set; } } /// /// Items stored in character's stash (safe storage in hub) /// [Table("stash_items")] public class StashItem { [Key] public ulong Id { get; set; } public ulong CharacterId { get; set; } public int ItemDefinitionId { get; set; } public int Quantity { get; set; } = 1; public int SlotIndex { get; set; } public DateTime StoredAt { get; set; } = DateTime.UtcNow; // Navigation public virtual Character? Character { get; set; } public virtual ItemDefinition? Definition { get; set; } } /// /// Spell definition - learnable abilities /// [Table("spell_definitions")] public class SpellDefinition { [Key] public int Id { get; set; } [Required] [MaxLength(64)] public string Name { get; set; } = ""; [MaxLength(256)] public string Description { get; set; } = ""; public SpellType Type { get; set; } // Requirements public int RequiredWisdom { get; set; } = 1; public int RequiredIntelligence { get; set; } = 0; public int RequiredLevel { get; set; } = 1; // Costs public int ManaCost { get; set; } = 10; public float Cooldown { get; set; } = 1.0f; // Seconds // Effects public int BaseDamage { get; set; } = 0; // Scales with INT public int BaseHealing { get; set; } = 0; // Scales with WIS public float Range { get; set; } = 100f; public float AreaOfEffect { get; set; } = 0; // 0 = single target // Special public bool IsTeleport { get; set; } = false; public bool IsShield { get; set; } = false; public int ShieldAmount { get; set; } = 0; // Visuals public int SpriteId { get; set; } = 0; public string EffectColor { get; set; } = "#ffffff"; public bool IsEnabled { get; set; } = true; } /// /// Spells a character has learned /// [Table("learned_spells")] public class LearnedSpell { [Key] public ulong Id { get; set; } public ulong CharacterId { get; set; } public int SpellDefinitionId { get; set; } public DateTime LearnedAt { get; set; } = DateTime.UtcNow; // Could add spell levels/upgrades later public int SpellLevel { get; set; } = 1; // Navigation public virtual Character? Character { get; set; } public virtual SpellDefinition? Definition { get; set; } } // Enums public enum ItemType { Weapon, Armor, Accessory, Consumable, SpellTome, Material, Key, TeleportScroll } public enum ItemRarity { Common = 0, Uncommon = 1, Rare = 2, Epic = 3, Legendary = 4 } public enum EquipmentSlot { Weapon, Offhand, Head, Chest, Legs, Boots, Gloves, Accessory } public enum DamageType { Physical, Fire, Ice, Lightning, Poison, Holy, Dark } public enum SpellType { Damage, Healing, Buff, Debuff, Utility, Summon }