Exemplo n.º 1
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return;

          timedCast(SPELL_NATURE_GRASP, diff);

          timedCast(SPELL_TRANQUILITY, diff);

          if (timedQuery(SPELL_BARKSKIN, diff))
                if (m_creature->GetHealthPercent() < 50.0f)
                    doCast(SPELL_BARKSKIN);

        if (timedQuery(SPELL_LIFEBLOOM, diff))
            switch (urand(0,4))
            {
                case 0:
                        doCast(SPELL_LIFEBLOOM);
                    break;
                case 1:
                        doCast(SPELL_NOURISH);
                    break;
                case 2:
                        doCast(SPELL_REGROWTH);
                    break;
                case 3:
                        doCast(SPELL_REJUVENATION);
                    break;
                case 4:
                    if (Creature* target = SelectRandomFriendlyMissingBuff(SPELL_THORNS))
                        doCast(SPELL_THORNS, target);
                    break;
            }

        boss_faction_championsAI::UpdateAI(diff);
    }
Exemplo n.º 2
0
    void UpdateAI(const uint32 diff)
    {

    if(!pInstance) return;

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

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

        if (nexttick)
              {
                  doCast(SPELL_OOZE_FLOOD_1);
                  DoScriptText(-1631227,m_creature);
                  nexttick = false;
              };

        if (timedQuery(SPELL_OOZE_FLOOD_1, diff))
              {
                   uint8 i = urand(0,3);
                   if (Unit* pTemp = doSummon(NPC_OOZE_STALKER,SpawnLoc[i].x, SpawnLoc[i].y, SpawnLoc[i].z, TEMPSUMMON_TIMED_DESPAWN, 15000))
                   {
                       doCast(SPELL_OOZE_FLOOD, pTemp);
                       nexttick = true;
                   }
              };

        if (timedQuery(SPELL_SLIME_SPRAY, diff))
            if (doSummon(NPC_OOZE_SPRAY_STALKER))
                doCast(SPELL_SLIME_SPRAY);

        if (timedQuery(SPELL_MUTATED_INFECTION, diff))
        {
            for(uint8 i = 0; i < getSpellData(SPELL_MUTATED_INFECTION); ++i)
                if (Unit* pTarget = doSelectRandomPlayer(SPELL_MUTATED_INFECTION_AURA, false, 60.0f))
                     doCast(SPELL_MUTATED_INFECTION, pTarget);
            DoScriptText(-1631226,m_creature);
        }

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

        DoMeleeAttackIfReady();
    }
Exemplo n.º 3
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return;

            if (EnemiesInRange(10.0f) > 2)
                timedCast(SPELL_PSYCHIC_SCREAM, diff);

            if (m_creature->GetHealthPercent() < 20.0f)
                timedCast(SPELL_DISPERSION, diff);

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

            timedCast(SPELL_MIND_BLAST, diff);

        if (timedQuery(SPELL_MIND_FLAY, diff))
        {
            switch (urand(0,4))
            {
                case 0: case 1:
                    doCast(SPELL_MIND_FLAY);
                    break;
                case 2:
                    doCast(SPELL_VAMPIRIC_TOUCH);
                    break;
               case 3:
                    doCast(SPELL_SW_PAIN);
                    break;
               case 4:
                    doCast(SPELL_DISPEL);
                    break;
            }
        }
        boss_faction_championsAI::UpdateAI(diff);
    }
Exemplo n.º 4
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return;

            if (EnemiesInRange(10.0f) > 2)
                timedCast(SPELL_PSYCHIC_SCREAM, diff);

        if (timedQuery(SPELL_RENEW, diff))
        {
            switch (urand(0,5))
            {
                case 0:
                        doCast(SPELL_RENEW);
                    break;
                case 1:
                        doCast(SPELL_SHIELD);
                    break;
                case 2: case 3:
                        doCast(SPELL_FLASH_HEAL);
                    break;
                case 4:
                    if (Unit *target = urand(0,1) ? m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0) : DoSelectLowestHpFriendly(40.0f))
                        doCast(target, SPELL_DISPEL);
                    break;
                case 5:
                        doCast(SPELL_MANA_BURN);
                    break;
            }
        }

        boss_faction_championsAI::UpdateAI(diff);
    }
Exemplo n.º 5
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return;

            timedCast(SPELL_Fear, diff);

            if (EnemiesInRange(10.0f) > 2)
                timedCast(SPELL_HELLFIRE, diff);

            timedCast(SPELL_Unstable_Affliction, diff);

        if (timedQuery(SPELL_Shadow_Bolt, diff))
        {
            switch (urand(0,5))
            {
                case 0:
                    doCast(SPELL_Searing_Pain);
                    break;
                case 1: case 2:
                    doCast(SPELL_Shadow_Bolt);
                    break;
                case 3:
                    doCast(SPELL_CORRUPTION);
                    break;
                case 4:
                    doCast(SPELL_Curse_of_Agony);
                    break;
                case 5:
                    doCast(SPELL_Curse_of_Exhaustion);
                    break;
             }
         }
       boss_faction_championsAI::UpdateAI(diff);
    }
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_pInstance || m_pInstance->GetData(TYPE_VALITHRIA) != IN_PROGRESS || portalcasted)
            if (timedQuery(SPELL_EMERALD_VIGOR, uiDiff))
                m_creature->ForcedDespawn();

    }
Exemplo n.º 7
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return;

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

        timedCast(SPELL_Cyclone, diff);

        timedCast(SPELL_Entangling_Roots, diff);

        timedCast(SPELL_Faerie_Fire, diff);

        if (timedQuery(SPELL_Moonfire, diff))
        {
            switch (urand(0,6))
            {
                case 0: case 1:
                      doCast(SPELL_Moonfire);
                      break;
                case 2:
                      doCast(SPELL_Insect_Swarm);
                      break;
                case 3:
                      doCast(SPELL_Starfire);
                      break;
                case 4: case 5: case 6:
                      doCast(SPELL_Wrath);
                      break;
            }
        }
        boss_faction_championsAI::UpdateAI(diff);
    }
Exemplo n.º 8
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return;

            if (EnemiesInRange(10.0f) > 3)
                timedCast(SPELL_Disengage, diff);

            if (m_creature->GetHealthPercent() < 20.0f)
                timedCast(SPELL_Deterrence, diff);

            timedCast(SPELL_Wyvern_Sting, diff);

            timedCast(SPELL_Frost_Trap, diff );

            if (m_creature->GetDistance2d(m_creature->getVictim()) < 5.0f)
                timedCast(SPELL_WING_CLIP, diff);

        if (timedQuery(SPELL_SHOOT, diff))
        {
            switch (urand(0,3))
            {
                case 0: case 1:
                    doCast(SPELL_SHOOT);
                    break;
                case 2:
                    doCast(SPELL_EXPLOSIVE_SHOT);
                    break;
                case 3:
                    doCast(SPELL_AIMED_SHOT);
                    break;
            }
        }
        boss_faction_championsAI::UpdateAI(diff);
    }
Exemplo n.º 9
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return;

            timedCast(SPELL_HEROISM, diff);

            timedCast(SPELL_HEX, diff);

        if (timedQuery(SPELL_HEALING_WAVE, diff))
        {
            switch (urand(0,5))
            {
                case 0: case 1:
                        doCast(SPELL_HEALING_WAVE);
                    break;
                case 2:
                        doCast(SPELL_RIPTIDE);
                    break;
                case 3:
                        doCast(SPELL_EARTH_SHOCK);
                    break;
                case 4:
                        doCast(SPELL_SPIRIT_CLEANSE);
                    break;
                case 5:
                    if (Unit *target = SelectRandomFriendlyMissingBuff(SPELL_EARTH_SHIELD))
                        doCast(target, SPELL_EARTH_SHIELD);
                    break;
            }
        }

        boss_faction_championsAI::UpdateAI(diff);
    }
Exemplo n.º 10
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_pInstance)
            return;

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

        if (hasAura(SPELL_INVOCATION_OF_BLOOD_V))
        {
            if (!invocated)
            {
                DoScriptText(-1631307,m_creature);
                m_creature->SetHealth(m_health);
                invocated = true;
            }
            if (timedQuery(SPELL_INVOCATION_OF_BLOOD_V, uiDiff))
            {
                if (doCast(urand(0,1) ? SPELL_INVOCATION_OF_BLOOD_K : SPELL_INVOCATION_OF_BLOOD_T) == CAST_OK)
                {
                    doRemove(SPELL_INVOCATION_OF_BLOOD_V);
                    invocated = false;
                    m_health = m_creature->GetHealth();
                    m_creature->SetHealth(1);
                }
            }
            timedCast(SPELL_KINETIC_BOMB, uiDiff);
            timedCast(SPELL_SHOCK_VORTEX_2, uiDiff);
        }
        else
        {

            timedCast(SPELL_KINETIC_BOMB, uiDiff);
            timedCast(SPELL_SHOCK_VORTEX, uiDiff);
        }

        if (timedQuery(SPELL_BERSERK, uiDiff))
        {
             doCast(SPELL_BERSERK);
             DoScriptText(-1631305,m_creature);
         };

        DoMeleeAttackIfReady();
    }
Exemplo n.º 11
0
 void UpdateAI(const uint32 uiDiff)
 {
     if (!m_pInstance || m_pInstance->GetData(TYPE_VALITHRIA) != IN_PROGRESS) return;
     if (timedQuery(SPELL_SUMMON_NIGHTMARE_PORTAL, uiDiff))
     {
         doCast(SPELL_SUMMON_NIGHTMARE_PORTAL);
         b_cast=true;  
     }
     if ((m_desp<=1000)&&(b_cast)) m_creature->ForcedDespawn(); else m_desp -= uiDiff; 
 }
Exemplo n.º 12
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        timedCast(SPELL_IMPALE, uiDiff);

        timedCast(SPELL_STAGGERING_STOMP, uiDiff);

        if (timedQuery(SUMMON_SNOBOLD, uiDiff) && SnoboldsCount > 0 ) {
                        doCast(SUMMON_SNOBOLD);
                        DoScriptText(-1713601,m_creature);
                        --SnoboldsCount;
                        };

        DoMeleeAttackIfReady();
    }
Exemplo n.º 13
0
    void UpdateAI(const uint32 uiDiff)
    {
        if(m_pInstance && m_pInstance->GetData(TYPE_DEATHWHISPER) != IN_PROGRESS)
            m_creature->ForcedDespawn();

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

        if (timedQuery(SPELL_VENGEFUL_BLAST_0, uiDiff))
        {
            if (m_creature->IsWithinDist(m_creature->getVictim(), 3.0f, false))
            {
//                        doCast(SPELL_VENGEFUL_BLAST_0);
                m_creature->ForcedDespawn();
            }
            else
            {
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                m_creature->SetSpeedRate(MOVE_RUN, 0.5);
            }
        }
    }
Exemplo n.º 14
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return;

        //cast bubble at 20% hp
        if (m_creature->GetHealthPercent() < 20.0f)
             timedCast(SPELL_BUBBLE, diff);

            if (Unit *target = DoSelectLowestHpFriendly(40.0f))
                if (target->GetHealthPercent() < 15.0f)
                    timedCast(SPELL_HAND_OF_PROTECTION, diff);

            timedCast(SPELL_HOLY_SHOCK, diff);

            if (Unit *target = SelectRandomFriendlyMissingBuff(SPELL_HAND_OF_FREEDOM))
                timedCast(SPELL_HAND_OF_FREEDOM, diff, target);

            timedCast(SPELL_HAMMER_OF_JUSTICE, diff);

        if (timedQuery(SPELL_FLASH_OF_LIGHT, diff))
        {
            switch (urand(0,4))
            {
                case 0: case 1:
                        doCast(SPELL_FLASH_OF_LIGHT);
                    break;
                case 2: case 3:
                        doCast(SPELL_HOLY_LIGHT);
                    break;
                case 4:
                        doCast(SPELL_CLEANSE);
                    break;
            }
        }

        boss_faction_championsAI::UpdateAI(diff);
    }
Exemplo n.º 15
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return;

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

            if (m_creature->GetHealthPercent() < 50.0f 
            && EnemiesInRange(10.0f)>3 )
            {
                timedCast(SPELL_Frost_Nova, diff);
                timedCast(SPELL_Blink, diff);
            }

            if (m_creature->GetHealthPercent() < 20.0f)
                   timedCast(SPELL_Ice_Block, diff);

            timedCast(SPELL_Polymorph, diff);

        if (timedQuery(SPELL_Arcane_Barrage, diff))
        {
            switch (urand(0,2))
            {
                case 0:
                    doCast(SPELL_Arcane_Barrage);
                    break;
                case 1:
                    doCast(SPELL_Arcane_Blast);
                    break;
                case 2:
                    doCast(SPELL_Frostbolt);
                    break;
            }
        }
        boss_faction_championsAI::UpdateAI(diff);
    }
Exemplo n.º 16
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);
        }
    }
Exemplo n.º 17
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();
    }
Exemplo n.º 18
0
    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();
    }
    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);
        };

    }
Exemplo n.º 20
0
    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();
    }
Exemplo n.º 21
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch(getStage())
        {
            case 0: // Bone Slice and single Coldflames phase
            {
                if (timedQuery(SPELL_BONE_SPIKE, diff))
                {
                    if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_SPIKE_IMPALE, false, 60.0f, isHeroic()))
                    {
                        doCast(pTarget, SPELL_BONE_SPIKE);
                        DoSummonSpike(pTarget);
                        DoScriptText(-1631003 - urand(0,2), m_creature, pTarget);
                    }
                }

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

                if (timedQuery(SPELL_CALL_COLD_FLAME, diff))
                    doCast(SPELL_CALL_COLD_FLAME);

                if (m_uiSliceTimer <= 1000)
                {
                    if (m_uiSliceTimer <= diff)
                    {
                        doCast(SPELL_BONE_SLICE, m_creature->getVictim());
                        m_uiSliceTimer = 1000;
                    }
                    else
                        m_uiSliceTimer -= diff;
                }
                else
                    m_uiSliceTimer -= diff;

                DoMeleeAttackIfReady();
                break;
            }
            case 1: // Bone Storm initialization phase
            {
                m_creature->InterruptNonMeleeSpells(true);
                doCast(SPELL_BONE_STORM);
                DoScriptText(-1631002,m_creature);
                SetCombatMovement(false);
                m_creature->GetMotionMaster()->Clear();
                m_creature->SetSpeedRate(MOVE_RUN, 3);
                // initial X Coldflames are in Marrowgar's place
                m_creature->GetPosition(targetPosX, targetPosY, targetPosZ);
                setStage(2);
                break;
            }
            case 2: // Bone Storm waiting to end casting the spell
            {
                if (!m_creature->IsNonMeleeSpellCasted(false))
                    setStage(3);
                break;
            }
            case 3: // Whirling in Bone Storm and casting Cold Flames
            {
                if (isHeroic())
                {
                    if (timedQuery(SPELL_BONE_SPIKE, diff))
                    {
                        if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_SPIKE_IMPALE, false, 60.0f, isHeroic()))
                        {
                            doCast(pTarget, SPELL_BONE_SPIKE);
                            DoSummonSpike(pTarget);
                            DoScriptText(-1631003 - urand(0,2), m_creature, pTarget);
                        }
                    }
                }

                if (m_creature->GetDistance2d(targetPosX, targetPosY) < 5.0f)
                {
                    if (!m_bIsColdFlameXCast)
                    {
                        
                        float myPosX, myPosY, myPosZ;

                        m_creature->GetPosition(myPosX, myPosY, myPosZ);

                        m_pInstance->SetData(DATA_DIRECTION, (uint32)(1000*2.0f*M_PI_F*((float)urand(1,16)/16.0f)));
                        doCast(SPELL_CALL_COLD_FLAME);
                        doSummon(NPC_COLD_FLAME, myPosX, myPosY, myPosZ);

                        if (++m_uiColdFlameCounter >= 4 + isHeroic())
                        {
                            doRemove(SPELL_BONE_STORM_STRIKE);
                            doRemove(SPELL_BONE_STORM);
                        }
                        m_bIsColdFlameXCast = true;
                    }

                    if (m_uiBoneStormChargeTimer <= diff)
                    {
                        if (Unit* pTarget = doSelectRandomPlayerAtRange(60.0f))
                        {
                            pTarget->GetPosition(targetPosX, targetPosY, targetPosZ);
                            m_creature->GetMotionMaster()->MovePoint(0, targetPosX, targetPosY, targetPosZ);
                            m_bIsColdFlameXCast = false;
                            m_uiBoneStormChargeTimer = 3000;
                        }
                    }
                    else
                        m_uiBoneStormChargeTimer -= diff;
                }

                if (!hasAura(SPELL_BONE_STORM_STRIKE, m_creature) && !hasAura(SPELL_BONE_STORM, m_creature))
                    setStage(4);

                break;
            }
            case 4:
            {
                m_pInstance->SetData(DATA_DIRECTION, 0);
                m_creature->SetSpeedRate(MOVE_RUN, 1);
                m_uiColdFlameCounter = 0;
                SetCombatMovement(true);
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                m_uiSliceTimer = 10000;
                setStage(0);
                break;
            }
            default:
                break;
        }

        if (timedQuery(SPELL_BERSERK, diff))
        {
            doCast(SPELL_BERSERK);
            DoScriptText(-1631008, m_creature);
        }
    }
Exemplo n.º 22
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();
    }
Exemplo n.º 23
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;
        }
    }
Exemplo n.º 24
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();
    }
Exemplo n.º 25
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();
    }
Exemplo n.º 26
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();
    }
Exemplo n.º 27
0
    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);
            }


    }
Exemplo n.º 28
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;
    }