Example #1
0
        void onEffectHit(uint effIndex)
        {
            GetCaster().CastSpell(GetCaster(), SpellIds.SoulSwapModCost, true);
            bool hasGlyph = GetCaster().HasAura(SpellIds.GlyphOfSoulSwap);

            List <uint> dotList      = new List <uint>();
            Unit        swapSource   = null;
            Aura        swapOverride = GetCaster().GetAura(SpellIds.SoulSwapOverride);

            if (swapOverride != null)
            {
                spell_warl_soul_swap_override swapScript = swapOverride.GetScript <spell_warl_soul_swap_override>("spell_warl_soul_swap_override");
                if (swapScript == null)
                {
                    return;
                }
                dotList    = swapScript.GetDotList();
                swapSource = swapScript.GetOriginalSwapSource();
            }

            if (dotList.Empty())
            {
                return;
            }

            foreach (var itr in dotList)
            {
                GetCaster().AddAura(itr, GetHitUnit());
                if (!hasGlyph && swapSource)
                {
                    swapSource.RemoveAurasDueToSpell(itr);
                }
            }

            // Remove Soul Swap Exhale buff
            GetCaster().RemoveAurasDueToSpell(SpellIds.SoulSwapOverride);

            if (hasGlyph) // Add a cooldown on Soul Swap if caster has the glyph
            {
                GetCaster().CastSpell(GetCaster(), SpellIds.SoulSwapCdMarker, false);
            }
        }
Example #2
0
        void HandleHit(uint effIndex)
        {
            Unit swapVictim = GetCaster();
            Unit warlock    = GetHitUnit();

            if (!warlock || !swapVictim)
            {
                return;
            }

            var appliedAuras = swapVictim.GetAppliedAuras();
            spell_warl_soul_swap_override swapSpellScript = null;
            Aura swapOverrideAura = warlock.GetAura(SpellIds.SoulSwapOverride);

            if (swapOverrideAura != null)
            {
                swapSpellScript = swapOverrideAura.GetScript <spell_warl_soul_swap_override>("spell_warl_soul_swap_override");
            }

            if (swapSpellScript == null)
            {
                return;
            }

            FlagArray128 classMask = GetEffectInfo().SpellClassMask;

            foreach (var itr in appliedAuras)
            {
                SpellInfo spellProto = itr.Value.GetBase().GetSpellInfo();
                if (itr.Value.GetBase().GetCaster() == warlock)
                {
                    if (spellProto.SpellFamilyName == SpellFamilyNames.Warlock && (spellProto.SpellFamilyFlags & classMask))
                    {
                        swapSpellScript.AddDot(itr.Key);
                    }
                }
            }

            swapSpellScript.SetOriginalSwapSource(swapVictim);
        }
Example #3
0
        SpellCastResult CheckCast()
        {
            Unit currentTarget = GetExplTargetUnit();
            Unit swapTarget    = null;
            Aura swapOverride  = GetCaster().GetAura(SpellIds.SoulSwapOverride);

            if (swapOverride != null)
            {
                spell_warl_soul_swap_override swapScript = swapOverride.GetScript <spell_warl_soul_swap_override>("spell_warl_soul_swap_override");
                if (swapScript != null)
                {
                    swapTarget = swapScript.GetOriginalSwapSource();
                }
            }

            // Soul Swap Exhale can't be cast on the same target than Soul Swap
            if (swapTarget && currentTarget && swapTarget == currentTarget)
            {
                return(SpellCastResult.BadTargets);
            }

            return(SpellCastResult.SpellCastOk);
        }