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

            if (m_creature->GetHealthPercent() < 50.0f)
                timedCast(SPELL_Icebound_Fortitude, diff);

            timedCast(SPELL_Chains_of_Ice, diff);

            timedCast(SPELL_Death_Coil, diff);

            if (Unit *target = SelectEnemyCaster(false))
                timedCast(SPELL_Strangulate, diff, target);

            timedCast(SPELL_Frost_Strike, diff);

            timedCast(SPELL_Icy_Touch, diff);

            if (m_creature->IsInRange(m_creature->getVictim(), 10.0f, 30.0f, false))
                timedCast(SPELL_Death_Grip, diff); 

        boss_faction_championsAI::UpdateAI(diff);
    }
    void UpdateAI(const uint32 diff)
    {

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

        switch(stage)
        {
            case 0: 

                    if (timedQuery(SPELL_TWILIGHT_BLOODBOLT, diff)) 
                        bloodbolts = 1;

                    if (timedQuery(SPELL_DELRIOUS_SLASH, diff))
                        if (Unit* pTarget= m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,1))
                            doCast(SPELL_DELRIOUS_SLASH, pTarget);

                    timedCast(SPELL_PACT_OF_DARKFALLEN, diff);

                    timedCast(SPELL_SWARMING_SHADOWS, diff);

                    if (timedQuery(SPELL_VAMPIRIC_BITE,diff))
                    {
                       switch (urand(0,1)) 
                       {
                           case 0:
                                  DoScriptText(-1631322,m_creature);
                                  break;
                           case 1:
                                  DoScriptText(-1631323,m_creature);
                                  break;
                       }
                       doCast(SPELL_VAMPIRIC_BITE);
                    }

                    if (timedQuery(SPELL_BLOODBOLT_WHIRL,diff) && m_creature->GetHealthPercent() > 10.0f)
                    {
                        stage = 1;
                    };

                    DoMeleeAttackIfReady();

                    break;
            case 1:             // Go in fly phase
                    m_creature->AttackStop();
                    SetCombatMovement(false);
                    StartMovement(1);
                    m_creature->SetUInt32Value(UNIT_FIELD_BYTES_0, 50331648);
                    m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 50331648);
                    m_creature->AddSplineFlag(SPLINEFLAG_FLYING);
                    stage = 2;
                    break;
            case 2:
                    if (movementstarted) 
                        return;
                    DoScriptText(-1631327,m_creature);
                    doCast(SPELL_BLOODBOLT_WHIRL);
                    stage = 3;
                    return;
            case 3:
                    if (m_creature->IsNonMeleeSpellCasted(false))
                        return;
                    if (timedQuery(SPELL_TWILIGHT_BLOODBOLT,diff) || m_creature->GetHealthPercent() < 10.0f)
                    {
                        stage = 4;
//                        DoScriptText(-1631325,m_creature);
                        bloodbolts = 3;
                    };
                    break;
            case 4:             // Go in grownd phase
                    m_creature->AttackStop();
                    m_creature->SetUInt32Value(UNIT_FIELD_BYTES_0, 0);
                    m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                    m_creature->RemoveSplineFlag(SPLINEFLAG_FLYING);
                    StartMovement(0);
                    stage = 5;
                    break;
            case 5:
                    if (movementstarted) return;
                    DoScriptText(-1631325,m_creature);
                    stage = 0;
                    SetCombatMovement(true);
                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                    return;
            default:
                    break;
        }

        if (bloodbolts > 0)
        {
            doCast(SPELL_TWILIGHT_BLOODBOLT);
            --bloodbolts;
        };

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

    }
Example #3
0
    void UpdateAI(const uint32 diff)
    {

        if(!pInstance) return;

        if (!pet)
        {
            if (Creature* pGuard = pInstance->GetSingleCreatureFromStorage(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 (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();
    }
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch(stage)
        {
            case 0: {
                timedCast(SPELL_POUND, uiDiff);
                timedCast(SPELL_COLD, uiDiff);
                if (timedQuery(SUMMON_BORROWER, uiDiff)) {
                        doCast(SUMMON_BORROWER);
                        DoScriptText(-1713556,m_creature);
                        };
                if (timedQuery(SPELL_SUBMERGE_0, uiDiff)) stage = 1;

                    break;}
            case 1: {
                    doCast(SPELL_SUBMERGE_0);
                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    stage = 2;
                    DoScriptText(-1713557,m_creature);
                    break;}
            case 2: {
                    if (timedQuery(SPELL_SPIKE_CALL, uiDiff)) {
                         pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0);
//                         doCast(SPELL_SPIKE_CALL);
//                         This summon not supported in database. Temporary override.
                         Unit* spike = doSummon(NPC_SPIKE,TEMPSUMMON_TIMED_DESPAWN,60000);
                         if (spike) { spike->AddThreat(pTarget, 1000.0f);
                                      DoScriptText(-1713558,m_creature,pTarget);
                                      doCast(SPELL_MARK,pTarget);
                                      spike->GetMotionMaster()->MoveChase(pTarget);
                                     }
                         };
                    if (timedQuery(SPELL_SUMMON_BEATLES, uiDiff)) {
                            doCast(SPELL_SUMMON_BEATLES);
                            doCast(SUMMON_SCARAB);
                            DoScriptText(-1713560,m_creature);
                         };
                    if (timedQuery(SPELL_SUBMERGE_0, uiDiff)) stage = 3;
                    break;}
            case 3: {
                    stage = 0;
                    DoScriptText(-1713559,m_creature);
                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    doRemove(SPELL_SUBMERGE_0,m_creature);
                    break;}
            case 4: {
                            doCast(SPELL_LEECHING_SWARM);
                            DoScriptText(-1713561,m_creature);
                    stage = 5;
                    break;}
            case 5: {
                        timedCast(SPELL_POUND, uiDiff);
                        timedCast(SPELL_COLD, uiDiff);
                        break;}

        }
        timedCast(SUMMON_FROSTSPHERE, uiDiff);

        timedCast(SPELL_BERSERK, uiDiff);

        if (m_creature->GetHealthPercent() < 30.0f && stage == 0) stage = 4;

        DoMeleeAttackIfReady();
    }
Example #5
0
    void UpdateAI(const uint32 diff)
    {

        if(!pInstance) return;

        if (pInstance->GetData(TYPE_EVENT_NPC) == NPC_LICH_KING)
        {
            UpdateTimer = pInstance->GetData(TYPE_EVENT_TIMER);
            if (UpdateTimer <= diff)
            {
            debug_log("EventMGR: creature %u received signal %u ",m_creature->GetEntry(),pInstance->GetData(TYPE_EVENT));
            switch (pInstance->GetData(TYPE_EVENT))
                {
                case 12000:
                          m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STAND);
                          m_creature->SetStandState(UNIT_STAND_STATE_STAND);
                          StartMovement(0,12020);
                          break;
                case 12020:
                          m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK);
                          DoScriptText(-1631501, m_creature);
                          UpdateTimer = 12000;
                          pInstance->SetData(TYPE_EVENT,12030);
                          break;
                case 12040:
                          m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
                          DoScriptText(-1631503, m_creature);
                          UpdateTimer = 8000;
                          pInstance->SetData(TYPE_EVENT,12041);
                          break;
                case 12041:
                          m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_LAUGH);
                          UpdateTimer = 3000;
                          pInstance->SetData(TYPE_EVENT,12042);
                          break;
                case 12042:
                          m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_ONESHOT_POINT_NOSHEATHE);
                          UpdateTimer = 2000;
                          pInstance->SetData(TYPE_EVENT,12043);
                          break;
                case 12043:
                          m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_ONESHOT_NONE);
                          UpdateTimer = 10000;
                          pInstance->SetData(TYPE_EVENT,12050);
                          break;
                case 12060:
                          m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK);
                          DoScriptText(-1631505, m_creature);
                          UpdateTimer = 10000;
                          pInstance->SetData(TYPE_EVENT,12080);
                          break;
                case 12080:
                          m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_STATE_READY2H);
                          UpdateTimer = 2000;
                          pInstance->SetData(TYPE_EVENT,12100);
                          break;
                case 12100:
                          m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_ONESHOT_NONE);
                          UpdateTimer = 6000;
                          pInstance->SetData(TYPE_EVENT,12120);
                          break;
                case 12120:
                          m_creature->GetMotionMaster()->Clear();
                          m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                          SetCombatMovement(true);
                          m_creature->SetInCombatWithZone();
                          battlestarted = true;
                          pInstance->SetData(TYPE_EVENT,12200);
                          UpdateTimer = 10000;
                          break;
                case 12200:
                          DoScriptText(-1631506, m_creature);
                          UpdateTimer = 5000;
                          pInstance->SetData(TYPE_EVENT,12220);
                          break;
                case 13000:
                          m_creature->SetOrientation(3.1146f);
                          DoScriptText(-1631507, m_creature);
                          UpdateTimer = 12000;
                          finalphase = true;
                          doCast(SPELL_FURY_OF_FROSTMOURNE);
                          pInstance->SetData(TYPE_EVENT,13020);
                          if (pTirion = pInstance->GetSingleCreatureFromStorage(NPC_TIRION)) 
                          {
                              m_creature->SetInCombatWith(pTirion);
                              pTirion->AddThreat(m_creature, 1000.0f);
                          }
                          m_creature->SetInCombatWithZone();
                          break;
                case 13020:
                          DoScriptText(-1631508, m_creature);
                          UpdateTimer = 12000;
                          pInstance->SetData(TYPE_EVENT,13060);
                          break;
                case 13060:
                          DoScriptText(-1631509, m_creature);
                          UpdateTimer = 15000;
                          pInstance->SetData(TYPE_EVENT,13100);
                          break;
                case 13100:
                          DoScriptText(-1631510, m_creature);
                          UpdateTimer = 15000;
                          pInstance->SetData(TYPE_EVENT,13110);
                          doCast(SPELL_CHANNEL_KING);
                          break;
                case 13120:
                          DoScriptText(-1631511, m_creature);
                          UpdateTimer = 12000;
                          pInstance->SetData(TYPE_EVENT,13130);
                          break;
                case 13140:
                          UpdateTimer = 6000;
                          doRemove(SPELL_CHANNEL_KING);
                          pInstance->SetData(TYPE_EVENT,13150);
                          m_creature->CastSpell(m_creature, SPELL_SUMMON_BROKEN_FROSTMOURNE, false);
                          break;
                case 13160:
                          UpdateTimer = 6000;
                          pInstance->SetData(TYPE_EVENT,13170);
                          m_creature->CastSpell(m_creature, SPELL_SUMMON_BROKEN_FROSTMOURNE_2, false);
                          break;
                case 13180:
                          UpdateTimer = 12000;
                          pInstance->SetData(TYPE_EVENT,13190);
                          if (pFrostmourne = m_creature->SummonCreature(NPC_FROSTMOURNE_HOLDER, SpawnLoc[7].x, SpawnLoc[7].y, SpawnLoc[7].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 5000))
                             {
                                 pFrostmourne->CastSpell(pFrostmourne, SPELL_BROKEN_FROSTMOURNE, false);
                                 pFrostmourne->CastSpell(pFrostmourne, SPELL_FROSTMOURNE_TRIGGER, false);
                                 pFrostmourne->GetMotionMaster()->MoveChase(m_creature);
                                 m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED);
                             }
                          break;
                case 13200:
                          DoScriptText(-1631512, m_creature);
                          m_creature->RemoveAurasDueToSpell(SPELL_SUMMON_BROKEN_FROSTMOURNE);
                          m_creature->RemoveAllAuras();
                          pFrostmourne->RemoveAurasDueToSpell(SPELL_FROSTMOURNE_TRIGGER);
                          UpdateTimer = 5000;
                          pInstance->SetData(TYPE_EVENT,13210);
                          break;
                case 13280:
                          UpdateTimer = 2000;
                          pInstance->SetData(TYPE_EVENT,13290);
                          stage = 13;
                          if (pFrostmourne) pFrostmourne->ForcedDespawn();
                          if (Creature* pTemp = pInstance->GetSingleCreatureFromStorage(NPC_FROSTMOURNE_TRIGGER))
                             pTemp->ForcedDespawn();
                          if (Creature* pTemp = pInstance->GetSingleCreatureFromStorage(NPC_FROSTMOURNE_HOLDER))
                             pTemp->ForcedDespawn();
                          SetCombatMovement(true);
                          battlestarted = true;
                          break;
                default:
                          break;
                }
             } else UpdateTimer -= diff;
             pInstance->SetData(TYPE_EVENT_TIMER, UpdateTimer);
        }

        if (battlestarted && !m_creature->SelectHostileTarget() && !finalphase)
        {
            battlestarted = false;
            pInstance->SetData(TYPE_LICH_KING, FAIL);
            pInstance->SetData(TYPE_EVENT,0);
            EnterEvadeMode();
            return;
        }

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

        switch(stage)
        {
            case 0:           // Phase 1
//                    timedCast(SPELL_SHOCKWAVE, diff);
                    timedCast(SPELL_INFEST, diff);
                    timedCast(SPELL_SUMMON_DRUDGE_GHOULS, diff);
                    timedCast(SPELL_PLAGUE_SIPHON, diff);
                    timedCast(SPELL_SUMMON_SHAMBLING_HORROR, diff);
                    timedCast(SPELL_NECROTIC_PLAGUE, diff);

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

                    if (m_creature->GetHealthPercent() < 70.0f) 
                       {
                            stage = 1;
                            DoScriptText(-1631515,m_creature);
                       }
                    break;
            case 1:             // Go in transition phase
                    m_creature->AttackStop();
                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    SetCombatMovement(false);
                    StartMovement(1,0);
                    stage = 2;
                    break;
            case 2:
                    if (movementstarted) return;
                    doCast(SPELL_REMORSELESS_WINTER);
                    stage = 3;
                    break;
            case 3:
                    timedCast(SPELL_SUMMON_RAGING_SPIRIT, diff);
                    timedCast(SPELL_SUMMON_ICE_SPHERE, diff);
                    timedCast(SPELL_PAIN_AND_SUFFERING, diff);

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

                    if (timedQuery(SPELL_REMORSELESS_WINTER, diff))
                       {
                            doCast(SPELL_QUAKE);
                            stage = 4;
                            DoScriptText(-1631524, m_creature);
                            pInstance->DoOpenDoor(pInstance->GetData64(GO_SNOW_EDGE));
                       };
                    break;
            case 4:           // Platform destruct
                    if (timedQuery(SPELL_QUAKE, diff))
                       {
                            pInstance->DoOpenDoor(pInstance->GetData64(GO_ICESHARD_1));
                            pInstance->DoOpenDoor(pInstance->GetData64(GO_ICESHARD_2));
                            pInstance->DoOpenDoor(pInstance->GetData64(GO_ICESHARD_3));
                            pInstance->DoOpenDoor(pInstance->GetData64(GO_ICESHARD_4));
                            if (GameObject* pGoFloor = pInstance->GetSingleGameObjectFromStorage(GO_ARTHAS_PLATFORM))
                            {
                                 pGoFloor->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN);
                                 oldflag = pGoFloor->GetUInt32Value(GAMEOBJECT_BYTES_1);
                                 pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,8449);
                            }
                            pInstance->DoCloseDoor(pInstance->GetData64(GO_FROSTY_WIND));
                            pInstance->DoCloseDoor(pInstance->GetData64(GO_SNOW_EDGE));
                            m_creature->GetMotionMaster()->Clear();
                            m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                            m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            SetCombatMovement(true);
                            stage = 5;
                       }
                    break;
            case 5:           // Phase 2

                    if (timedQuery(SPELL_SPAWN_DEFILE, diff)) 
                       {
                            doCast(SPELL_SPAWN_DEFILE);
                            DoScriptText(-1631531,m_creature);
                       }
                    if (timedQuery(SPELL_SUMMON_VALKYR, diff)) 
                       {
                            doCast(SPELL_SUMMON_VALKYR);
                            DoScriptText(-1631527,m_creature);
                       }

                    timedCast(SPELL_SOUL_REAPER, diff);
                    timedCast(SPELL_INFEST, diff);

                    DoMeleeAttackIfReady();

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

                    if (m_creature->GetHealthPercent() < 40.0f) 
                       {
                            stage = 6;
                            DoScriptText(-1631523,m_creature);
                       }
                    break;
            case 6:           // Go in transition phase
                    m_creature->AttackStop();
                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    SetCombatMovement(false);
                    StartMovement(1,0);
                    stage = 7;
                    break;
            case 7:          // Platform restore
                    if (movementstarted) return;
                    if (GameObject* pGoFloor = pInstance->GetSingleGameObjectFromStorage(GO_ARTHAS_PLATFORM))
                    {
                        pGoFloor->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN);
                        pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,oldflag);
                    }
                    pInstance->DoOpenDoor(pInstance->GetData64(GO_FROSTY_WIND));
                    doCast(SPELL_REMORSELESS_WINTER);
                    stage = 8;
                    break;
            case 8:
                    timedCast(SPELL_SUMMON_RAGING_SPIRIT, diff);
                    timedCast(SPELL_SUMMON_ICE_SPHERE, diff);
                    timedCast(SPELL_PAIN_AND_SUFFERING, diff);

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

                    if (timedQuery(SPELL_REMORSELESS_WINTER, diff))
                       {
                            DoScriptText(-1631524, m_creature);
                            doCast(SPELL_SUMMON_VILE_SPIRITS);
                            for (uint8 i = 0; i < getSpellData(SPELL_SUMMON_VILE_SPIRITS); ++i)
                                 doCast(NPC_VILE_SPIRIT);
                            doCast(SPELL_QUAKE);
                            stage = 9;
                            pInstance->DoOpenDoor(pInstance->GetData64(GO_SNOW_EDGE));
                       };

                    break;
            case 9:           // Platform destruct
                    if (timedQuery(SPELL_QUAKE, diff))
                       {
                            if (GameObject* pGoFloor = pInstance->GetSingleGameObjectFromStorage(GO_ARTHAS_PLATFORM))
                            {
                                 pGoFloor->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN);
                                 oldflag = pGoFloor->GetUInt32Value(GAMEOBJECT_BYTES_1);
                                 pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,8449);
                            }
                            pInstance->DoCloseDoor(pInstance->GetData64(GO_SNOW_EDGE));
                            pInstance->DoCloseDoor(pInstance->GetData64(GO_FROSTY_WIND));
                            m_creature->GetMotionMaster()->Clear();
                            m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                            m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            SetCombatMovement(true);
                            stage = 10;
                       }
                   break;
            case 10:           // Phase 3
                    if (timedQuery(SPELL_SPAWN_DEFILE, diff)) 
                       {
                            doCast(SPELL_SPAWN_DEFILE);
//                            DoScriptText(-1631527,m_creature);
                       }
                    timedCast(SPELL_SOUL_REAPER, diff);

                    if (timedQuery(SPELL_HARVEST_SOUL, diff)) 
                       {
                            doCast(SPELL_HARVEST_SOUL);
                            DoScriptText(-1631520,m_creature);
                       }

                    timedCast(SPELL_SOUL_REAPER, diff);
                    timedCast(SPELL_INFEST, diff);

                    DoMeleeAttackIfReady();

                    if (m_creature->GetHealthPercent() < 10.0f) 
                       {
                            stage = 11;
                            DoScriptText(-1631513,m_creature);
                       }
                    break;
            case 11:           // Ending Phase start
                    m_creature->AttackStop();
                    SetCombatMovement(false);
                    StartMovement(6,13000);
                    stage = 12;
                    battlestarted = false;
                    break;
            case 12:
                    break;
            case 13:
                    DoMeleeAttackIfReady();
                    break;
        }
    }
Example #6
0
    void UpdateAI(const uint32 diff)
    {
        if (!pInstance)
            return;
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

//        doCast(SPELL_METEOR);
        timedCast(SPELL_METEOR_IMPACT_ZONE, diff);
        timedCast(SPELL_METEOR_LAND, diff);

        if (m_uiTimer < diff)
            {
            switch (urand(0,3)) 
            {
            case 0:
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[0][0], m_xflame[0][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[1][0], m_xflame[1][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[2][0], m_xflame[2][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[3][0], m_xflame[3][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[4][0], m_xflame[4][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[5][0], m_xflame[5][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[6][0], m_xflame[6][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[7][0], m_xflame[7][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[8][0], m_xflame[8][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[9][0], m_xflame[9][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[10][0], m_xflame[10][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[11][0], m_xflame[11][1], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  break;
             case 1:
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[0][2], m_xflame[0][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[1][2], m_xflame[1][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[2][2], m_xflame[2][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[3][2], m_xflame[3][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[4][2], m_xflame[4][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[5][2], m_xflame[5][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[6][2], m_xflame[6][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[7][2], m_xflame[7][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[8][2], m_xflame[8][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[9][2], m_xflame[9][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[10][2], m_xflame[10][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[11][2], m_xflame[11][3], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  break;
             case 2:
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[0][4], m_xflame[0][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[1][4], m_xflame[1][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[2][4], m_xflame[2][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[3][4], m_xflame[3][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[4][4], m_xflame[4][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[5][4], m_xflame[5][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[6][4], m_xflame[6][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[7][4], m_xflame[7][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[8][4], m_xflame[8][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[9][4], m_xflame[9][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[10][4], m_xflame[10][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[11][4], m_xflame[11][5], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  break;
             case 3:
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[0][6], m_xflame[0][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[1][6], m_xflame[1][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_0, m_xflame[2][6], m_xflame[2][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[3][6], m_xflame[3][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[4][6], m_xflame[4][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_1, m_xflame[5][6], m_xflame[5][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[6][6], m_xflame[6][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[7][6], m_xflame[7][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_2, m_xflame[8][6], m_xflame[8][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[9][6], m_xflame[9][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[10][6], m_xflame[10][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  m_creature->SummonCreature(NPC_METEORFLAME_3, m_xflame[11][6], m_xflame[11][7], 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 8000);
                  break;
             };
            m_uiTimer = 998000;
          } else  m_uiTimer -= diff;
     }
Example #7
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!pInstance)
            return;
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_creature->GetHealth() > pInstance->GetData(DATA_HEALTH_HALION_T) && pInstance->GetData(DATA_HEALTH_HALION_T) != 0)
            m_creature->SetHealth(pInstance->GetData(DATA_HEALTH_HALION_T));

        if (m_creature->GetHealthPercent() < 100.0f && p_phase == 0)
        {
            pInstance->SetData(TYPE_HALION_LOCK, DONE);
            p_phase = 1;
        }

        if (m_creature->GetHealthPercent() < 75.0f && p_phase == 1)
        {
            DoScriptText(-1666108,m_creature);
            p_phase = 2;
        }

        if (m_creature->GetHealthPercent() < 50.0f && p_phase == 2)
        {
            DoScriptText(-1666109,m_creature);
            p_phase = 3;
        }

        switch (p_phase)
        {
            case 0: //SPAWNED
                break;
            case 1: //PHASE 1 PHYSICAL REALM
                timedCast(SPELL_FLAME_BREATH_0, uiDiff);
                timedCast(SPELL_FIERY_COMBUSTION, uiDiff);
                /* Meteor Needs Test */
                if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
                {
                    if (doCast(SPELL_METEOR, pTarget) == CAST_OK)
                    {
                        DoScriptText(-1666106,m_creature,pTarget);
                        float fPosX, fPosY, fPosZ;
                        m_creature->GetPosition(fPosX, fPosY, fPosZ);
                        if (Unit* pMeteor = doSummon(NPC_METEOR_STRIKE, fPosX, fPosY, fPosZ))
                            pMeteor->AddThreat(pTarget, 100.0f);
                    };
                }
                break;
            case 2: //DEPHASE HALION FORCE TO TWILIGHT REALM
                //setflag unattackable, unselectable, remove combat
                break;
            case 3: //PHASE 3 BOTH REALMS
                timedCast(SPELL_FLAME_BREATH_0, uiDiff);
                timedCast(SPELL_FIERY_COMBUSTION, uiDiff);
                doCast(SPELL_TWILIGHT_DIVISION);
                /* Needs Script
                timedCast(SPELL_METEOR_STRIKE, uiDiff); 
                timedCast(SPELL_CORPREALITY_EVEN, uiDiff); 
                */
                break;
            default:
                break;
        }
        DoMeleeAttackIfReady();
    }
Example #8
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();
    }
Example #9
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch(m_uiStage)
        {
            case 0:
                timedCast(SPELL_POUND, uiDiff);
                timedCast(SPELL_COLD, uiDiff);

                if (m_uiBurrowTimer < uiDiff)
                {
                    m_uiBurrowTimer = 60000;
                    m_uiStage = 1;
                }
                else m_uiBurrowTimer -= uiDiff;

                break;
            case 1:
                doCast(SPELL_SUBMERGE_0);
                m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                m_uiStage = 2;
                DoScriptText(-1713557, m_creature);
                break;
            case 2:
                if (!m_bSpikeCalled)
                {
                    if (m_uiSpikeCallTimer < uiDiff)
                    {
                        if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                        {
//                          doCast(SPELL_SPIKE_CALL);
//                          This summon not supported in database. Temporary override.
                            if(m_pSpike = DoSpawnCreature(NPC_SPIKE, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000))
                            {
                                m_pSpike->SetInCombatWith(pTarget);
                                m_pSpike->AddThreat(pTarget, 100000.0f);
                                DoScriptText(-1713558, m_creature, pTarget);
                                doCast(SPELL_MARK, pTarget);
                                m_pSpike->GetMotionMaster()->MoveChase(pTarget);
                                m_bSpikeCalled = true;
                                m_uiSpikeCallTimer = 3000;
                            }
                        }
                    }
                    else m_uiSpikeCallTimer -= uiDiff;
                }
                if (timedQuery(SPELL_SUMMON_BEATLES, uiDiff))
                {
                    doCast(SPELL_SUMMON_BEATLES);
                    doCast(SUMMON_SCARAB);
                    DoScriptText(-1713560, m_creature);
                }

                if (m_uiBurrowTimer < uiDiff)
                {
                    m_uiBurrowTimer = 90000;
                    m_uiStage = 3;
                    m_bSpikeCalled = false;
                }
                else m_uiBurrowTimer -= uiDiff;

                break;
            case 3:
                m_uiStage = 0;
                DoScriptText(-1713559, m_creature);

                if (m_pSpike)
                {
                    m_pSpike->ForcedDespawn();
                    m_pSpike = NULL;
                }

                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                doRemove(SPELL_SUBMERGE_0, m_creature);
                break;
            case 4:
                doCast(SPELL_LEECHING_SWARM);
                DoScriptText(-1713561, m_creature);
                m_uiStage = 5;
                break;
            case 5:
                timedCast(SPELL_POUND, uiDiff);
                timedCast(SPELL_COLD, uiDiff);
                break;
        }

        if (m_uiBurrowerSummonTimer < uiDiff)
        {
            if (currentDifficulty >= RAID_DIFFICULTY_10MAN_HEROIC)
                SummonBurrower();
            else
            {
                if (m_uiStage != 5)
                {
                    SummonBurrower();
                }
            }
            DoScriptText(-1713556, m_creature);
            m_uiBurrowerSummonTimer = 65000;
        }
        else m_uiBurrowerSummonTimer -= uiDiff;

        if (m_uiBerserkTimer < uiDiff)
        {
            m_uiBerserkTimer = 600000;
            doCast(SPELL_BERSERK);
        }
        else m_uiBerserkTimer -= uiDiff;

        if (m_creature->GetHealthPercent() < 30.0f && m_uiStage == 0)
            m_uiStage = 4;

        DoMeleeAttackIfReady();
    }
Example #10
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch (getStage())
        {
            case 0: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);

                 if (m_uiEnrageTimer < diff)
                 {
                     if(DoCastSpellIfCan(m_creature, SPELL_ENRAGE) == CAST_OK)
                     {
                         m_uiEnrageTimer = urand(20000,30000);
                         DoScriptText(SAY_ENRAGE, m_creature);
                     }
                 }
                 else m_uiEnrageTimer -= diff;

                 if (m_uiFlyTimer < diff)
                 {
                     setStage(1);
                     m_uiFlyTimer = 50000;
                 }
                 else m_uiFlyTimer -= diff;
                 DoMeleeAttackIfReady();
                 break;

            case 1: //Air phase start
                 SetCombatMovement(false);
                 m_creature->InterruptNonMeleeSpells(true);
                 SetFly(true);
                 StartMovement(1);
                 setStage(2);
                 break;

            case 2: // Wait for movement
                 if (MovementStarted) return;
                 setStage(3);
                 break;

            case 3: // Beacons
                 doBeacon(true);
                 if (m_uiWaitTimer < diff)
                 {
                     setStage(4);
                     m_uiWaitTimer = 5000;
                 }
                 else m_uiWaitTimer -= diff;
                 break;

            case 4: // Conflagate
                 timedCast(SPELL_FLAME_BREATH, diff);
                 if (conflagated)
                     {
                         doBeacon(false);
                         doCast(SPELL_CONFLAGATION);
                         DoScriptText(SAY_SPECIAL, m_creature);
                         goLand = true;
                     };
                 if (goLand)
                     setStage(5);
                 break;

            case 5: //Air phase end
                 StartMovement(0);
                 setStage(6);
                 break;

            case 6: // Wait for movement
                 if (MovementStarted) return;
                 SetFly(false);
                 SetCombatMovement(true);
                 m_creature->GetMotionMaster()->Clear();
                 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                 setStage(0);
                 break;

            default:
                break;
        }
    }
Example #11
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_creature->GetHealth() > m_pInstance->GetData(DATA_HEALTH_FJOLA) &&
                                      m_pInstance->GetData(DATA_HEALTH_FJOLA) != 0)
                m_creature->SetHealth(m_pInstance->GetData(DATA_HEALTH_FJOLA));

        switch (stage)
        {
        case 0:
            timedCast(SPELL_TWIN_SPIKE_H, uiDiff);

            if (timedQuery(SPELL_DARK_TOUCH, uiDiff))
            {
                if (currentDifficulty == RAID_DIFFICULTY_25MAN_HEROIC || RAID_DIFFICULTY_10MAN_HEROIC)
                    if (Unit* pTarget = doSelectRandomPlayer(SPELL_DARK_ESSENCE, false, 50.0f))
                        doCast(SPELL_DARK_TOUCH, pTarget);
                doCast(NPC_UNLEASHED_DARK);
            }
            if (m_pInstance->GetData(DATA_CASTING_VALKYRS) == SPELL_NONE )
            {
                if (timedQuery(SPELL_DARK_VORTEX, uiDiff))
                {
                    m_pInstance->SetData(DATA_CASTING_VALKYRS, SPELL_DARK_VORTEX);
                    DoScriptText(-1713540,m_creature);
                    stage = 1;
                    break;
                }
                if (timedQuery(SPELL_TWIN_PACT_H, uiDiff)
                    && m_creature->GetHealthPercent() <= 50.0f)
                {
                    m_creature->InterruptNonMeleeSpells(true);
                    doCast(SPELL_SHIELD_DARK);
                    m_pInstance->SetData(DATA_CASTING_VALKYRS, SPELL_TWIN_PACT_H);
                    DoScriptText(-1713539,m_creature);
                    stage = 3;
                    break;
                }
            }
            if (m_pInstance->GetData(DATA_CASTING_VALKYRS) == SPELL_TWIN_PACT_L)
                if (!m_creature->HasAura(SPELL_TWIN_POWER)) 
                    doCast(SPELL_TWIN_POWER);
            break;
        case 1:
            doCast(SPELL_DARK_VORTEX);
            stage = 2;
            break;
        case 2:
            if (!m_creature->HasAura(SPELL_DARK_VORTEX)
                && timedQuery(SPELL_SHIELD_DARK, uiDiff)) 
            {
                m_pInstance->SetData(DATA_CASTING_VALKYRS, SPELL_NONE);
                stage = 0;
            }
            break;
        case 3:
            doCast(SPELL_TWIN_PACT_H);
            stage = 4;
            break;
        case 4:
            if (!m_creature->HasAura(SPELL_SHIELD_DARK)
                && timedQuery(SPELL_SHIELD_DARK, uiDiff)) 
            {
                m_pInstance->SetData(DATA_CASTING_VALKYRS, SPELL_NONE);
                stage = 0;
            };
        default:
            break;
        }

        timedCast(SPELL_BERSERK, uiDiff);

        DoMeleeAttackIfReady();
    }
Example #12
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch (getStage())
        {
            case 0: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);
                 timedCast(SPELL_ENRAGE, diff);
                 if ( m_creature->GetHealthPercent() <= 80.0f) setStage(1);
                 break;

            case 1: //Air phase start
                 SetCombatMovement(false);
                 m_creature->InterruptNonMeleeSpells(true);
                 SetFly(true);
                 doBeacon(true);
                 StartMovement(1);
                 setStage(2);
                 break;

            case 2: // Wait for movement
                 if (MovementStarted) return;
                 doCast(SPELL_CONFLAGATION);
                 DoScriptText(-1666404,m_creature);
                 setStage(3);
                 break;

            case 3: // Wait for cast finish
                 if (!m_creature->IsNonMeleeSpellCasted(false))
                 {
                     doBeacon(false);
                     setStage(4);
                 };
                 break;

            case 4: // Air phase
                 timedCast(SPELL_FLAME_BREATH, diff);
                 if (timedQuery(SPELL_BEACON, diff))
                     {
                         doBeacon(true);
                         doCast(SPELL_CONFLAGATION);
                     };
                 if (conflagated && timedQuery(SPELL_CONFLAGATION_1, diff))
                     {
                         doBeacon(false);
                     };
                 if ( m_creature->GetHealthPercent() <= 60.0f) setStage(5);
                 break;

            case 5: //Air phase end
                 StartMovement(0);
                 setStage(6);
                 break;

            case 6: // Wait for movement
                 if (MovementStarted) return;
                 SetFly(false);
                 SetCombatMovement(true);
                 m_creature->GetMotionMaster()->Clear();
                 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                 setStage(7);
                 break;

            case 7: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);
                 timedCast(SPELL_ENRAGE, diff);
                 if ( m_creature->GetHealthPercent() <= 40.0f) setStage(8);
                 break;

            case 8: //Air phase start
                 SetCombatMovement(false);
                 m_creature->InterruptNonMeleeSpells(true);
                 SetFly(true);
                 doBeacon(true);
                 StartMovement(1);
                 setStage(9);
                 break;

            case 9: // Wait for movement
                 if (MovementStarted) return;
                 doCast(SPELL_CONFLAGATION);
                 DoScriptText(-1666404,m_creature);
                 setStage(10);
                 break;

            case 10: // Wait for cast finish
                 if (!m_creature->IsNonMeleeSpellCasted(false))
                 {
                     doBeacon(false);
                     setStage(11);
                 };
                 break;

            case 11: // Air phase
                 timedCast(SPELL_FLAME_BREATH, diff);
                 if (timedQuery(SPELL_BEACON, diff))
                     {
                         doBeacon(true);
                         doCast(SPELL_CONFLAGATION);
                     };
                 if (conflagated && timedQuery(SPELL_CONFLAGATION_1, diff))
                     {
                         doBeacon(false);
                     };
                 if ( m_creature->GetHealthPercent() <= 20.0f) setStage(12);
                 break;

            case 12: //Air phase end
                 StartMovement(0);
                 setStage(13);
                 break;

            case 13: // Wait for movement
                 if (MovementStarted) return;
                 SetFly(false);
                 SetCombatMovement(true);
                 m_creature->GetMotionMaster()->Clear();
                 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                 setStage(14);
                 break;

            case 14: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);
                 timedCast(SPELL_ENRAGE, diff*2);
                 break;

            default:
                break;
        }

        DoMeleeAttackIfReady();
    }
Example #13
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch(stage)
        {
            case 0: 
                    if  (timedQuery(SPELL_CORRUPT_SOUL, diff))
                        {
                            if (Unit* pTarget= m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                                {
                                if (doCast(SPELL_CORRUPT_SOUL, pTarget) == CAST_OK)
                                    {
                                    DoScriptText(-1632006,m_creature,pTarget);
                                    float fPosX, fPosY, fPosZ;
                                    pTarget->GetPosition(fPosX, fPosY, fPosZ);
                                    doSummon(NPC_SOUL_FRAGMENT,fPosX, fPosY, fPosZ);
                                    }
                                }
                        }
                    break;
            case 1: 
                        if (timedCast(SPELL_TELEPORT, diff) == CAST_OK) stage = 2;
                    break;
            case 2:
                        if (timedCast(SPELL_SOULSTORM, diff) == CAST_OK) {
                               DoScriptText(-1632005,m_creature);
                               SetCombatMovement(false);
                               stage = 3;
                               }
                    break;
            case 3: 
                        timedCast(SPELL_FEAR, diff);
                    break;
        }

        timedCast(SPELL_SHADOW_BOLT, diff);

        timedCast(SPELL_MAGIC_BANE, diff);

        if (m_creature->GetHealthPercent() <= 30.0f && stage == 0) stage = 1;

        DoMeleeAttackIfReady();

        if (BattleMusicTimer < diff && m_creature->isAlive())
        {
           switch(Music)
           {
             case 0:
                m_creature->PlayDirectSound(Battle01);
                BattleMusicTimer = 49000;
                break;
             case 1:
                m_creature->PlayDirectSound(Battle02);
                BattleMusicTimer = 28000;
                break;
             case 2:
                m_creature->PlayDirectSound(Battle03);
                BattleMusicTimer = 37000;
                break; 
            }
        } else BattleMusicTimer -= diff;
    }
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (!m_creature->HasAura(SPELL_BLOOD_POWER))
            doCast(SPELL_BLOOD_POWER);

        switch (stage)
        {
            case 0:
                    if (m_creature->GetHealthPercent() <= 30.0f) stage = 1;
                    break;

            case 1: 
                        doCast(SPELL_FRENZY);
                        stage = 2;
                        DoScriptText(-1631101,m_creature);
                    break;

            case 2:
                    break;

            default:
                    break;
        }

            if (timedQuery(SPELL_MARK, diff))
            {
                if (Unit* pTarget = doSelectRandomPlayer(SPELL_MARK,false,120.0f))
                   if (doCast(SPELL_MARK, pTarget) == CAST_OK) 
                       doBloodPower();
            }

            if (timedCast(SPELL_BLOOD_NOVA, diff) == CAST_OK) doBloodPower();

            if (timedCast(SPELL_BOILING_BLOOD, diff) == CAST_OK) doBloodPower();

            if (timedCast(SPELL_RUNE_OF_BLOOD, diff) == CAST_OK) doBloodPower();

            if (timedQuery(SPELL_CALL_BLOOD_BEASTS, diff))
                    {
                        if (currentDifficulty == RAID_DIFFICULTY_25MAN_NORMAL
                            || currentDifficulty == RAID_DIFFICULTY_25MAN_HEROIC) beasts = 4;
                            else beasts = 2;

                        DoScriptText(-1631102,m_creature);
                     };

                     if (beasts > 0)
                        if (doCast(SPELL_CALL_BLOOD_BEASTS) == CAST_OK)
                           {
                               doBloodPower();
                               --beasts;
                           };

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

        DoMeleeAttackIfReady();
    }
Example #15
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!pInstance) return;

        if (!inCombat && !m_creature->IsNonMeleeSpellCasted(false))
        {
            if (Creature *pDummyTarget = pInstance->GetSingleCreatureFromStorage(NPC_BALTHARUS_TARGET))
                timedCast(SPELL_CHANNEL_SPELL, uiDiff, pDummyTarget);
        }

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

        switch (getStage())
        {
            case 0:
                 if ( m_creature->GetHealthPercent() <= 66.0f) setStage(1);
                 break;

            case 1:
                 m_creature->InterruptNonMeleeSpells(true);
                 if (is25())
                     doCast(SPELL_SUMMON_CLONE);
                   //  DoScriptText(SAY_BALTHARUS_SPECIAL_1,m_creature);
                 setStage(2);
                 break;

            case 2:
                 if (m_creature->IsNonMeleeSpellCasted(false)) return;
                 doCast(SPELL_REPELLING_WAVE);
                 setStage(3);

            case 3:
                 if ( m_creature->GetHealthPercent() <= 50.0f) setStage(4);
                 break;

            case 4:
                 m_creature->InterruptNonMeleeSpells(true);
                 if (!is25())
                        doCast(SPELL_SUMMON_CLONE);
                        DoScriptText(SAY_BALTHARUS_SPECIAL_1,m_creature);
                 setStage(5);
                 break;

            case 5:
                 if (m_creature->IsNonMeleeSpellCasted(false)) return;
                 doCast(SPELL_REPELLING_WAVE);
                 setStage(6);

            case 6:
                 if ( m_creature->GetHealthPercent() <= 33.0f) setStage(7);
                 break;

            case 7:
                 m_creature->InterruptNonMeleeSpells(true);
                 if (is25())
                     doCast(SPELL_SUMMON_CLONE);
                  //   DoScriptText(SAY_BALTHARUS_SPECIAL_1,m_creature);
                 setStage(8);
                 break;

            case 8:
                 if (m_creature->IsNonMeleeSpellCasted(false)) return;
                 doCast(SPELL_REPELLING_WAVE);
                 setStage(9);

            case 9:
            default:
                 break;
        }

        timedCast(SPELL_BLADE_TEMPEST, uiDiff);
        timedCast(SPELL_ENERVATING_BRAND, uiDiff);
        timedCast(SPELL_SABER_LASH, uiDiff);

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

        switch(getStage())
        {
            case 0: 
                    if (timedQuery(SPELL_BONE_STRIKE, diff))
                        if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f))
                            if (doCast(SPELL_BONE_STRIKE, pTarget) == CAST_OK)
                            {
                                doSummonSpike(pTarget);
                                switch (urand(0,1)) {
                                                   case 0:
                                                   DoScriptText(-1631003,m_creature,pTarget);
                                                   break;
                                                   case 1:
                                                   DoScriptText(-1631004,m_creature,pTarget);
                                                   break;
                                                   case 2:
                                                   DoScriptText(-1631005,m_creature,pTarget);
                                                   break;
                                                   };

                            };

                    if (timedQuery(SPELL_BONE_STORM, diff)) setStage(1);

                    if (timedQuery(SPELL_CALL_COLD_FLAME, diff))
                    {
                        if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
                            else  doCast(SPELL_CALL_COLD_FLAME_1);

                        if (m_creature->GetHealthPercent() <= 30.0f)
                        {
                            if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
                                else  doCast(SPELL_CALL_COLD_FLAME_1);
                        }
                    }

                    timedCast(SPELL_SABER_LASH, diff);

                    DoMeleeAttackIfReady();

                    break;
            case 1:
                    m_creature->InterruptNonMeleeSpells(true);
                    doCast(SPELL_BONE_STORM);
                    setStage(2);
                    DoScriptText(-1631002,m_creature);
                    DoResetThreat();
                    m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
                    m_creature->SetSpeedRate(MOVE_RUN, 3);
                    m_creature->SetSpeedRate(MOVE_WALK, 3);
                    break;
            case 2:
                    if (!m_creature->IsNonMeleeSpellCasted(false)) setStage(3);
                    break;
            case 3:
                    if (isHeroic())
                        if (timedQuery(SPELL_BONE_STRIKE, diff, true))
                            if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f))
                                doSummonSpike(pTarget);

                    if (timedQuery(SPELL_CALL_COLD_FLAME, diff, true)
                        && m_creature->IsWithinDistInMap(m_creature->getVictim(),2.0f))
                    {
                        pInstance->SetData(DATA_DIRECTION, (uint32)(1000*2.0f*M_PI_F*((float)urand(1,16)/16.0f)));
//                        if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
//                            else  doCast(SPELL_CALL_COLD_FLAME_1);
                        float fPosX, fPosY, fPosZ;
                        m_creature->GetPosition(fPosX, fPosY, fPosZ);
                        doSummon(NPC_COLD_FLAME, fPosX, fPosY, fPosZ);
                        DoResetThreat();
                        if (Unit* pTarget = doSelectRandomPlayerAtRange(60.0f))
                            AttackStart(pTarget);
                    }
                    if (!hasAura(SPELL_BONE_STORM_STRIKE, m_creature) && !hasAura(SPELL_BONE_STORM, m_creature)) setStage(4);
                    break;
            case 4:
                    pInstance->SetData(DATA_DIRECTION, 0);
                    m_creature->SetSpeedRate(MOVE_RUN, 1);
                    m_creature->SetSpeedRate(MOVE_WALK, 1);
//                    m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);
                    setStage(0);
                    break;
            default:
                    break;
            }

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


    }
Example #17
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!pInstance)
            return;

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

        switch (getStage())
        {
            case 0: //PHASE 1 PHYSICAL REALM
                timedCast(SPELL_FLAME_BREATH, uiDiff);
                timedCast(SPELL_FIERY_COMBUSTION, uiDiff);
                timedCast(SPELL_METEOR, uiDiff);
                if (m_creature->GetHealthPercent() < 75.0f) setStage(1);
                break;

            case 1: // Switch to phase 2
                m_creature->AttackStop();
                m_creature->InterruptNonMeleeSpells(true);
                DoScriptText(-1666108,m_creature);
                pInstance->SetData(TYPE_HALION_EVENT, NOT_STARTED);
                SetCombatMovement(false);
                StartMovement(0);
                {
                    Creature* pControl = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_HALION_CONTROL));
                    if (!pControl)
                        pControl = m_creature->SummonCreature(NPC_HALION_CONTROL, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 1000);
                    else if (!pControl->isAlive())
                        pControl->Respawn();
                    pControl->SetActiveObjectState(true);
                    pControl->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    m_creature->SetInCombatWith(pControl);
                    pControl->SetInCombatWith(m_creature);
                }
                setStage(2);
                break;

            case 2:
                if (MovementStarted) return;
                doCast(SPELL_SUMMON_TWILIGHT_PORTAL);
                setStage(3);
                if (GameObject* pGoPortal = pInstance->instance->GetGameObject(pInstance->GetData64(GO_HALION_PORTAL_1)))
                      pGoPortal->SetPhaseMask(31,true);
                if (GameObject* pGoRing = pInstance->instance->GetGameObject(pInstance->GetData64(GO_FLAME_RING)))
                      pGoRing->SetPhaseMask(65535,true);
                break;

            case 3:
                if (m_creature->IsNonMeleeSpellCasted(false)) return;
                m_creature->SetActiveObjectState(true);
                doCast(SPELL_START_PHASE2);
                setStage(4);
                break;

            case 4:
                if (!m_creature->IsNonMeleeSpellCasted(false))
                {
                    if (Creature* pControl = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_HALION_CONTROL)))
                    {
                        m_creature->SetInCombatWith(pControl);
                        pControl->SetInCombatWith(m_creature);
                    }
                    Creature* pTwilight = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_HALION_TWILIGHT));
                    if (!pTwilight)
                        pTwilight = m_creature->SummonCreature(NPC_HALION_TWILIGHT, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 1000);
                    else if (!pTwilight->isAlive())
                        pTwilight->Respawn();
                    pTwilight->SetCreatorGUID(0);
                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    setStage(5);
                }
                break;

            case 5: // HALION awaiting end battle in TWILIGHT REALM
                if (pInstance->GetData(TYPE_HALION_EVENT) == IN_PROGRESS)
                    {
//                        pInstance->SetData(TYPE_HALION_EVENT, SPECIAL);
                        doRemove(SPELL_START_PHASE2);
                        if (Creature* pControl = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_HALION_CONTROL)))
                        {
                            m_creature->SetInCombatWith(pControl);
                            pControl->SetInCombatWith(m_creature);
                        }
                        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                        m_creature->SetHealth(m_creature->GetMaxHealth()/2);
                        m_creature->SetInCombatWithZone();
                        setStage(6);
                    }
                return;

            case 6: // Switch to phase 3
//                doCast(SPELL_TWILIGHT_DIVISION);
                DoScriptText(-1666109,m_creature);
                pInstance->SetData(TYPE_HALION_EVENT, SPECIAL);
                setStage(7);
                break;

            case 7:
                if (m_creature->IsNonMeleeSpellCasted(false)) return;
                if (m_creature->getVictim()->GetTypeId() != TYPEID_PLAYER) return;
                SetCombatMovement(true);
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                setStage(8);
                break;

            case 8: //PHASE 3 BOTH REALMS
                timedCast(SPELL_FLAME_BREATH, uiDiff);
                timedCast(SPELL_FIERY_COMBUSTION, uiDiff);
                timedCast(SPELL_METEOR, uiDiff);
                break;

            default:
                break;
        }

        timedCast(SPELL_BERSERK, uiDiff);

        DoMeleeAttackIfReady();

    }
Example #18
0
    void UpdateAI(const uint32 diff)
    {
        if (pInstance->GetData(TYPE_EVENT_NPC) == NPC_PROFESSOR_PUTRICIDE)
        {
            UpdateTimer = pInstance->GetData(TYPE_EVENT_TIMER);
            if (UpdateTimer <= diff)
            {
            debug_log("EventMGR: creature %u received signal %u ",m_creature->GetEntry(),pInstance->GetData(TYPE_EVENT));
            switch (pInstance->GetData(TYPE_EVENT))
                {
                case 500:
                          m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                          m_creature->NearTeleportTo(SpawnLoc[1].x, SpawnLoc[1].y, SpawnLoc[1].z, SpawnLoc[1].o);
                          DoScriptText(-1631201, m_creature);
                          UpdateTimer = 60000;
                          pInstance->SetData(TYPE_EVENT,510);
                          break;
                case 510:
                          UpdateTimer = 5000;
                          if (pInstance->GetData(TYPE_FESTERGUT) == DONE)
                              pInstance->SetData(TYPE_EVENT,550);
                          if (pInstance->GetData(TYPE_FESTERGUT) == FAIL)
                              pInstance->SetData(TYPE_EVENT,630);
                          break;
                case 550:
                          DoScriptText(-1631202, m_creature);
                          UpdateTimer = 10000;
                          pInstance->SetData(TYPE_EVENT,630);
                          break;
                case 600:
                          m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                          m_creature->NearTeleportTo(SpawnLoc[2].x, SpawnLoc[2].y, SpawnLoc[2].z, SpawnLoc[2].o);
                          DoScriptText(-1631220, m_creature);
                          UpdateTimer = 60000;
                          pInstance->SetData(TYPE_EVENT,610);
                          break;
                case 610:
                          UpdateTimer = 5000;
                          if (pInstance->GetData(TYPE_ROTFACE) == DONE)
                              pInstance->SetData(TYPE_EVENT,620);
                          if (pInstance->GetData(TYPE_ROTFACE) == FAIL)
                              pInstance->SetData(TYPE_EVENT,630);
                          break;
                case 620:
                          DoScriptText(-1631202, m_creature);
                          UpdateTimer = 10000;
                          pInstance->SetData(TYPE_EVENT,630);
                          break;
                case 630:
                          m_creature->NearTeleportTo(SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, SpawnLoc[0].o);
                          m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                          UpdateTimer = 2000;
                          pInstance->SetData(TYPE_EVENT,690);
                          break;
                default:
                          break;
                }
             } else UpdateTimer -= diff;
             pInstance->SetData(TYPE_EVENT_TIMER, UpdateTimer);
        }

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

        switch(stage)
        {
            case 0: 

                if (timedQuery(SPELL_UNSTABLE_EXPERIMENT, diff))
                    CallOoze();

                timedCast(SPELL_OOZE_THROW, diff);

                if (timedQuery(SPELL_MALLEABLE_GOO, diff))
                {
                    doCast(SPELL_MALLEABLE_GOO);
                }

                DoMeleeAttackIfReady();

                if (m_creature->GetHealthPercent() < 80.0f ) stage = 1;

                break;
            case 1: 
                m_creature->InterruptNonMeleeSpells(true);
                m_creature->AttackStop();
                SetCombatMovement(false);
                doCast(SPELL_TEAR_GAS_1);
                DoScriptText(-1631245,m_creature);
                StartMovement(0);
                stage = 2;
                break;
            case 2:
                if (movementstarted) return;
                doCast(SPELL_CREATE_CONCOCTION);
                stage = 3;
                break;
            case 3:
                if (m_creature->IsNonMeleeSpellCasted(true,false,false) ||
                    !doSelectRandomPlayer(SPELL_TEAR_GAS_1, false)) return;
                DoScriptText(-1631246,m_creature);
                m_creature->SetDisplayId(VIEW_2);
                m_creature->GetMotionMaster()->Clear();
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                SetCombatMovement(true);
                stage = 4;
                break;
            case 4:
                if (timedQuery(SPELL_UNSTABLE_EXPERIMENT, diff))
                    CallOoze();

                if (timedQuery(SPELL_THROW_BOTTLE_1, diff))
                    switch(urand(0,2))
                {
                    case 0:
                        doCast(SPELL_THROW_BOTTLE_1);
                        break;
                    case 1:
                        doCast(SPELL_THROW_BOTTLE_2);
                        break;
                    case 2:
                        doCast(SPELL_THROW_BOTTLE_3);
                        break;
                    default: break;
                }

                timedCast(SPELL_OOZE_THROW, diff);

                timedCast(SPELL_MALLEABLE_GOO, diff);

                if (timedQuery(SPELL_MALLEABLE_GOO, diff))
                {
                    doCast(SPELL_MALLEABLE_GOO);
                }

                if (m_creature->GetDisplayId() != VIEW_2)
                    m_creature->SetDisplayId(VIEW_2);

                DoMeleeAttackIfReady();

                if (m_creature->GetHealthPercent() < 35.0f ) stage = 5;

                break;
            case 5:
                    m_creature->InterruptNonMeleeSpells(true);
                    m_creature->AttackStop();
                    SetCombatMovement(false);
                    doCast(SPELL_TEAR_GAS_1);
                    DoScriptText(-1631245,m_creature);
                    StartMovement(0);
                    stage = 6;
                    break;
            case 6:
                    if (movementstarted) return;
                    doCast(SPELL_GUZZLE_POTIONS);
                    stage = 7;
                    break;
            case 7:
                    if (m_creature->IsNonMeleeSpellCasted(true,false,false)) return;
                    if (m_creature->GetDisplayId() != VIEW_3)
                        m_creature->SetDisplayId(VIEW_3);
                    if (!doSelectRandomPlayer(SPELL_TEAR_GAS_1, false)) return;
                    DoScriptText(-1631247,m_creature);
                    m_creature->SetDisplayId(VIEW_3);
                    doCast(SPELL_MUTATED_STRENGTH);
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                    SetCombatMovement(true);
                    stage = 8;
                    break;
            case 8:
                    timedCast(SPELL_MUTATED_PLAGUE, diff);
                    if (m_creature->GetDisplayId() != VIEW_3)
                        m_creature->SetDisplayId(VIEW_3);
                    DoMeleeAttackIfReady();

                    break;
            default:
                    break;
            }

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