Ejemplo n.º 1
0
        void AddAndRefreshStagger(float amount)
        {
            Unit target      = GetTarget();
            Aura auraStagger = FindExistingStaggerEffect(target);

            if (auraStagger != null)
            {
                AuraEffect effStaggerRemaining = auraStagger.GetEffect(1);
                if (effStaggerRemaining == null)
                {
                    return;
                }

                float newAmount = effStaggerRemaining.GetAmount() + amount;
                uint  spellId   = GetStaggerSpellId(target, newAmount);
                if (spellId == effStaggerRemaining.GetSpellInfo().Id)
                {
                    auraStagger.RefreshDuration();
                    effStaggerRemaining.ChangeAmount((int)newAmount, false, true /* reapply */);
                }
                else
                {
                    // amount changed the stagger type so we need to change the stagger amount (e.g. from medium to light)
                    GetTarget().RemoveAura(auraStagger);
                    AddNewStagger(target, spellId, newAmount);
                }
            }
            else
            {
                AddNewStagger(target, GetStaggerSpellId(target, amount), amount);
            }
        }
Ejemplo n.º 2
0
        void DiminishHaste(AuraEffect aurEff)
        {
            PreventDefaultAction();
            AuraEffect hasteBuff = GetEffect(0);

            if (hasteBuff != null)
            {
                hasteBuff.ChangeAmount(hasteBuff.GetAmount() - aurEff.GetAmount());
            }
        }
Ejemplo n.º 3
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            DamageInfo damageInfo = eventInfo.GetDamageInfo();

            if (damageInfo != null)
            {
                if (damageInfo.GetAttacker() == GetCaster() && damageInfo.GetVictim() == GetTarget())
                {
                    uint extra = MathFunctions.CalculatePct(damageInfo.GetDamage(), 25);
                    if (extra > 0)
                    {
                        aurEff.ChangeAmount(aurEff.GetAmount() + (int)extra);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        void OnPeriodicDamage(AuraEffect aurEff)
        {
            // Update our light/medium/heavy stagger with the correct stagger amount left
            Aura auraStagger = spell_monk_stagger.FindExistingStaggerEffect(GetTarget());

            if (auraStagger != null)
            {
                AuraEffect auraEff = auraStagger.GetEffect(1);
                if (auraEff != null)
                {
                    float total      = auraEff.GetAmount();
                    float tickDamage = aurEff.GetAmount();
                    auraEff.ChangeAmount((int)(total - tickDamage));
                }
            }
        }
Ejemplo n.º 5
0
        void OnReapply(AuraEffect aurEff, AuraEffectHandleModes mode)
        {
            // Calculate damage per tick
            float total   = aurEff.GetAmount();
            float perTick = total * _period / (float)GetDuration(); // should be same as GetMaxDuration() TODO: verify

            // Set amount on effect for tooltip
            AuraEffect effInfo = GetAura().GetEffect(0);

            if (effInfo != null)
            {
                effInfo.ChangeAmount((int)perTick);
            }

            // Set amount on damage aura (or cast it if needed)
            CastOrChangeTickDamage(perTick);
        }
Ejemplo n.º 6
0
        void HandleDummy(AuraEffect aurEff)
        {
            AuraEffect slowEff = GetEffect(0);

            if (slowEff != null)
            {
                int newAmount = slowEff.GetAmount() - 10;
                if (newAmount < -100)
                {
                    newAmount = -100;
                }
                slowEff.ChangeAmount(newAmount);

                if (newAmount <= -100 && !GetTarget().HasAura(SpellIds.Paralysis))
                {
                    GetTarget().CastSpell(GetTarget(), SpellIds.Paralysis, true, null, slowEff, GetCasterGUID());
                }
            }
        }
Ejemplo n.º 7
0
        void CastOrChangeTickDamage(float tickDamage)
        {
            Unit unit       = GetTarget();
            Aura auraDamage = unit.GetAura(SpellIds.StaggerDamageAura);

            if (auraDamage == null)
            {
                unit.CastSpell(unit, SpellIds.StaggerDamageAura, true);
                auraDamage = unit.GetAura(SpellIds.StaggerDamageAura);
            }

            if (auraDamage != null)
            {
                AuraEffect eff = auraDamage.GetEffect(0);
                if (eff != null)
                {
                    eff.ChangeAmount((int)tickDamage);
                }
            }
        }