using Server.Data.Enums; namespace Server.Data.Entities; /// /// Runtime combat stats for a mob instance /// public class DungeonMobCombatStats { public int MaxHealth { get; set; } public int PhysicalDamage { get; set; } public int MagicDamage { get; set; } public int Armor { get; set; } public int MagicResist { get; set; } public float MoveSpeed { get; set; } public float AttackRange { get; set; } public float AttackSpeed { get; set; } public float AggroRange { get; set; } public float LeashRange { get; set; } public int XpReward { get; set; } public Dictionary Resistances { get; set; } = new(); /// /// Calculate damage after resistances /// public int CalculateDamage(int rawDamage, DamageType damageType) { string typeKey = damageType.ToString().ToLower(); // Check for resistance/weakness if (Resistances.TryGetValue(typeKey, out float resistance)) { if (resistance >= 1.0f) return 0; // Immune return (int)(rawDamage * (1.0f - resistance)); } // Physical/Magic armor reduction if (damageType == DamageType.Physical && Armor > 0) { // Armor formula: damage reduction = armor / (armor + 100) float reduction = Armor / (float)(Armor + 100); return (int)(rawDamage * (1.0f - reduction)); } if (damageType != DamageType.Physical && MagicResist > 0) { float reduction = MagicResist / (float)(MagicResist + 100); return (int)(rawDamage * (1.0f - reduction)); } return rawDamage; } }