namespace DataServer.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 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(); /// /// Primary damage type key (e.g., "physical", "fire", "poison") /// public string DamageTypeKey { get; set; } = "physical"; /// /// Calculate damage after armor and resistances /// public int CalculateDamage(int rawDamage, string damageTypeKey) { float damage = rawDamage; // Apply armor reduction (flat mitigation for all damage types) if (Armor > 0) { float armorReduction = Armor / (float)(Armor + 100); damage *= (1.0f - armorReduction); } // Check for resistance/weakness if (Resistances.TryGetValue(damageTypeKey, out float resistance)) { if (resistance >= 1.0f) return 0; // Immune damage *= (1.0f - resistance); } return Math.Max(1, (int)damage); } }