Example #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);
            }
        }
Example #2
0
        void HandleScriptEffect(uint effIndex)
        {
            Unit caster = GetCaster();
            Unit target = GetHitUnit();

            if (target)
            {
                // Refresh corruption on target
                AuraEffect aurEff = target.GetAuraEffect(AuraType.PeriodicDamage, SpellFamilyNames.Warlock, new FlagArray128(0x2, 0, 0), caster.GetGUID());
                if (aurEff != null)
                {
                    uint damage = (uint)Math.Max(aurEff.GetAmount(), 0);
                    Global.ScriptMgr.ModifyPeriodicDamageAurasTick(target, caster, ref damage);
                    aurEff.SetDamage((int)(caster.SpellDamageBonusDone(target, aurEff.GetSpellInfo(), damage, DamageEffectType.DOT, GetEffectInfo(effIndex)) * aurEff.GetDonePct()));
                    aurEff.CalculatePeriodic(caster, false, false);
                    aurEff.GetBase().RefreshDuration(true);
                }
            }
        }
Example #3
0
        void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();
            // Improved Polymorph
            AuraEffect improvedPolymorph = _caster.GetAuraEffectOfRankedSpell(SpellIds.ImprovedPolymorphRank1, 0);

            if (improvedPolymorph != null)
            {
                if (_caster.HasAura(SpellIds.ImprovedPolymorphMarker))
                {
                    return;
                }

                GetTarget().CastSpell(GetTarget(), Global.SpellMgr.GetSpellWithRank(SpellIds.ImprovedPolymorphStunRank1, improvedPolymorph.GetSpellInfo().GetRank()), true, null, aurEff);
                _caster.CastSpell(_caster, SpellIds.ImprovedPolymorphMarker, true, null, aurEff);
            }
        }