示例#1
0
    void UpdateAI(const uint32 diff)
    {

        if(!pInstance) return;

        if (!pet) 
        {
            if (Creature* pGuard = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_STINKY)))
                if (!pGuard->isAlive())
                {
                     pet = true;
                     if (pInstance->GetData(TYPE_STINKY) == NOT_STARTED)
                     {
                         DoScriptText(-1631209,m_creature);
                         pInstance->SetData(TYPE_STINKY,DONE);
                     }
                }
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        Creature* pBlightTarget = m_creature->GetMap()->GetCreature(blightTargetGUID);

        switch(getStage())
        {
            case 0:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT_2, diff))
                        setStage(1);
                    break;
            case 1:
                    switch (urand(0,2)) 
                    {
                        case 0:  DoScriptText(-1631210,m_creature); break;
                        case 1:  DoScriptText(-1631211,m_creature); break;
                        case 2:  DoScriptText(-1631212,m_creature); break;
                    }
                    doCast(SPELL_INHALE_BLIGHT);
                    setStage(2);
                    break;
            case 2:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doRemove(SPELL_GASEOUS_BLIGHT_1);
                        doRemove(SPELL_BLIGHT_VISUAL_1,pBlightTarget);
                        doRemove(SPELL_BLIGHT_VISUAL_1,m_creature);
                        doCast(SPELL_GASEOUS_BLIGHT_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    setStage(3);
                    break;
            case 3:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT_3, diff))
                        setStage(4);
                    break;
            case 4:
                    switch (urand(0,2))
                    {
                        case 0:  DoScriptText(-1631210,m_creature); break;
                        case 1:  DoScriptText(-1631211,m_creature); break;
                        case 2:  DoScriptText(-1631212,m_creature); break;
                    }
                    doCast(SPELL_INHALE_BLIGHT);
                    setStage(5);
                    break;
            case 5:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doRemove(SPELL_GASEOUS_BLIGHT_2);
                        doRemove(SPELL_BLIGHT_VISUAL_2,pBlightTarget);
                        doRemove(SPELL_BLIGHT_VISUAL_2,m_creature);
                        doCast(SPELL_GASEOUS_BLIGHT_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    setStage(6);
                    break;
            case 6:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT_3, diff))
                        setStage(7);
                    break;
            case 7:
                    switch (urand(0,2)) 
                    {
                        case 0:  DoScriptText(-1631210,m_creature); break;
                        case 1:  DoScriptText(-1631211,m_creature); break;
                        case 2:  DoScriptText(-1631212,m_creature); break;
                    }
                    doCast(SPELL_INHALE_BLIGHT);
                    setStage(8);
                    break;
            case 8:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doRemove(SPELL_GASEOUS_BLIGHT_3);
                        doRemove(SPELL_BLIGHT_VISUAL_3,pBlightTarget);
                        doRemove(SPELL_BLIGHT_VISUAL_3,m_creature);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    setStage(9);
                    break;
            case 9:
                    if (timedQuery(SPELL_PUNGENT_BLIGHT, diff))
                    {
                        DoScriptText(-1631208,m_creature);
                        doCast(SPELL_PUNGENT_BLIGHT);
                        setStage(10);
                    }
                    break;
            case 10:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doCast(SPELL_BLIGHT_VISUAL_1,pBlightTarget);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    m_creature->RemoveAurasDueToSpell(SPELL_INHALED_BLIGHT);
                    setStage(0);
                    break;
        }


        timedCast(SPELL_GAS_SPORE, diff);

        timedCast(SPELL_GASTRIC_BLOAT, diff);

        if (auraCount(SPELL_GASTRIC_BLOAT,m_creature->getVictim(),EFFECT_INDEX_1) > 9)
        {
            m_creature->getVictim()->RemoveAurasDueToSpell(SPELL_GASTRIC_BLOAT);
            doCast(SPELL_GASTRIC_EXPLOSION,m_creature->getVictim());
        };

        if (timedQuery(SPELL_VILE_GAS, diff))
        {
                       float fPosX, fPosY, fPosZ;
                       m_creature->GetPosition(fPosX, fPosY, fPosZ);
                       m_creature->GetRandomPoint(fPosX, fPosY, fPosZ, 30.0f, fPosX, fPosY, fPosZ);
                       if (Unit* pTemp = doSummon(NPC_VILE_GAS_STALKER,fPosX, fPosY, fPosZ))
                            doCast(SPELL_VILE_GAS, pTemp);
                       DoScriptText(-1631213,m_creature);
        };

        if (timedQuery(SPELL_BERSERK, diff))
        {
            doCast(SPELL_BERSERK);
            DoScriptText(-1631207,m_creature);
        };

        DoMeleeAttackIfReady();
    }
示例#2
0
    void UpdateAI(const uint32 diff)
    {

        if(!pInstance) return;

        if (!pet) {
                  if (Creature* pGuard = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(NPC_STINKY)))
                                if (!pGuard->isAlive())  {
                                                         pet = true;
                                                         DoScriptText(-1631209,m_creature);
                                                         }
                            }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch(stage)
        {
            case 0: 
                    if (timedQuery(SPELL_GASEOUS_BLIGHT, diff))
                        {
                            doCast(SPELL_GASEOUS_BLIGHT);
                            stage = 1;
                        }
                    break;
            case 1:
                    switch (urand(0,2)) {
                            case 0:  DoScriptText(-1631210,m_creature); break;
                            case 1:  DoScriptText(-1631211,m_creature); break;
                            case 2:  DoScriptText(-1631212,m_creature); break;
                            }
                        doCast(SPELL_INHALE_BLIGHT);
                        stage = 2;
                    break;
            case 2:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT, diff))
                        {
                            doCast(SPELL_GASEOUS_BLIGHT);
                            stage = 3;
                        }
                    break;
            case 3:
                    switch (urand(0,2)) {
                            case 0:  DoScriptText(-1631210,m_creature); break;
                            case 1:  DoScriptText(-1631211,m_creature); break;
                            case 2:  DoScriptText(-1631212,m_creature); break;
                            }
                        doCast(SPELL_INHALE_BLIGHT);
                        stage = 4;
                    break;
            case 4:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT, diff))
                        {
                            doCast(SPELL_GASEOUS_BLIGHT);
                            stage = 5;
                        }
                    break;
            case 5:
                    switch (urand(0,2)) {
                            case 0:  DoScriptText(-1631210,m_creature); break;
                            case 1:  DoScriptText(-1631211,m_creature); break;
                            case 2:  DoScriptText(-1631212,m_creature); break;
                            }
                        doCast(SPELL_INHALE_BLIGHT);
                        stage = 6;
                    break;
            case 6:
                    if (timedQuery(SPELL_PUNGENT_BLIGHT, diff))
                        {
                            DoScriptText(-1631208,m_creature);
                            doCast(SPELL_PUNGENT_BLIGHT);
                            stage = 7;
                        }
                    break;
            case 7:
                    switch (urand(0,2)) {
                            case 0:  DoScriptText(-1631210,m_creature); break;
                            case 1:  DoScriptText(-1631211,m_creature); break;
                            case 2:  DoScriptText(-1631212,m_creature); break;
                            }
                        m_creature->RemoveAurasDueToSpell(SPELL_INHALED_BLIGHT);
                        stage = 0;
                    break;
        }

        doTriggerUnoculated();

        timedCast(SPELL_GAS_SPORE, diff);

        doSearchSpored();

        timedCast(SPELL_GASTRIC_BLOAT, diff);

        if (auraCount(SPELL_GASTRIC_BLOAT,m_creature->getVictim(),EFFECT_INDEX_1) > 9)
        {
            doCast(SPELL_GASTRIC_EXPLOSION,m_creature->getVictim());
            m_creature->getVictim()->RemoveAurasDueToSpell(SPELL_GASTRIC_BLOAT);
        }

        if (timedQuery(SPELL_VILE_GAS, diff)) {
//                        if (Unit* pTemp = doSummon(NPC_VILE_GAS_STALKER))
                            doCast(SPELL_VILE_GAS);
                        DoScriptText(-1631213,m_creature);
                        };

        if (timedQuery(SPELL_BERSERK, diff)){
                 doCast(SPELL_BERSERK);
                 DoScriptText(-1631207,m_creature);
                 };

        DoMeleeAttackIfReady();
    }