void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch (stage) 
        {
            case 0:
            {
                bsw->timedCast(SPELL_FEROCIOUS_BUTT, uiDiff);
                bsw->timedCast(SPELL_ARCTIC_BREATH, uiDiff);
                bsw->timedCast(SPELL_WHIRL, uiDiff);
                if (bsw->timedQuery(SPELL_MASSIVE_CRASH, uiDiff)) stage = 1;
                bsw->timedCast(SPELL_FROTHING_RAGE, uiDiff);
                DoMeleeAttackIfReady();
                break;
            }
            case 1:
            {
                 if (bsw->doCast(SPELL_MASSIVE_CRASH) == CAST_OK)
                     stage = 2;
                 break;
            }
            case 2:
            {
                if (pTarget = bsw->SelectUnit())
                {
                    TrampleCasted = false;
                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    stage = 3;
                    bsw->resetTimer(SPELL_TRAMPLE);
                    DoScriptText(-1713506,m_creature,pTarget);
                    SetCombatMovement(false);
                    m_creature->GetMotionMaster()->MoveIdle();
                }
                break;
            }
            case 3:
            {
                if (bsw->timedQuery(SPELL_TRAMPLE,uiDiff))
                {
                    pTarget->GetPosition(fPosX, fPosY, fPosZ);
                    TrampleCasted = false;
                    MovementStarted = true;
                    m_creature->GetMotionMaster()->MovePoint(1, fPosX, fPosY, fPosZ);
                    DoScriptText(-1713508,m_creature);
                    bsw->doCast(SPELL_ADRENALINE);
                    stage = 4;
                }
                break;
            }
            case 4:
            {
                if (MovementStarted)
                {
                    Map* pMap = m_creature->GetMap();
                    Map::PlayerList const &lPlayers = pMap->GetPlayers();
                    for(Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
                    {
                        Unit* pPlayer = itr->getSource();
                        if (!pPlayer) continue;
                        if (pPlayer->isAlive() && pPlayer->IsWithinDistInMap(m_creature, 5.0f))
                        {
                            bsw->doCast(SPELL_TRAMPLE, pPlayer);
                            TrampleCasted = true;
                            MovementStarted = false;
                            m_creature->GetMotionMaster()->MovementExpired();
                            m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                        }
                    }

                } else stage = 5;
                if (TrampleCasted) stage = 5;
                break;
            }
            case 5:
            {
                if (!TrampleCasted)
                {
                    bsw->doCast(SPELL_STAGGERED_DAZE);
                    DoScriptText(-1713507,m_creature);
                }
                MovementStarted = false;
                m_creature->GetMotionMaster()->MovementExpired();
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                SetCombatMovement(true);
                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                stage = 0;
                break;
            }
        }
    }
Ejemplo n.º 2
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (m_pInstance && !Unit::GetCreature((*me), m_pInstance->GetData64(NPC_ACIDMAW)))
            this->JustReachedHome();

        if (!UpdateVictim())
            return;

        switch (stage) 
        {
        case 0: {
                bsw->timedCast(SPELL_BURNING_BITE, uiDiff);

                bsw->timedCast(SPELL_MOLTEN_SPEW, uiDiff);

                bsw->timedCast(SPELL_FIRE_SPIT, uiDiff);

                bsw->timedCast(SPELL_BURNING_SPRAY, uiDiff);

                bsw->timedCast(SPELL_SWEEP_0, uiDiff);

                if (m_pInstance->GetData(TYPE_NORTHREND_BEASTS) == DREADSCALE_SUBMERGED)
                     stage = 1;

                    break;}
        case 1: {
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    bsw->doCast(SPELL_SUBMERGE_0);
                    stage = 2;
                    DoScriptText(-1713557,me);
                    m_pInstance->SetData(TYPE_NORTHREND_BEASTS, DREADSCALE_SUBMERGED);
                    break;}
        case 2: {
                if (bsw->timedQuery(SPELL_SLIME_POOL, uiDiff))
                    bsw->doCast(NPC_SLIME_POOL);

                if (bsw->timedQuery(SPELL_SUBMERGE_0, uiDiff) && m_pInstance->GetData(TYPE_NORTHREND_BEASTS) == DREADSCALE_SUBMERGED) 
                         stage = 3;
                    break;}
        case 3: {
                    DoScriptText(-1713559,me);
                    bsw->doRemove(SPELL_SUBMERGE_0);

                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    bsw->resetTimer(SPELL_SLIME_POOL);
                    stage = 0;
                    m_pInstance->SetData(TYPE_NORTHREND_BEASTS, ACIDMAW_SUBMERGED);
                    break;}
        }

        if (m_pInstance->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged)
                        {
                        DoScriptText(-1713559,me);
                        bsw->doRemove(SPELL_SUBMERGE_0);
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                        bsw->doCast(SPELL_ENRAGE);
                        enraged = true;
                        stage = 0;
                        DoScriptText(-1713504,me);
                        };

        DoMeleeAttackIfReady();
    }