Exemplo n.º 1
0
        void UpdateAI(uint32 diff)
        {
            if (!UpdateVictim())
            {
                if (phase == PHASE_FLIGHT && !me->IsInEvadeMode())
                    EnterEvadeMode();
                return;
            }

            events.Update(diff);

            if (me->IsNonMeleeSpellCasted(false))
                return;

            if (phase == PHASE_GROUND)
            {
                switch (events.ExecuteEvent())
                {
                    case EVENT_BERSERK:
                        Talk(YELL_BERSERK);
                        DoCast(me, SPELL_BERSERK, true);
                        events.ScheduleEvent(EVENT_BERSERK, 10000);
                        break;
                    case EVENT_CLEAVE:
                        DoCast(me->GetVictim(), SPELL_CLEAVE, false);
                        events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000));
                        break;
                    case EVENT_CORROSION:
                        DoCast(me->GetVictim(), SPELL_CORROSION, false);
                        events.ScheduleEvent(EVENT_CORROSION, urand(20000, 30000));
                        break;
                    case EVENT_GAS_NOVA:
                        DoCast(me, SPELL_GAS_NOVA, false);
                        events.ScheduleEvent(EVENT_GAS_NOVA, urand(20000, 25000));
                        break;
                    case EVENT_ENCAPSULATE:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true))
                            DoCast(target, SPELL_ENCAPSULATE_CHANNEL, false);
                        events.ScheduleEvent(EVENT_ENCAPSULATE, urand(25000, 30000));
                        break;
                    case EVENT_FLIGHT:
                        EnterPhase(PHASE_FLIGHT);
                        break;
                    default:
                        DoMeleeAttackIfReady();
                        break;
                }
            }

            if (phase == PHASE_FLIGHT)
            {
                switch (events.ExecuteEvent())
                {
                    case EVENT_BERSERK:
                        Talk(YELL_BERSERK);
                        DoCast(me, SPELL_BERSERK, true);
                        break;
                    case EVENT_FLIGHT_SEQUENCE:
                        HandleFlightSequence();
                        break;
                    case EVENT_SUMMON_FOG:
                        {
                            float x, y, z;
                            me->GetPosition(x, y, z);
                            me->UpdateGroundPositionZ(x, y, z);
                            if (Creature* Fog = me->SummonCreature(MOB_VAPOR_TRAIL, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 10000))
                            {
                                Fog->RemoveAurasDueToSpell(SPELL_TRAIL_TRIGGER);
                                Fog->CastSpell(Fog, SPELL_FOG_TRIGGER, true);
                                me->CastSpell(Fog, SPELL_FOG_FORCE, true);
                            }
                        }
                        events.ScheduleEvent(EVENT_SUMMON_FOG, 1000);
                        break;
                }
            }
        }
Exemplo n.º 2
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostilTarget() && !m_creature->getVictim())
        {
            if(Phase == PHASE_FLIGHT && !m_creature->IsInEvadeMode())
                EnterEvadeMode();
            return;
        }

        Event = EVENT_NULL;
        for(uint32 i = 1; i <= MaxTimer[Phase]; i++)
        {
            if(Timer[i])
                if(Timer[i] <= diff)
                {
                    if(!Event)
                        Event = (EventFelmyst)i;
                }else Timer[i] -= diff;
        }

        if(m_creature->IsNonMeleeSpellCasted(false))
            return;

        if(Phase == PHASE_GROUND)
        {
            switch(Event)
            {
            case EVENT_BERSERK:
                DoYell(YELL_BERSERK, LANG_UNIVERSAL, NULL);
                DoPlaySoundToSet(m_creature, SOUND_BERSERK);
                m_creature->CastSpell(m_creature, SPELL_BERSERK, true);
                Timer[EVENT_BERSERK] = 0;
                break;
            case EVENT_CLEAVE:
                m_creature->CastSpell(m_creature->getVictim(), SPELL_CLEAVE, false);
                Timer[EVENT_CLEAVE] = 5000 + rand()%5 * 1000;
                break;
            case EVENT_CORROSION:
                m_creature->CastSpell(m_creature->getVictim(), SPELL_CORROSION, false);
                Timer[EVENT_CORROSION] = 20000 + rand()%10 * 1000;
                break;
            case EVENT_GAS_NOVA:
                m_creature->CastSpell(m_creature, SPELL_GAS_NOVA, false);
                Timer[EVENT_GAS_NOVA] = 20000 + rand()%5 * 1000;
                break;
            case EVENT_ENCAPSULATE:
                if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
                {
                    m_creature->CastSpell(target, SPELL_ENCAPSULATE_CHANNEL, false);
                    target->CastSpell(target, SPELL_ENCAPSULATE_EFFECT, true);// linked aura, need core patch to remove this hack
                    Timer[EVENT_ENCAPSULATE] = 25000 + rand()%5 * 1000;
                }break;
            case EVENT_FLIGHT:
                EnterPhase(PHASE_FLIGHT);
                break;
            default:
                DoMeleeAttackIfReady();
                break;
            }
        }

        if(Phase == PHASE_FLIGHT)
        {
            switch(Event)
            {
            case EVENT_BERSERK:
                DoYell(YELL_BERSERK, LANG_UNIVERSAL, NULL);
                DoPlaySoundToSet(m_creature, SOUND_BERSERK);
                m_creature->CastSpell(m_creature, SPELL_BERSERK, true);
                Timer[EVENT_BERSERK] = 0;
                break;
            case EVENT_FLIGHT_SEQUENCE:
                HandleFlightSequence();
                break;
            case EVENT_SUMMON_FOG:
                {
                    float x, y, z;
                    m_creature->GetPosition(x, y, z);
                    m_creature->UpdateGroundPositionZ(x, y, z);
                    if(Creature *Fog = m_creature->SummonCreature(MOB_VAPOR_TRAIL, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 10000))
                    {
                        Fog->RemoveAurasDueToSpell(SPELL_TRAIL_TRIGGER);
                        Fog->CastSpell(Fog, SPELL_FOG_TRIGGER, true);
                    }
                }
                Timer[EVENT_SUMMON_FOG] = 1000;
                break;
            default:
                break;
            }
        }
    }
Exemplo n.º 3
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
        {
            if (events.IsInPhase(PHASE_FLIGHT) && !me->IsInEvadeMode())
                EnterEvadeMode();
            return;
        }

        if (me->IsNonMeleeSpellCast(false))
            return;

        events.Update(diff);

        switch (events.ExecuteEvent())
        {
            case EVENT_BERSERK:
                if (!me->HasAura(SPELL_BERSERK))
                {
                    DoScriptText(YELL_BERSERK, me);
                    DoCast(me, SPELL_BERSERK, true);
                }
                events.ScheduleEvent(EVENT_BERSERK, 10000);
                break;
            case EVENT_CLEAVE:
                DoCastVictim( SPELL_CLEAVE, false);
                events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000), 0, PHASE_GROUND);
                break;
            case EVENT_CORROSION:
                DoCastVictim( SPELL_CORROSION, false);
                events.ScheduleEvent(EVENT_CORROSION, urand(20000, 30000), 0, PHASE_GROUND);
                break;
            case EVENT_GAS_NOVA:
                DoCast(me, SPELL_GAS_NOVA, false);
                events.ScheduleEvent(EVENT_GAS_NOVA, urand(21000, 26000), 0, PHASE_GROUND);
                break;
            case EVENT_ENCAPSULATE:
                if (Unit* encapsTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150.0f, true))
                    DoCast(encapsTarget, SPELL_ENCAPSULATE_CHANNEL, false);

                if (Unit* tank = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 150.0f, true))
                    me->SetTarget(tank->GetGUID());

                events.ScheduleEvent(EVENT_ENCAPSULATE, 33000, 0, PHASE_GROUND);
                break;
            case EVENT_DEMONIC_VAPOR:
                DoCast(me, SPELL_VAPOR_SELECT, true);

                demonicCount++;

                if (demonicCount < 2)
                    events.ScheduleEvent(EVENT_DEMONIC_VAPOR, 11000, 0, PHASE_FLIGHT);
                else
                    events.CancelEvent(EVENT_DEMONIC_VAPOR);

                break;
            case EVENT_FLIGHT:
                EnterPhase(PHASE_FLIGHT);
                break;
            case EVENT_FOG_CORRUPTION:
                if (!fogactivated)
                {
                    events.CancelEvent(EVENT_FOG_CORRUPTION);
                    break;
                }

                if (pInstance)
                {
                    switch (chosenLane)
                    {
                        case 0:
                            pInstance->SetData((direction ? DATA_ACTIVATE_SOUTH_TO_LEFT : DATA_ACTIVATE_SOUTH_TO_RIGHT), (uint32) me->GetPositionY());
                            break;
                        case 1:
                            pInstance->SetData((direction ? DATA_ACTIVATE_CENTER_TO_LEFT : DATA_ACTIVATE_CENTER_TO_RIGHT), (uint32) me->GetPositionY());
                            break;
                        case 2:
                            pInstance->SetData((direction ? DATA_ACTIVATE_NORTH_TO_LEFT : DATA_ACTIVATE_NORTH_TO_RIGHT), (uint32) me->GetPositionY());
                            break;
                    }
                }
                events.ScheduleEvent(EVENT_FOG_CORRUPTION, 50, 0, PHASE_FLIGHT);
                break;
            default:
                if (events.IsInPhase(PHASE_GROUND))
                    DoMeleeAttackIfReady();
                else if (events.IsInPhase(PHASE_FLIGHT))
                {
                    if (uiFlightTimer)
                    {
                        if (uiFlightTimer <= diff)
                        {
                            uiFlightTimer = 0;
                            HandleFlightSequence();
                        }
                        else
                            uiFlightTimer -= diff;
                    }
                }
                break;
        }
    }
Exemplo n.º 4
0
        void UpdateAI(const uint32 diff)
        {
            if(!me->IsVisible())
            {
                if(pInstance && pInstance->GetData(DATA_BRUTALLUS_EVENT) == DONE)
                    me->SetVisible(true);
            }

            //if (Phase != PHASE_FLIGHT && !UpdateVictim())
            //{
            //    //if(Phase == PHASE_FLIGHT && !me->IsInEvadeMode())
            //    //    EnterEvadeMode();
            //    return;
            //}

            Event = EVENT_NULL;
            for(int i = 1; i <= MaxTimer[Phase]; i++)
            {
                if (Timer[i])
                    if(Timer[i] <= diff)
                    {
                        if(Event == EVENT_NULL)
                            Event = (EventFelmyst)i;
                    }else Timer[i] -= diff;
            }

            if(Phase == PHASE_GROUND)
            {
                if(!UpdateVictim())
                    return;

                switch(Event)
                {
                case EVENT_BERSERK:
                    DoScriptText(YELL_BERSERK, me);
                    me->CastSpell(me, SPELL_BERSERK, true);
                    Timer[EVENT_BERSERK] = 10000;
                    break;
                case EVENT_CLEAVE:
                    me->CastSpell(me->getVictim(), SPELL_CLEAVE, false);
                    Timer[EVENT_CLEAVE] = 5000 + rand()%5 * 1000;
                    break;
                case EVENT_CORROSION:
                    if(!me->IsNonMeleeSpellCasted(false))
                    {
                        me->CastSpell(me->getVictim(), SPELL_CORROSION, false);
                        Timer[EVENT_CORROSION] = 20000 + rand()%10 * 1000;
                    }
                    break;
                case EVENT_GAS_NOVA:
                    if(!me->IsNonMeleeSpellCasted(false))
                    {
                        me->CastSpell(me, SPELL_GAS_NOVA, false);
                        Timer[EVENT_GAS_NOVA] = 20000 + rand()%5 * 1000;
                    }
                    break;
                case EVENT_ENCAPSULATE:
                    if(!me->IsNonMeleeSpellCasted(false))
                    {
                        if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true))
                        {
                            me->CastSpell(target, SPELL_ENCAPSULATE_CHANNEL, false);
                            Timer[EVENT_ENCAPSULATE] = 25000 + rand()%5 * 1000;
                        }
                    }
                    break;
                case EVENT_FLIGHT:
                    EnterPhase(PHASE_FLIGHT);
                    break;
                default:
                    DoMeleeAttackIfReady();
                    break;
                }
            }

            if(Phase == PHASE_FLIGHT)
            {
                switch(Event)
                {
                case EVENT_BERSERK:
                    DoScriptText(YELL_BERSERK, me);
                    me->CastSpell(me, SPELL_BERSERK, true);
                    Timer[EVENT_BERSERK] = 0;
                    break;
                case EVENT_FLIGHT_SEQUENCE:
                    HandleFlightSequence();
                    break;
                case EVENT_SUMMON_FOG:
                    {
                        float x, y, z;
                        me->GetPosition(x, y, z);
                        me->UpdateGroundPositionZ(x, y, z);
                        if(Creature *Fog = me->SummonCreature(MOB_VAPOR_TRAIL, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 10000))
                        {
                            Fog->setFaction(14);
                            Fog->RemoveAurasDueToSpell(SPELL_TRAIL_TRIGGER);
                            Fog->CastSpell(Fog, SPELL_FOG_TRIGGER, true);
                        }
                    }
                    Timer[EVENT_SUMMON_FOG] = 1000;
                    break;
                default:
                    break;
                }
            }
        }