Ejemplo n.º 1
0
        bool CheckProc(ProcEventInfo eventInfo)
        {
            SpellInfo spellInfo = eventInfo.GetSpellInfo();

            if (spellInfo == null || spellInfo.Id == SpellIds.RejuvenationT10Proc)
            {
                return(false);
            }

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return(false);
            }

            Player caster = eventInfo.GetActor().ToPlayer();

            if (!caster)
            {
                return(false);
            }

            return(caster.GetGroup() || caster != eventInfo.GetProcTarget());
        }
Ejemplo n.º 2
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();
            SpellInfo spellInfo = eventInfo.GetSpellInfo();

            if (spellInfo == null)
            {
                return;
            }

            uint spellId;
            int  chance;

            // Holy Light & Flash of Light
            if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0xC0000000))
            {
                spellId = SpellIds.EnduringLight;
                chance  = 15;
            }
            // Judgements
            else if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00800000u))
            {
                spellId = SpellIds.EnduringJudgement;
                chance  = 50;
            }
            else
            {
                return;
            }

            if (RandomHelper.randChance(chance))
            {
                eventInfo.GetActor().CastSpell(eventInfo.GetProcTarget(), spellId, true, null, aurEff);
            }
        }
Ejemplo n.º 3
0
            bool CheckProc(ProcEventInfo eventInfo)
            {
                SpellInfo spellInfo = eventInfo.GetSpellInfo();

                if (spellInfo == null)
                {
                    return(false);
                }

                return((spellInfo.GetAllEffectsMechanicMask() & ((1 << (int)Mechanics.Root) | (1 << (int)Mechanics.Snare))) != 0);
            }
Ejemplo n.º 4
0
        bool CheckProc(ProcEventInfo eventInfo)
        {
            SpellInfo spellInfo = eventInfo.GetSpellInfo();

            if (spellInfo != null)
            {
                if (spellInfo.GetAllEffectsMechanicMask().HasAnyFlag(((1u << (int)Mechanics.Interrupt) | (1 << (int)Mechanics.Silence))))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 5
0
        bool CheckEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            SpellInfo procSpell = eventInfo.GetSpellInfo();

            if (procSpell != null)
            {
                _baseHolyPowerCost = procSpell.CalcPowerCost(PowerType.HolyPower, false, eventInfo.GetActor(), eventInfo.GetSchoolMask());
            }
            else
            {
                _baseHolyPowerCost = null;
            }

            return(_baseHolyPowerCost != null);
        }
Ejemplo n.º 6
0
            // This is a port of the old switch hack in Unit.cpp, it's not correct
            void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
            {
                PreventDefaultAction();
                Unit caster = GetCaster();

                if (!caster)
                {
                    return;
                }

                Unit drw = null;

                foreach (Unit controlled in caster.m_Controlled)
                {
                    if (controlled.GetEntry() == CreatureIds.DancingRuneWeapon)
                    {
                        drw = controlled;
                        break;
                    }
                }

                if (!drw || !drw.GetVictim())
                {
                    return;
                }

                SpellInfo spellInfo = eventInfo.GetSpellInfo();

                if (spellInfo == null)
                {
                    return;
                }

                DamageInfo damageInfo = eventInfo.GetDamageInfo();

                if (damageInfo == null || damageInfo.GetDamage() == 0)
                {
                    return;
                }

                int amount = (int)(damageInfo.GetDamage() / 2);
                SpellNonMeleeDamage log = new SpellNonMeleeDamage(drw, drw.GetVictim(), spellInfo.Id, spellInfo.GetSpellXSpellVisualId(drw), spellInfo.GetSchoolMask());

                log.damage = (uint)amount;
                drw.DealDamage(drw.GetVictim(), (uint)amount, null, DamageEffectType.Direct, spellInfo.GetSchoolMask(), spellInfo, true);
                drw.SendSpellNonMeleeDamageLog(log);
            }
Ejemplo n.º 7
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            SpellInfo spellInfo = eventInfo.GetSpellInfo();

            if (spellInfo == null)
            {
                return;
            }

            uint targetSpellId;
            uint cdReductionEffIndex;

            switch (spellInfo.Id)
            {
            case SpellIds.Heal:
            case SpellIds.FlashHeal:     // reduce Holy Word: Serenity cd by 6 seconds
                targetSpellId       = SpellIds.HolyWordSerenity;
                cdReductionEffIndex = 1;
                // cdReduction = sSpellMgr.GetSpellInfo(SPELL_PRIEST_HOLY_WORD_SERENITY, GetCastDifficulty()).GetEffect(EFFECT_1).CalcValue(player);
                break;

            case SpellIds.PrayerOfHealing:     // reduce Holy Word: Sanctify cd by 6 seconds
                targetSpellId       = SpellIds.HolyWordSanctify;
                cdReductionEffIndex = 2;
                break;

            case SpellIds.Renew:     // reuce Holy Word: Sanctify cd by 2 seconds
                targetSpellId       = SpellIds.HolyWordSanctify;
                cdReductionEffIndex = 3;
                break;

            case SpellIds.Smite:     // reduce Holy Word: Chastise cd by 4 seconds
                targetSpellId       = SpellIds.HolyWordChastise;
                cdReductionEffIndex = 1;
                break;

            default:
                Log.outWarn(LogFilter.Spells, $"HolyWords aura has been proced by an unknown spell: {GetSpellInfo().Id}");
                return;
            }

            SpellInfo targetSpellInfo = Global.SpellMgr.GetSpellInfo(targetSpellId, GetCastDifficulty());
            int       cdReduction     = targetSpellInfo.GetEffect(cdReductionEffIndex).CalcValue(GetTarget());

            GetTarget().GetSpellHistory().ModifyCooldown(targetSpellInfo, TimeSpan.FromSeconds(-cdReduction));
        }
Ejemplo n.º 8
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();
            SpellInfo spellInfo = eventInfo.GetSpellInfo();

            if (spellInfo == null)
            {
                return;
            }

            uint spellId;
            int  chance;

            // Lesser Healing Wave
            if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000080u))
            {
                spellId = SpellIds.EnergySurge;
                chance  = 10;
            }
            // Lightning Bolt
            else if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000001u))
            {
                spellId = SpellIds.EnergySurge;
                chance  = 15;
            }
            // Stormstrike
            else if (spellInfo.SpellFamilyFlags[1].HasAnyFlag(0x00000010u))
            {
                spellId = SpellIds.PowerSurge;
                chance  = 50;
            }
            else
            {
                return;
            }

            if (RandomHelper.randChance(chance))
            {
                eventInfo.GetActor().CastSpell((Unit)null, spellId, true);
            }
        }
Ejemplo n.º 9
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();
            SpellInfo spellInfo = eventInfo.GetSpellInfo();

            if (spellInfo == null)
            {
                return;
            }

            uint spellId;
            int  chance;

            // Starfire
            if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000004u))
            {
                spellId = SpellIds.BlessingOfTheRemulos;
                chance  = 25;
            }
            // Rejuvenation
            else if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000010u))
            {
                spellId = SpellIds.BlessingOfTheElune;
                chance  = 25;
            }
            // Mangle (Bear) and Mangle (Cat)
            else if (spellInfo.SpellFamilyFlags[1].HasAnyFlag(0x00000440u))
            {
                spellId = SpellIds.BlessingOfTheCenarius;
                chance  = 40;
            }
            else
            {
                return;
            }

            if (RandomHelper.randChance(chance))
            {
                eventInfo.GetActor().CastSpell((Unit)null, spellId, true, null, aurEff);
            }
        }
Ejemplo n.º 10
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();
            SpellInfo spellInfo = eventInfo.GetSpellInfo();

            if (spellInfo == null)
            {
                return;
            }

            var costs = eventInfo.GetDamageInfo().GetSpellInfo().CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo().GetSchoolMask());
            var m     = costs.Find(cost => cost.Power == PowerType.Mana);

            if (m != null)
            {
                int mana = MathFunctions.CalculatePct(m.Amount, 35);
                if (mana > 0)
                {
                    GetTarget().CastCustomSpell(SpellIds.ItemManaSurge, SpellValueMod.BasePoint0, mana, GetTarget(), true, null, aurEff);
                }
            }
        }
Ejemplo n.º 11
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();
            SpellInfo spellInfo = eventInfo.GetSpellInfo();

            if (spellInfo == null)
            {
                return;
            }

            Unit caster = eventInfo.GetActor();
            var  costs  = spellInfo.CalcPowerCost(caster, spellInfo.GetSchoolMask());
            var  m      = costs.First(cost => { return(cost.Power == PowerType.Mana); });

            if (m == null)
            {
                return;
            }

            int amount = MathFunctions.CalculatePct(m.Amount, aurEff.GetAmount());

            caster.CastCustomSpell(SpellIds.Exhilarate, SpellValueMod.BasePoint0, amount, (Unit)null, true);
        }
Ejemplo n.º 12
0
 bool CheckFrozenOrbProc(AuraEffect aurEff, ProcEventInfo eventInfo)
 {
     return(eventInfo.GetSpellInfo() != null && eventInfo.GetSpellInfo().IsAffected(SpellFamilyNames.Mage, new FlagArray128(0, 0, 0x80, 0)) &&
            RandomHelper.randChance(aurEff.GetAmount()));
 }
Ejemplo n.º 13
0
 bool CheckProc(ProcEventInfo eventInfo)
 {
     return(eventInfo.GetSpellInfo() != null);
 }