Exemplo n.º 1
0
        void Absorb(DamageInfo dmgInfo, float multiplier)
        {
            // Prevent default action (which would remove the aura)
            PreventDefaultAction();

            // make sure damage doesn't come from stagger damage spell SPELL_MONK_STAGGER_DAMAGE_AURA
            SpellInfo dmgSpellInfo = dmgInfo.GetSpellInfo();

            if (dmgSpellInfo != null)
            {
                if (dmgSpellInfo.Id == SpellIds.StaggerDamageAura)
                {
                    return;
                }
            }

            AuraEffect effect = GetEffect(0);

            if (effect == null)
            {
                return;
            }

            Unit  target     = GetTarget();
            float agility    = target.GetStat(Stats.Agility);
            float baseAmount = MathFunctions.CalculatePct(agility, effect.GetAmount());
            float K          = Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, target.GetLevel(), -2, 0, target.GetClass());

            float newAmount = (baseAmount / (baseAmount + K));

            newAmount *= multiplier;

            // Absorb X percentage of the damage
            float absorbAmount = dmgInfo.GetDamage() * newAmount;

            if (absorbAmount > 0)
            {
                dmgInfo.AbsorbDamage((uint)absorbAmount);

                // Cast stagger and make it tick on each tick
                AddAndRefreshStagger(absorbAmount);
            }
        }