示例#1
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target or casting
        if (!UpdateVictim() || m_creature->IsNonMeleeSpellCasted(false))
            return;

        // Sonic Boom
        if (SonicBoom)
        {
            DoCast(m_creature, SPELL_SONIC_BOOM_EFFECT, true);
            SonicBoomEffect();

            SonicBoom = false;
            Resonance_Timer = 1500;
        }
        if (SonicBoom_Timer <= diff)
        {
            DoScriptText(EMOTE_SONIC_BOOM, m_creature);
            DoCast(m_creature, SPELL_SONIC_BOOM_CAST);
            SonicBoom_Timer = 30000;
            SonicBoom = true;
            return;
        } else SonicBoom_Timer -= diff;

        // Murmur's Touch
        if (MurmursTouch_Timer <= diff)
        {
            if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,80,true))
                DoCast(pTarget, SPELL_MURMURS_TOUCH);
            MurmursTouch_Timer = 25000 + rand()%10000;
        } else MurmursTouch_Timer -= diff;

        // Resonance
        if (!SonicBoom && !(m_creature->IsWithinMeleeRange(m_creature->getVictim())))
        {
            if (Resonance_Timer <= diff)
            {
                DoCast(m_creature, SPELL_RESONANCE);
                Resonance_Timer = 5000;
            } else Resonance_Timer -= diff;
        }

        // Magnetic Pull
        if (MagneticPull_Timer <= diff)
        {
            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                if (pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive())
                {
                    DoCast(pTarget, SPELL_MAGNETIC_PULL);
                    MagneticPull_Timer = 15000+rand()%15000;
                    return;
                }
            MagneticPull_Timer = 500;
        } else MagneticPull_Timer -= diff;

        if (!RegularMode)
        {
            // Thundering Storm
            if (ThunderingStorm_Timer <= diff)
            {
                std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
                for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
                    if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()))
                        if (pTarget->isAlive() && !m_creature->IsWithinDist(pTarget, 35, false))
                            DoCast(pTarget, SPELL_THUNDERING_STORM, true);
                ThunderingStorm_Timer = 15000;
            } else ThunderingStorm_Timer -= diff;

            // Sonic Shock
            if (SonicShock_Timer <= diff)
            {
                if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,20,false))
                    if (pTarget->isAlive())
                        DoCast(pTarget, SPELL_SONIC_SHOCK);
                SonicShock_Timer = 10000+rand()%10000;
            } else SonicShock_Timer -= diff;
        }

        // Select nearest most aggro target if top aggro too far
        if (!m_creature->isAttackReady())
            return;
        if (!m_creature->IsWithinMeleeRange(m_creature->getVictim()))
        {
            std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
            for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
                if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()))
                    if (pTarget->isAlive() && m_creature->IsWithinMeleeRange(pTarget))
                    {
                        m_creature->TauntApply(pTarget);
                        break;
                    }
        }

        DoMeleeAttackIfReady();
    }
示例#2
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        //SonicBoom_Timer
        if (SonicBoom_Timer < diff)
        {
            if (CanSonicBoom)
            {
                DoCastSpellIfCan(m_creature, SPELL_SONIC_BOOM_CAST, CAST_TRIGGERED);
                SonicBoomEffect();

                CanSonicBoom = false;
                SonicBoom_Timer = 30000;
            }
            else
            {
                DoScriptText(EMOTE_SONIC_BOOM, m_creature);
                DoCastSpellIfCan(m_creature,SPELL_SONIC_BOOM_PRE);
                CanSonicBoom = true;
                SonicBoom_Timer = 5000;
            }
        }else SonicBoom_Timer -= diff;

        //MurmursTouch_Timer
        if (MurmursTouch_Timer < diff)
        {
            /*Unit* target = NULL;
            target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0);
            if (target)
                DoCastSpellIfCan(target, SPELL_MURMURS_TOUCH);*/
            DoCastSpellIfCan(m_creature, SPELL_MURMURS_TOUCH);
            MurmursTouch_Timer = urand(25000, 35000);
        }else MurmursTouch_Timer -= diff;

        //Resonance_Timer
        if (!CanSonicBoom && !m_creature->CanReachWithMeleeAttack(m_creature->getVictim()))
        {
            if (Resonance_Timer < diff)
            {
                DoCastSpellIfCan(m_creature->getVictim(), SPELL_RESONANCE);
                Resonance_Timer = m_bIsRegularMode ? 5000 : 3000;
            }else Resonance_Timer -= diff;
        }

        if (!m_bIsRegularMode)
        {
            if (SonicShock_Timer < diff)
            {
                if (Unit *target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                    DoCastSpellIfCan(target, SPELL_SONIC_SHOCK);
                SonicShock_Timer = urand(8000, 12000);
            }else SonicShock_Timer -= diff;

            if (ThunderingStorm_Timer < diff)
            {
                DoCastSpellIfCan(m_creature->getVictim(), SPELL_THUNDERING_STORM);
                ThunderingStorm_Timer = 12000;
            }else ThunderingStorm_Timer -= diff;
        }

        //MagneticPull_Timer
        if (MagneticPull_Timer < diff)
        {
            if (!CanShockWave)
            {
                if (Unit* temp = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0))
                {
                    if (temp->GetTypeId() == TYPEID_PLAYER)
                    {
                        DoCastSpellIfCan(temp, SPELL_MAGNETIC_PULL);
                        m_playerTargetGuid = temp->GetObjectGuid();
                        CanShockWave = true;
                    }
                    MagneticPull_Timer = 2500;
                }
            }
            else
            {
                if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerTargetGuid))
                    pPlayer->CastSpell(pPlayer, SPELL_SHOCKWAVE, true);

                MagneticPull_Timer = urand(15000, 30000);
                CanShockWave = false;
                m_playerTargetGuid.Clear();
            }
        }else MagneticPull_Timer -= diff;

        //no meele if preparing for sonic boom
        if (!CanSonicBoom)
            DoMeleeAttackIfReady();
    }
示例#3
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        //SonicBoom_Timer
        if (SonicBoom_Timer < diff)
        {
            if (CanSonicBoom)
            {
                DoCast(m_creature, SPELL_SONIC_BOOM_CAST,true);
                SonicBoomEffect();

                CanSonicBoom = false;
                SonicBoom_Timer = 30000;
            }
            else
            {
                DoScriptText(EMOTE_SONIC_BOOM, m_creature);
                DoCast(m_creature,SPELL_SONIC_BOOM_PRE);
                CanSonicBoom = true;
                SonicBoom_Timer = 5000;
            }
        }else SonicBoom_Timer -= diff;

        //MurmursTouch_Timer
        if (MurmursTouch_Timer < diff)
        {
            /*Unit* target = NULL;
            target = SelectUnit(SELECT_TARGET_RANDOM,0);
            if (target)
                DoCast(target, SPELL_MURMURS_TOUCH);*/
            DoCast(m_creature, SPELL_MURMURS_TOUCH);
            MurmursTouch_Timer = urand(25000, 35000);
        }else MurmursTouch_Timer -= diff;

        //Resonance_Timer
        if (!CanSonicBoom && !m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
        {
            if (Resonance_Timer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_RESONANCE);
                Resonance_Timer = m_bIsRegularMode ? 5000 : 3000;
            }else Resonance_Timer -= diff;
        }

        if (!m_bIsRegularMode)
        {
            if (SonicShock_Timer < diff)
            {
                if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0))
                    DoCast(target, SPELL_SONIC_SHOCK);
                SonicShock_Timer = urand(8000, 12000);
            }else SonicShock_Timer -= diff;

            if (ThunderingStorm_Timer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_THUNDERING_STORM);
                ThunderingStorm_Timer = 12000;
            }else ThunderingStorm_Timer -= diff;
        }

        //MagneticPull_Timer
        if (MagneticPull_Timer < diff)
        {
            if (!CanShockWave)
            {
                if (Unit* temp = SelectUnit(SELECT_TARGET_RANDOM,0))
                {
                    if (temp->GetTypeId() == TYPEID_PLAYER)
                    {
                        DoCast(temp, SPELL_MAGNETIC_PULL);
                        pTarget = temp->GetGUID();
                        CanShockWave = true;
                    }
                    MagneticPull_Timer = 2500;
                }
            }
            else
            {
                if (Unit* target = Unit::GetUnit(*m_creature,pTarget))
                    target->CastSpell(target,SPELL_SHOCKWAVE,true);

                MagneticPull_Timer = urand(15000, 30000);
                CanShockWave = false;
                pTarget = 0;
            }
        }else MagneticPull_Timer -= diff;

        //no meele if preparing for sonic boom
        if (!CanSonicBoom)
            DoMeleeAttackIfReady();
    }
示例#4
0
        void UpdateAI(uint32 diff)
        {
            //Return since we have no target or casting
            if (!UpdateVictim() || me->IsNonMeleeSpellCasted(false))
                return;

            // Sonic Boom
            if (SonicBoom)
            {
                DoCast(me, SPELL_SONIC_BOOM_EFFECT, true);
                SonicBoomEffect();

                SonicBoom = false;
                Resonance_Timer = 1500;
            }
            if (SonicBoom_Timer <= diff)
            {
                Talk(EMOTE_SONIC_BOOM);
                DoCast(me, SPELL_SONIC_BOOM_CAST);
                SonicBoom_Timer = 30000;
                SonicBoom = true;
                return;
            } else SonicBoom_Timer -= diff;

            // Murmur's Touch
            if (MurmursTouch_Timer <= diff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80, true))
                    DoCast(target, SPELL_MURMURS_TOUCH);
                MurmursTouch_Timer = urand(25000, 35000);
            } else MurmursTouch_Timer -= diff;

            // Resonance
            if (!SonicBoom && !(me->IsWithinMeleeRange(me->GetVictim())))
            {
                if (Resonance_Timer <= diff)
                {
                    DoCast(me, SPELL_RESONANCE);
                    Resonance_Timer = 5000;
                } else Resonance_Timer -= diff;
            }

            // Magnetic Pull
            if (MagneticPull_Timer <= diff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                    if (target->GetTypeId() == TYPEID_PLAYER && target->IsAlive())
                    {
                        DoCast(target, SPELL_MAGNETIC_PULL);
                        MagneticPull_Timer = 15000+rand()%15000;
                        return;
                    }
                MagneticPull_Timer = 500;
            } else MagneticPull_Timer -= diff;

            if (IsHeroic())
            {
                // Thundering Storm
                if (ThunderingStorm_Timer <= diff)
                {
                    ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
                    for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
                        if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid()))
                            if (target->IsAlive() && !me->IsWithinDist(target, 35, false))
                                DoCast(target, SPELL_THUNDERING_STORM, true);
                    ThunderingStorm_Timer = 15000;
                } else ThunderingStorm_Timer -= diff;

                // Sonic Shock
                if (SonicShock_Timer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20, false))
                        if (target->IsAlive())
                            DoCast(target, SPELL_SONIC_SHOCK);
                    SonicShock_Timer = 10000+rand()%10000;
                } else SonicShock_Timer -= diff;
            }

            // Select nearest most aggro target if top aggro too far
            if (!me->isAttackReady())
                return;
            if (!me->IsWithinMeleeRange(me->GetVictim()))
            {
                ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
                for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
                    if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid()))
                        if (target->IsAlive() && me->IsWithinMeleeRange(target))
                        {
                            me->TauntApply(target);
                            break;
                        }
            }

            DoMeleeAttackIfReady();
        }