C++ (Cpp) DoCast Examples

C++ (Cpp) DoCast - 30 examples found. These are the top rated real world C++ (Cpp) examples of DoCast extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
        void UpdateAI(const uint32 diff)
        {
            violet_hold_trashAI::UpdateAI(diff);
            npc_escortAI::UpdateAI(diff);

            if (!UpdateVictim())
                return;

            if (!TacticalBlinkCasted)
            {
                if (uiTacticalBlinkTimer <= diff)
                {
                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true);
                    if (target)
                        DoCast(target, SPELL_TACTICAL_BLINK);
                    uiTacticalBlinkTimer = 6000;
                    TacticalBlinkCasted = true;
                } else uiTacticalBlinkTimer -= diff;
            }

            else
            {
                if (uiBackstabTimer <= diff)
                {
                    Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 10, true);
                    DoCast(target, SPELL_BACKSTAB);
                    TacticalBlinkCasted = false;
                    uiBackstabTimer =1300;
                } else uiBackstabTimer -= diff;
            }

            DoMeleeAttackIfReady();
        }
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
            return;

        //SinisterStrike_Timer
        if (SinisterStrike_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_SINISTERSTRIKE);
            SinisterStrike_Timer = 7000;
        } else SinisterStrike_Timer -= diff;

        //BackStab_Timer
        if (BackStab_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_BACKSTAB);
            BackStab_Timer = 6000;
        } else BackStab_Timer -= diff;

        //Gouge_Timer
        if (Gouge_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_GOUGE);
            Gouge_Timer = 8000;
        } else Gouge_Timer -= diff;

        DoMeleeAttackIfReady();
    }
        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;

            if (uiOldWoundsTimer <= uiDiff)
            {
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM,0))
                {
                    if (pTarget && pTarget->isAlive())
                        DoCast(pTarget, SPELL_OLD_WOUNDS);
                }
                uiOldWoundsTimer = 23000;
            } else uiOldWoundsTimer -= uiDiff;

            if (uiWakingNightmare <= uiDiff)
            {
                DoCast(me, SPELL_WAKING_NIGHTMARE);
                uiWakingNightmare = 15000;
            } else uiWakingNightmare -= uiDiff;

            if (uiShadowsPastTimer <= uiDiff)
            {
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM,1))
                {
                    if (pTarget && pTarget->isAlive())
                        DoCast(pTarget,SPELL_SHADOWS_PAST);
                }
                uiShadowsPastTimer = 20000;
            } else uiShadowsPastTimer -= uiDiff;

            DoMeleeAttackIfReady();
        }
Example #4
0
    void UpdateAI(const uint32 uiDiff)
    {
        npc_escortAI::UpdateAI(uiDiff);
        if (!me->getVictim())
            return;

        if (m_uiChainLightningTimer <= uiDiff)
        {
            DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING);
            m_uiChainLightningTimer = urand(7000, 14000);
        }
        else
            m_uiChainLightningTimer -= uiDiff;

        if (me->GetHealth()*100 < me->GetMaxHealth()*30)
        {
            if (m_uiHealTimer <= uiDiff)
            {
                DoCast(me, SPELL_HEALING_WAVE);
                m_uiHealTimer = 5000;
            }
            else
                m_uiHealTimer -= uiDiff;
        }

        if (m_uiFrostShockTimer <= uiDiff)
        {
            DoCast(me->getVictim(), SPELL_FROST_SHOCK);
            m_uiFrostShockTimer = urand(7500, 15000);
        }
        else
            m_uiFrostShockTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!UpdateVictim())
            return;

        //Frostbolt
        if (Frostbolt_Timer < diff)
        {
            if (rand()%100 < 90)
                DoCast(m_creature->getVictim(),SPELL_FROSTBOLT);
            Frostbolt_Timer = 3500;
        } else Frostbolt_Timer -= diff;

        //IceTomb
        if (IceTomb_Timer < diff)
        {
            if (rand()%100 < 65)
                DoCast(m_creature->getVictim(),SPELL_ICETOMB);
            IceTomb_Timer = 28000;
        } else IceTomb_Timer -= diff;

        //DrainLife
        if (DrainLife_Timer < diff)
        {
            if (rand()%100 < 55)
                DoCast(m_creature->getVictim(),SPELL_DRAINLIFE);
            DrainLife_Timer = 31000;
        } else DrainLife_Timer -= diff;

        DoMeleeAttackIfReady();
    }
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            events.Update(diff);

            if (me->HasUnitState(UNIT_STAT_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_SKULL_CRACK:
                    DoCast(me->getVictim(), SPELL_SKULL_CRACK);
                    events.RescheduleEvent(SPELL_DRAGON_BREATH, 3000);
                    return;
                case EVENT_FIRE_BLAST:
                    if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0))
                        DoCast(target, SPELL_FIRE_BLAST);
                    events.RescheduleEvent(EVENT_FIRE_BLAST, 2000);
                    return;
                }
            }

            DoMeleeAttackIfReady();
        }