예제 #1
0
            internal uint CalculateSpellCriticalDamage(SpellInfo spellInfo, uint damage)
            {
                uint  critBonus    = 0;
                float critModifier = 0.0f;

                switch (spellInfo.DamageClass)
                {
                case SpellDamageClass.Melee:
                case SpellDamageClass.Ranged:
                    critBonus = damage / 2;
                    break;

                case SpellDamageClass.Magic:
                case SpellDamageClass.None:
                    critBonus = damage;
                    break;
                }

                critModifier += (unit.TotalAuraMultiplier(AuraEffectType.ModifyCritDamageBonus) - 1.0f) * 100.0f;
                critModifier  = Mathf.Clamp(critModifier, -100.0f, float.MaxValue);

                if (!Mathf.Approximately(critModifier, 0.0f))
                {
                    critBonus = critBonus.AddPercentage(critModifier);
                }

                return(System.Math.Max(0, damage + critBonus));
            }