示例#1
0
        void OnPeriodic(AuraEffect aurEff)
        {
            Unit caster = GetCaster();

            if (!caster)
            {
                return;
            }
            //! HACK for self damage, is not blizz :/
            uint damage = (uint)caster.CountPctFromMaxHealth(aurEff.GetBaseAmount());

            Player modOwner = caster.GetSpellModOwner();

            if (modOwner)
            {
                modOwner.ApplySpellMod(GetId(), SpellModOp.Cost, ref damage);
            }

            SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, caster, GetSpellInfo(), GetAura().GetSpellVisual(), GetSpellInfo().SchoolMask, GetAura().GetCastGUID());

            damageInfo.periodicLog = true;
            damageInfo.damage      = damage;
            caster.DealSpellDamage(damageInfo, false);
            caster.SendSpellNonMeleeDamageLog(damageInfo);
        }
示例#2
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);
            }
示例#3
0
        public DamageInfo(SpellNonMeleeDamage spellNonMeleeDamage, DamageEffectType damageType, WeaponAttackType attackType, ProcFlagsHit hitMask)
        {
            m_attacker   = spellNonMeleeDamage.attacker;
            m_victim     = spellNonMeleeDamage.target;
            m_damage     = spellNonMeleeDamage.damage;
            m_spellInfo  = spellNonMeleeDamage.Spell;
            m_schoolMask = spellNonMeleeDamage.schoolMask;
            m_damageType = damageType;
            m_attackType = attackType;
            m_absorb     = spellNonMeleeDamage.absorb;
            m_resist     = spellNonMeleeDamage.resist;
            m_block      = spellNonMeleeDamage.blocked;
            m_hitMask    = hitMask;

            if (spellNonMeleeDamage.blocked != 0)
            {
                m_hitMask |= ProcFlagsHit.Block;
            }
            if (spellNonMeleeDamage.absorb != 0)
            {
                m_hitMask |= ProcFlagsHit.Absorb;
            }
        }