Esempio n. 1
0
    void UpdateAI(const uint32 diff)
    {
        if( Event_Timer < diff )
        {
            switch(Phase)
            {
                case 1:
                    if( someplayer )
                    {
                        Unit* u = Unit::GetUnit((*m_creature),someplayer);
                        if( u && u->GetTypeId() == TYPEID_PLAYER ) DoTextEmote(EMOTE_START, u);
                    }
                    Event_Timer = 60000;
                    Wave = true;
                    ++Phase;
                    break;
                case 2:
                    DoTextEmote(EMOTE_60, NULL);
                    Event_Timer = 30000;
                    ++Phase;
                    break;
                case 3:
                    DoTextEmote(EMOTE_30, NULL);
                    Event_Timer = 20000;
                    DoFinalSpawnForCreature(m_creature);
                    ++Phase;
                    break;
                case 4:
                    DoTextEmote(EMOTE_10, NULL);
                    Event_Timer = 10000;
                    Wave = false;
                    ++Phase;
                    break;
                case 5:
                    DoTextEmote(EMOTE_COMPLETE, NULL);
                    if( someplayer )
                    {
                        Unit* u = Unit::GetUnit((*m_creature),someplayer);
                        if( u && u->GetTypeId() == TYPEID_PLAYER )
                            ((Player*)u)->KilledMonster(m_creature->GetEntry(),m_creature->GetGUID());
                        DoCast(m_creature,SPELL_DISABLE_VISUAL);
                    }
                    if( goConsole )
                    {
                        if( GameObject* go = GameObject::GetGameObject((*m_creature),goConsole) )
                            go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
                    }
                    ++Phase;
                    break;
            }
        } else Event_Timer -= diff;

        if( Wave )
        {
            if( Wave_Timer < diff )
            {
                DoWaveSpawnForCreature(m_creature);
            } else Wave_Timer -= diff;
        }
    }
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        //Rend_Timer
        if (Rend_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_REND);
            Rend_Timer = 10000;
        }else Rend_Timer -= diff;

        //Cleave_Timer
        if (Cleave_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_CLEAVE);
            Cleave_Timer = 10000;
        }else Cleave_Timer -= diff;

        //Frenzy_Timer
        if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 26 )
        {
            if (Frenzy_Timer < diff)
            {
                DoCast(m_creature,SPELL_FRENZY);
                DoTextEmote("goes into a killing frenzy!",NULL);

                Frenzy_Timer = 8000;
            }else Frenzy_Timer -= diff;
        }

        DoMeleeAttackIfReady();
    }
Esempio n. 3
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostilTarget())
            return;

        //Check if we have a current target
        if( m_creature->getVictim() && m_creature->isAlive())
        {

            //If we are <2% hp cast Armageddom
            if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 2 && !m_creature->m_currentSpell)
            {
                DoCast(m_creature,SPELL_ARMAGEDDOM);
                DoTextEmote("performs one last service for Ragnaros.",NULL);
                return;
            }
            
            //Inferno_Timer
            if (Inferno_Timer < diff)
            {
                //Cast
                DoCast(m_creature,SPELL_INFERNO);

                //7 seconds until we should cast this agian
                Inferno_Timer = 45000;
            }else Inferno_Timer -= diff;

            //IgniteMana_Timer
            if (IgniteMana_Timer < diff)
            {
                //Cast
                DoCast(m_creature->getVictim(),SPELL_IGNITEMANA);

                //35 seconds until we should cast this agian
                IgniteMana_Timer = 30000;
            }else IgniteMana_Timer -= diff;

            //LivingBomb_Timer
            if (LivingBomb_Timer < diff)
            {
                //Cast
                DoCast(m_creature->getVictim(),SPELL_LIVINGBOMB);

                //30 seconds until we should cast this agian
                LivingBomb_Timer = 35000;
            }else LivingBomb_Timer -= diff;

            //If we are within range melee the target
            if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DIST))
            {
                //Make sure our attack is ready and we arn't currently casting
                if( m_creature->isAttackReady() && !m_creature->m_currentSpell)
                {
                    m_creature->AttackerStateUpdate(m_creature->getVictim());
                    m_creature->resetAttackTimer();
                }
            }
        }
    }
Esempio n. 4
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        //FireShield_Timer
        if (FireShield_Timer < diff)
        {
            DoCast(m_creature, SPELL_FIRESHIELD);
            FireShield_Timer = 90000;
        }else FireShield_Timer -= diff;

        //BlastWave_Timer
        if (BlastWave_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_BLASTWAVE);
            BlastWave_Timer = 12000;
        }else BlastWave_Timer -= diff;

        //Frenzy_Timer
        if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 25 )
        {
            if (Frenzy_Timer < diff)
            {
                DoCast(m_creature,SPELL_FRENZY);
                DoTextEmote("goes into a killing frenzy!",NULL);

                Frenzy_Timer = 24000;
            }else Frenzy_Timer -= diff;
        }

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostilTarget())
            return;

        //Check if we have a current target
        if( m_creature->getVictim() && m_creature->isAlive())
        {

            //FireShield_Timer
            if (FireShield_Timer < diff)
            {
                //Cast
                DoCast(m_creature, SPELL_FIRESHIELD);

                //90 seconds
                FireShield_Timer = 90000;
            } else FireShield_Timer -= diff;

            //BlastWave_Timer
            if (BlastWave_Timer < diff)
            {
                //Cast
                DoCast(m_creature->getVictim(),SPELL_BLASTWAVE);

                //12 seconds until we should cast this agian
                BlastWave_Timer = 12000;
            } else BlastWave_Timer -= diff;

            //Frenzy_Timer
            if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 25 )
            {
                if (Frenzy_Timer < diff)
                {
                    DoCast(m_creature,SPELL_FRENZY);
                    DoTextEmote("goes into a killing frenzy!",NULL);

                    //24 seconds
                    Frenzy_Timer = 24000;
                } else Frenzy_Timer -= diff;
            }


            //If we are within range melee the target
            if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
            {
                //Make sure our attack is ready and we arn't currently casting
                if( m_creature->isAttackReady() && !m_creature->m_currentSpell)
                {
                    m_creature->AttackerStateUpdate(m_creature->getVictim());
                    m_creature->resetAttackTimer();
                }
            }
        }
    }
Esempio n. 6
0
    void MovementInform(uint32 type, uint32 id)
    {
        if(type != POINT_MOTION_TYPE)
                return;

        if(Intro)
        {
            if(id >= 8)
            {
                Intro = false;
                m_creature->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0);
                return;
            }

            WaitTimer = 1;
        }

        if(Flying)
        {
            if(id == 0)
            {
                DoTextEmote(EMOTE_BREATH, NULL, true);
                Flying = false;
                Phase = 2;
                return;
            }

            if(id == 3)
            {
                MovePhase = 4;
                WaitTimer = 1;
                return;
            }

            if(id == 8)
            {
                Flying = false;
                Phase = 1;
                Movement = true;
                return;
            }

            WaitTimer = 1;
        }
    }
Esempio n. 7
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
            return;

        //If we are <2% hp cast Armageddom
        if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 2 && !m_creature->IsNonMeleeSpellCasted(false))
        {
            DoCast(m_creature,SPELL_ARMAGEDDOM);
            DoTextEmote("performs one last service for Ragnaros.",NULL);
            return;
        }

        //Inferno_Timer
        if (Inferno_Timer < diff)
        {
            DoCast(m_creature,SPELL_INFERNO);
            Inferno_Timer = 45000;
        }else Inferno_Timer -= diff;

        //IgniteMana_Timer
        if (IgniteMana_Timer < diff)
        {
            Unit* target = NULL;
            target = SelectUnit(SELECT_TARGET_RANDOM,0);
            if (target) DoCast(target,SPELL_IGNITEMANA);

            IgniteMana_Timer = 30000;
        }else IgniteMana_Timer -= diff;

        //LivingBomb_Timer
        if (LivingBomb_Timer < diff)
        {
            Unit* target = NULL;
            target = SelectUnit(SELECT_TARGET_RANDOM,0);
            if (target) DoCast(target,SPELL_LIVINGBOMB);

            LivingBomb_Timer = 35000;
        }else LivingBomb_Timer -= diff;

        DoMeleeAttackIfReady();
    }
Esempio n. 8
0
    void JustDied(Unit* killer)
    {
        DoTextEmote(EMOTE_ABORT, NULL);

        if( someplayer )
        {
            Unit* p = Unit::GetUnit((*m_creature),someplayer);
            if( p && p->GetTypeId() == TYPEID_PLAYER )
            {
                switch( m_creature->GetEntry() )
                {
                    case ENTRY_BNAAR_C_CONSOLE:
                        ((Player*)p)->FailQuest(10299);
                        ((Player*)p)->FailQuest(10329);
                        break;
                    case ENTRY_CORUU_C_CONSOLE:
                        ((Player*)p)->FailQuest(10321);
                        ((Player*)p)->FailQuest(10330);
                        break;
                    case ENTRY_DURO_C_CONSOLE:
                        ((Player*)p)->FailQuest(10322);
                        ((Player*)p)->FailQuest(10338);
                        break;
                    case ENTRY_ARA_C_CONSOLE:
                        ((Player*)p)->FailQuest(10323);
                        ((Player*)p)->FailQuest(10365);
                        break;
                }
            }
        }

        if( goConsole )
        {
            if( GameObject* go = GameObject::GetGameObject((*m_creature),goConsole) )
                go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
        }
    }
Esempio n. 9
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
            return;

        if( VoidBlast_Timer < diff )
        {
            if( Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0) )
            {
                DoCast(target,HeroicMode ? H_SPELL_VOID_BLAST : SPELL_VOID_BLAST);
                VoidBlast_Timer = 500;
                ++VoidBlast_Counter;
            }

            if( VoidBlast_Counter == 5 )
            {
                VoidBlast_Timer = 25000+rand()%10000;
                VoidBlast_Counter = 0;
            }
        }else VoidBlast_Timer -= diff;

        if( !VoidBlast_Counter )
        {
            if( DarkShell_Timer < diff )
            {
                if( m_creature->IsNonMeleeSpellCasted(false) )
                    m_creature->InterruptNonMeleeSpells(true);

                DoTextEmote(EMOTE_DARK_SHELL,NULL,true);
                DoCast(m_creature,HeroicMode ? H_SPELL_DARK_SHELL : SPELL_DARK_SHELL);
                DarkShell_Timer = 20000;
            }else DarkShell_Timer -= diff;
        }

        DoMeleeAttackIfReady();
    }
Esempio n. 10
0
    void UpdateAI(const uint32 diff)
    {
        if(!m_creature->SelectHostilTarget())
            return;

        if(m_creature->getVictim() && m_creature->isAlive())
        {
            if(phase == 1)
            {
                if(FrostAura_Timer < diff)
                {
                    DoCast(m_creature->getVictim(),SPELL_FROST_AURA);
                    FrostAura_Timer = 5000;
                }else FrostAura_Timer -= diff;

                if(LifeDrain_Timer < diff)
                {
                    Unit* target = NULL;
                    target = SelectUnit(SELECT_TARGET_RANDOM,0);

                    DoCast(target,SPELL_LIFE_DRAIN);
                    LifeDrain_Timer = 24000;
                }else LifeDrain_Timer -= diff;

                if(Blizzard_Timer < diff)
                {
                    Unit* target = NULL;
                    target = SelectUnit(SELECT_TARGET_RANDOM,0);

                    DoCast(target,SPELL_BLIZZARD);
                    Blizzard_Timer = 20000;
                }else Blizzard_Timer -= diff;

                if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 10)
                {
                    if(Fly_Timer < diff)
                    {
                        phase = 2;
                        m_creature->InterruptNonMeleeSpells(false);
                        m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
                        (*m_creature).GetMotionMaster()->Clear(false);
                        (*m_creature).GetMotionMaster()->MoveIdle();
                        DoCast(m_creature,11010);
                        m_creature->SetHover(true);
                        DoCast(m_creature,18430);
                        Icebolt_Timer = 4000;
                        Icebolt_Count = 0;
                        landoff = false;
                    }else Fly_Timer -= diff;
                }

                if (phase == 2)
                {
                    if(Icebolt_Timer < diff && Icebolt_Count < 5)
                    {
                        Unit* target = NULL;

                        target = SelectUnit(SELECT_TARGET_RANDOM,0);

                        DoCast(target,SPELL_ICEBOLT);
                        Icebolt_Count ++;
                        Icebolt_Timer = 4000;
                    }else Icebolt_Timer -= diff;

                    if(Icebolt_Count == 5 && !landoff)
                    {
                        if(FrostBreath_Timer < diff )
                        {
                            DoTextEmote("takes a deep breath...",NULL);
                            DoCast(m_creature->getVictim(),SPELL_FROST_BREATH);
                            land_Timer = 2000;
                            landoff = true;
                            FrostBreath_Timer = 6000;
                        }else FrostBreath_Timer -= diff;
                    }

                    if(landoff)
                    {
                        if(land_Timer < diff)
                        {
                            phase = 1;
                            m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
                            m_creature->SetHover(false);
                            (*m_creature).GetMotionMaster()->Clear(false);
                            (*m_creature).GetMotionMaster()->MoveChase(m_creature->getVictim());
                            Fly_Timer = 67000;
                        }else land_Timer -= diff;
                    }

                }

                if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 11)
                {
                    if (Beserk_Timer < diff)
                    {
                        DoTextEmote("enrages!",NULL);
                        DoCast(m_creature,SPELL_BESERK);
                        Beserk_Timer = 300000;
                    }else Beserk_Timer -= diff;
                }

                if( phase!=2 && m_creature->getVictim() && m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
                {
                    if( m_creature->isAttackReady() )
                    {
                        m_creature->AttackerStateUpdate(m_creature->getVictim());
                        m_creature->resetAttackTimer();
                    }
                }
            }
        }
    }
Esempio n. 11
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!UpdateVictim())
            return;

        //Frenzy_Timer
        if (!Frenzy && Frenzy_Timer < diff)
        {
            DoCast(m_creature, SPELL_FRENZY);
            Frenzy = true;
            PoisonBolt_Timer = 3000;
            Frenzy_Timer = 25000 + rand()%10000;
        } else Frenzy_Timer -= diff;

        // Wyvern Timer
        if (Wyvern_Timer < diff)
        {
            if( Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0) )
                DoCast(target,SPELL_WYVERNSTING);
            Wyvern_Timer = 15000 + rand()%17000;
        } else Wyvern_Timer -= diff;

        //Spit Timer
        if (Spit_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_ACIDSPIT);
            Spit_Timer = 5000 + rand()%5000;
        } else Spit_Timer -= diff;

        //NoxiousPoison_Timer
        if (NoxiousPoison_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_NOXIOUSPOISON);
            NoxiousPoison_Timer = 12000 + rand()%12000;
        } else NoxiousPoison_Timer -= diff;

        //PoisonBolt only if frenzy or berserk
        if (Frenzy || Berserk)
        {
            if (PoisonBolt_Timer < diff)
            {
                DoCast(m_creature->getVictim(),SPELL_POISONBOLT);
                PoisonBolt_Timer = 3000;
            } else PoisonBolt_Timer -= diff;
        }

        //FrenzyBack_Timer
        if (Frenzy && FrenzyBack_Timer < diff)
        {
            m_creature->InterruptNonMeleeSpells(false);
            Frenzy = false;
            FrenzyBack_Timer = 15000;
        } else FrenzyBack_Timer -= diff;

        if ( !Berserk && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 31 )
        {
            m_creature->InterruptNonMeleeSpells(false);
            DoTextEmote("is going berserk", NULL);
            DoCast(m_creature, SPELL_BERSERK);
            Berserk = true;
        }

        DoMeleeAttackIfReady();
    }
Esempio n. 12
0
    void UpdateAI(const uint32 diff)
    {
        if(!m_creature->SelectHostilTarget() || !m_creature->getVictim())
            return;

        if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 60) && (Phase == 1))
        {
            Phase = 2;
            m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
            m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
            m_creature->GetMotionMaster()->Clear(false);
            m_creature->GetMotionMaster()->MoveIdle();
            DoYell(SAY_PHASE_2_TRANS, LANG_UNIVERSAL, NULL);
        }

        if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 40) && (Phase == 2))
        {
            Phase = 3;
            m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
            m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
            DoYell(SAY_PHASE_3_TRANS, LANG_UNIVERSAL, NULL);
        }

        if(Phase == 1 || Phase == 3)
        {
            if(FlameBreathTimer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_FLAMEBREATH);
                FlameBreathTimer = 15000;
            }else FlameBreathTimer -= diff;

            if(TailSweepTimer < diff)
            {
                Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
                if(target && !m_creature->HasInArc(M_PI, target))
                    DoCast(target, SPELL_TAILSWEEP);

                TailSweepTimer = 10000;
            }else TailSweepTimer -= diff;

            if(CleaveTimer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_CLEAVE);
                CleaveTimer = 10000;
            }else CleaveTimer -= diff;

            if(WingBuffetTimer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_WINGBUFFET);
                WingBuffetTimer = 7000 + ((rand()%8)*1000);
            }else WingBuffetTimer -= diff;

            DoMeleeAttackIfReady();
        }

        if(Phase == 2)
        {
            if(!m_creature->isHover())
            {
                m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
                m_creature->SetHover(true);
            }

            if(!m_creature->GetMotionMaster()->empty() && (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE))
                m_creature->GetMotionMaster()->Clear(false);

            if(MovementTimer < diff)
            {
                uint32 random = rand()%8;
                if(random < 7)
                    m_creature->GetMotionMaster()->MovePoint(0, MovementLocations[random][0], MovementLocations[random][1], MovementLocations[random][2]);
                else
                {
                    DoTextEmote(EMOTE_BREATH, NULL);
                    DoCast(m_creature->getVictim(), SPELL_DEEPBREATH);
                }
                MovementTimer = 25000;
            }else MovementTimer -= diff;

            if(EngulfingFlamesTimer < diff)
            {
                DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_ENGULFINGFLAMES);
                EngulfingFlamesTimer = 10000;
            }else EngulfingFlamesTimer -= diff;

            if(SummonWhelpsTimer < diff)
            {
                uint32 max = rand()%20;
                for(uint8 i = 0; i < max; ++i)
                {
                    uint8 random = rand()%4;
                    Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
                    if(Whelp)
                        Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0));
                }
                SummonWhelpsTimer = 45000;
            }else SummonWhelpsTimer -= diff;
        }

        if(Phase == 3)
        {
            if(BellowingRoarTimer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR);
                BellowingRoarTimer = 30000;
            }else BellowingRoarTimer -= diff;
        }
    }
Esempio n. 13
0
 void HandleFlightSequence()
 {
     switch(FlightCount)
     {
     case 0:
         m_creature->AttackStop();
         m_creature->GetMotionMaster()->Clear(false);
         m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
         m_creature->AddMonsterMoveFlag(MONSTER_MOVE_LEVITATING);
         m_creature->StopMoving();
         DoYell(YELL_TAKEOFF, LANG_UNIVERSAL, NULL);
         DoPlaySoundToSet(m_creature, SOUND_TAKEOFF);
         Timer[EVENT_FLIGHT_SEQUENCE] = 2000;
         break;
     case 1:
         m_creature->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX()+1, m_creature->GetPositionY(), m_creature->GetPositionZ()+10);
         Timer[EVENT_FLIGHT_SEQUENCE] = 0;
         break;
     case 2:
         if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
         {
             Creature* Vapor = m_creature->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
             if(Vapor)
             {
                 Vapor->AI()->AttackStart(target);
                 m_creature->InterruptNonMeleeSpells(false);
                 m_creature->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug
                 Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true);
             }
         }else EnterEvadeMode();
         Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
         break;
     case 3:
         DespawnSummons(MOB_VAPOR_TRAIL);
         //m_creature->CastSpell(m_creature, SPELL_VAPOR_SELECT); need core support
         if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
         {
             //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support
             Creature* Vapor = m_creature->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
             if(Vapor)
             {
                 Vapor->AI()->AttackStart(target);
                 m_creature->InterruptNonMeleeSpells(false);
                 m_creature->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug
                 Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true);
             }
         }else EnterEvadeMode();
         Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
         break;
     case 4:
         DespawnSummons(MOB_VAPOR_TRAIL);
         Timer[EVENT_FLIGHT_SEQUENCE] = 1;
         break;
     case 5:
         if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
         {
             BreathX = target->GetPositionX();
             BreathY = target->GetPositionY();
             float x, y, z;
             target->GetContactPoint(m_creature, x, y, z, 70);
             m_creature->GetMotionMaster()->MovePoint(0, x, y, z+10);
         }else EnterEvadeMode();
         Timer[EVENT_FLIGHT_SEQUENCE] = 0;
         break;
     case 6:
         m_creature->SetOrientation(m_creature->GetAngle(BreathX, BreathY));
         m_creature->StopMoving();
         DoTextEmote("takes a deep breath.", NULL);
         Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
         break;
     case 7:
         m_creature->CastSpell(m_creature, SPELL_FOG_BREATH, true);
         {
             float x, y, z;
             m_creature->GetPosition(x, y, z);
             x = 2 * BreathX - x;
             y = 2 * BreathY - y;
             m_creature->GetMotionMaster()->MovePoint(0, x, y, z);
         }
         Timer[EVENT_SUMMON_FOG] = 1;
         Timer[EVENT_FLIGHT_SEQUENCE] = 0;
         break;
     case 8:
         m_creature->RemoveAurasDueToSpell(SPELL_FOG_BREATH);
         BreathCount++;
         Timer[EVENT_SUMMON_FOG] = 0;
         Timer[EVENT_FLIGHT_SEQUENCE] = 1;
         if(BreathCount < 3) FlightCount = 4;
         break;
     case 9:
         if(Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0))
         {
             float x, y, z;
             target->GetContactPoint(m_creature, x, y, z);
             m_creature->GetMotionMaster()->MovePoint(0, x, y, z);
         }else EnterEvadeMode();
         Timer[EVENT_FLIGHT_SEQUENCE] = 0;
         break;
     case 10:
         m_creature->RemoveMonsterMoveFlag(MONSTER_MOVE_LEVITATING);
         m_creature->StopMoving();
         m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
         EnterPhase(PHASE_GROUND);
         m_creature->AI()->AttackStart(SelectUnit(SELECT_TARGET_TOPAGGRO, 0));
         break;
     default:
         break;
     }
     FlightCount++;
 }
    void UpdateAI(const uint32 diff)
    {
        //Inhibitmagic_Timer
        if (Inhibitmagic_Timer < diff)
        {
            float dist;
            Map *map = m_creature->GetMap();
            Map::PlayerList const &PlayerList = map->GetPlayers();
            for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                if (Player* i_pl = i->getSource())
                    if (i_pl->isAlive() && (dist = i_pl->GetDistance(m_creature)) < 45)
                    {
                        i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC);
                        m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl);
                        if(dist < 35)
                            m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl);
                        if(dist < 25)
                            m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl);
                        if(dist < 15)
                            m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl);
                    }
            Inhibitmagic_Timer = 3000+(rand()%1000);
        }else Inhibitmagic_Timer -= diff;

        //Return since we have no target
        if (!UpdateVictim() )
            return;

        //Attractmagic_Timer
        if (Attractmagic_Timer < diff)
        {
            DoCast(m_creature,SPELL_ATTRACTMAGIC);
            Attractmagic_Timer = 30000;
            Carnivorousbite_Timer = 1500;
        }else Attractmagic_Timer -= diff;

        //Carnivorousbite_Timer
        if (Carnivorousbite_Timer < diff)
        {
            DoCast(m_creature,SPELL_CARNIVOROUSBITE);
            Carnivorousbite_Timer = 10000;
        }else Carnivorousbite_Timer -= diff;

        //FocusFire_Timer
        if (FocusFire_Timer < diff)
        {
            // Summon Focus Fire & Emote
            Unit *target = SelectUnit(SELECT_TARGET_RANDOM,1);
            if (target && target->GetTypeId() == TYPEID_PLAYER && target->isAlive())
            {
                focusedTarget = target;
                m_creature->SummonCreature(ENTRY_FOCUS_FIRE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,5500);

                // Emote
                std::string *emote = new std::string("focuses on ");
                emote->append(target->GetName());
                emote->append("!");
                DoTextEmote(emote->c_str(),NULL,true);
                delete emote;
            }
            FocusFire_Timer = 15000+(rand()%5000);
        }else FocusFire_Timer -= diff;

        DoMeleeAttackIfReady();
    }
Esempio n. 15
0
void UpdateAI(const uint32 diff)
{
// Cast Inhibit Magic even if out of combat
if(Inhibit_Magic_Timer < diff)
{
DoCast(m_creature, SPELL_INHIBIT_MAGIC);
Inhibit_Magic_Timer = 3000;
}else Inhibit_Magic_Timer -= diff;

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

// Focus Fire
if(Focus_Fire_Timer < diff)
{ 
if(Intern_Focus_Fire_Timer < 400 && Intern_Focus_Fire_Counter == 0)
{
target = SelectUnit(SELECT_TARGET_RANDOM, 0);

if(target)
{
DoTextEmote(MESSAGE_FOCUS_FIRE, target);
Creature* FocusFireDummy = m_creature->SummonCreature(MOB_FOCUS_FIRE_DUMMY, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0,TEMPSUMMON_TIMED_DESPAWN, 4000);
Intern_Focus_Fire_Counter++;
}else
Intern_Focus_Fire_Counter = 4;
}
else if(Intern_Focus_Fire_Timer > 400 && Intern_Focus_Fire_Timer < 800 && Intern_Focus_Fire_Counter == 1)
{
if(target)
{
Creature* FocusFireDummy = m_creature->SummonCreature(MOB_FOCUS_FIRE_DUMMY, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0,TEMPSUMMON_TIMED_DESPAWN, 4000);
Intern_Focus_Fire_Counter++;
}else
Intern_Focus_Fire_Counter = 4;
}
else if(Intern_Focus_Fire_Timer > 800 && Intern_Focus_Fire_Timer < 1200 && Intern_Focus_Fire_Counter == 2)
{
if(target)
{
Creature* FocusFireDummy = m_creature->SummonCreature(MOB_FOCUS_FIRE_DUMMY, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0,TEMPSUMMON_TIMED_DESPAWN, 4000);
Intern_Focus_Fire_Counter++;
}else
Intern_Focus_Fire_Counter = 4;
}
else if(Intern_Focus_Fire_Timer > 1200 && Intern_Focus_Fire_Counter == 3)
{
if(target)
{
Creature* FocusFireDummy = m_creature->SummonCreature(MOB_FOCUS_FIRE_DUMMY, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0,TEMPSUMMON_TIMED_DESPAWN, 4000);
Intern_Focus_Fire_Counter++;
}else
Intern_Focus_Fire_Counter = 4;
}else if(Intern_Focus_Fire_Counter == 4)
{
Focus_Fire_Timer = 20000;
Intern_Focus_Fire_Timer = 0;
Intern_Focus_Fire_Counter = 0;
}else
Intern_Focus_Fire_Timer += diff;
}else Focus_Fire_Timer -= diff;

// Attract Magic
if(Attract_Magic_Timer < diff)
{
DoCast(m_creature, SPELL_ATTRACT_MAGIC);
Attract_Magic_Timer = 30000;
}else Attract_Magic_Timer -= diff;

// Carnivorous Bite
if(Carnivorous_Bite_Timer < diff)
{
DoCast(m_creature->getVictim(), SPELL_CARNIVOROUS_BITE);
Carnivorous_Bite_Timer = 6000;
}else Carnivorous_Bite_Timer -= diff;

DoMeleeAttackIfReady();
}
Esempio n. 16
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
            return;

        //HatefullStrike_Timer
        if (HatefullStrike_Timer < diff)
        {
            //Cast Hateful strike on the player with the highest
            //amount of HP within melee distance
            uint32 MostHP = 0;
            Unit* pMostHPTarget = NULL;
            Unit* pTemp = NULL;
            std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();

            for (i = m_creature->getThreatManager().getThreatList().begin(); i!=m_creature->getThreatManager().getThreatList().end(); ++i)
            {
                pTemp = Unit::GetUnit((*m_creature),(*i)->getUnitGuid());
                if (pTemp && pTemp->isAlive() && pTemp->GetHealth() > MostHP && m_creature->GetDistance2d(pTemp) < 25)
                {
                    MostHP = pTemp->GetHealth();
                    pMostHPTarget = pTemp;
                }
            }

            if (pMostHPTarget)
                DoCast(pMostHPTarget, SPELL_HATEFULSTRIKE);

            HatefullStrike_Timer = 3000;
        }else HatefullStrike_Timer -= diff;

        //Enrage_Timer
        if (Enrage_Timer < diff)
        {
            //Cast Berserker Rage
            DoCast(m_creature, SPELL_BERSERK);
            DoTextEmote(EMOTE_BERSERK, m_creature->getVictim());

            //5 minutes until we should cast this agian
            Enrage_Timer = 300000;
        }else Enrage_Timer -= diff;

        //Slimebolt_Timer
        if (Slimebolt_Timer < diff)
        {
            //Cast Slime bolt
            DoCast(m_creature->getVictim(),SPELL_SLIMEBOLT);

            //5 seconds until we should cast this agian
            Slimebolt_Timer = 5000;
        }else Slimebolt_Timer -= diff;

        //Enrage if not already enraged and below 5%
        if (!Enraged && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 5)
        {
            DoCast(m_creature,SPELL_ENRAGE);
            DoTextEmote(EMOTE_ENRAGE,NULL);
            Enraged = true;
        }

        DoMeleeAttackIfReady();
    }
Esempio n. 17
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
            return;

        //Earthquake_Timer
        if(Earthquake_Timer < diff)
        {
            if(!Earthquake)
            {
                DoCast(m_creature->getVictim(), SPELL_EARTHQUAKE);
                Earthquake = true;
                Earthquake_Timer = 10000;
            }
            else
            {
                switch(rand()%2)
                {
                    case 0:
                    DoPlaySoundToSet(m_creature, SOUND_SUMMON1);
                    DoYell(SAY_SUMMON1, LANG_UNIVERSAL, NULL);
                    break;

                    case 1:
                    DoPlaySoundToSet(m_creature, SOUND_SUMMON2);
                    DoYell(SAY_SUMMON2, LANG_UNIVERSAL, NULL);
                    break;
                }

                //north
                SummonMurloc(486.10, -723.64, -7.14);
                SummonMurloc(482.58, -723.78, -7.14);
                SummonMurloc(479.38, -723.91, -7.14);
                SummonMurloc(476.03, -723.86, -7.14);
                SummonMurloc(472.69, -723.69, -7.14);
                SummonMurloc(469.04, -723.63, -7.14);

                //south
                SummonMurloc(311.63, -725.04, -13.15);
                SummonMurloc(307.81, -725.34, -13.15);
                SummonMurloc(303.91, -725.64, -13.06);
                SummonMurloc(300.23, -726, -11.89);
                SummonMurloc(296.82, -726.33, -10.82);
                SummonMurloc(293.64, -726.64, -9.81);

                DoTextEmote(EMOTE_EARTHQUAKE, NULL);

                Earthquake = false;
                Earthquake_Timer = 40000+rand()%5000;
            }
        }else Earthquake_Timer -= diff;

        //TidalWave_Timer
        if(TidalWave_Timer < diff)
        {
            DoCast(m_creature->getVictim(), SPELL_TIDAL_WAVE);
            TidalWave_Timer = 20000;
        }else TidalWave_Timer -= diff;

        if(!Phase2)
        {
            //WateryGrave_Timer
            if(WateryGrave_Timer < diff)
            {
                //Teleport 4 players under the waterfalls
                Unit *target;
                for(uint8 i = 0; i < 4; i++)
                {
                    target = SelectUnit(SELECT_TARGET_RANDOM, 1);
                    if(target && (target->GetTypeId() == TYPEID_PLAYER) && !target->HasAura(SPELL_WATERY_GRAVE, 0) && target->IsWithinDistInMap(m_creature, 50))
                        ApplyWateryGrave(target, i);
                }

                switch(rand()%2)
                {
                case 0:
                    DoPlaySoundToSet(m_creature, SOUND_SUMMON_BUBL1);
                    DoYell(SAY_SUMMON_BUBL1, LANG_UNIVERSAL, NULL);
                    break;

                case 1:
                    DoPlaySoundToSet(m_creature, SOUND_SUMMON_BUBL2);
                    DoYell(SAY_SUMMON_BUBL2, LANG_UNIVERSAL, NULL);
                    break;

                case 2:
                    break;
                }

                DoTextEmote(EMOTE_WATERY_GRAVE, NULL);

                WateryGrave_Timer = 30000;
            }else WateryGrave_Timer -= diff;

            //Start Phase2
            if((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 25)
                Phase2 = true;
        }
        else
        {
            //WateryGlobules_Timer
            if(WateryGlobules_Timer < diff)
            {
                SummonWaterGlobule(WATERY_GRAVE_X1, WATERY_GRAVE_Y1, WATERY_GRAVE_Z1);
                SummonWaterGlobule(WATERY_GRAVE_X2, WATERY_GRAVE_Y2, WATERY_GRAVE_Z2);
                SummonWaterGlobule(WATERY_GRAVE_X3, WATERY_GRAVE_Y3, WATERY_GRAVE_Z3);
                SummonWaterGlobule(WATERY_GRAVE_X4, WATERY_GRAVE_Y4, WATERY_GRAVE_Z4);

                DoTextEmote(EMOTE_WATERY_GLOBULES, NULL);

                WateryGlobules_Timer = 25000;
            }else WateryGlobules_Timer -= diff;
        }

        DoMeleeAttackIfReady();
    }
Esempio n. 18
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
            return;

        //Shimmer_Timer Timer
        if (Shimmer_Timer < diff)
        {
            //Remove old vurlnability spell
            if (CurrentVurln_Spell)
                m_creature->RemoveAurasDueToSpell(CurrentVurln_Spell);

            //Cast new random vurlnabilty on self
            uint32 spell;
            switch (rand()%5)
            {
                case 0: spell = SPELL_FIRE_VURNALBILTY; break;
                case 1: spell = SPELL_FROST_VURNALBILTY; break;
                case 2: spell = SPELL_SHADOW_VURNALBILTY; break;
                case 3: spell = SPELL_NATURE_VURNALBILTY; break;
                case 4: spell = SPELL_ARCANE_VURNALBILTY; break;
            }

            DoCast(m_creature,spell);
            CurrentVurln_Spell = spell;

            DoTextEmote(EMOTE_SHIMMER, NULL);
            Shimmer_Timer = 45000;
        }else Shimmer_Timer -= diff;

        //Breath1_Timer
        if (Breath1_Timer < diff)
        {
            DoCast(m_creature->getVictim(),Breath1_Spell);
            Breath1_Timer = 60000;
        }else Breath1_Timer -= diff;

        //Breath2_Timer
        if (Breath2_Timer < diff)
        {
            DoCast(m_creature->getVictim(),Breath2_Spell);
            Breath2_Timer = 60000;
        }else Breath2_Timer -= diff;

        //Affliction_Timer
        if (Affliction_Timer < diff)
        {
            uint32 SpellAfflict = 0;

            switch (rand()%5)
            {
                case 0: SpellAfflict = SPELL_BROODAF_BLUE; break;
                case 1: SpellAfflict = SPELL_BROODAF_BLACK; break;
                case 2: SpellAfflict = SPELL_BROODAF_RED; break;
                case 3: SpellAfflict = SPELL_BROODAF_BRONZE; break;
                case 4: SpellAfflict = SPELL_BROODAF_GREEN; break;
            }

            std::list<HostilReference*>::iterator i;

            for (i = m_creature->getThreatManager().getThreatList().begin();i != m_creature->getThreatManager().getThreatList().end(); ++i)
            {
                Unit* pUnit = NULL;
                pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());

                if(pUnit)
                {
                    //Cast affliction
                    DoCast(pUnit, SpellAfflict, true);

                    //Chromatic mutation if target is effected by all afflictions
                    if (pUnit->HasAura(SPELL_BROODAF_BLUE,0)
                        && pUnit->HasAura(SPELL_BROODAF_BLACK,0)
                        && pUnit->HasAura(SPELL_BROODAF_RED,0)
                        && pUnit->HasAura(SPELL_BROODAF_BRONZE,0)
                        && pUnit->HasAura(SPELL_BROODAF_GREEN,0))
                    {
                        //target->RemoveAllAuras();
                        //DoCast(target,SPELL_CHROMATIC_MUT_1);

                        //Chromatic mutation is causing issues
                        //Assuming it is caused by a lack of core support for Charm
                        //So instead we instant kill our target

                        //WORKAROUND
                        if (pUnit->GetTypeId() == TYPEID_PLAYER)
                        {
                            DoWhisper(TEMP_MUTATE_WHISPER, pUnit);
                            pUnit->CastSpell(pUnit, 5, false);
                        }
                    }
                }
            }

            Affliction_Timer = 10000;
        }else Affliction_Timer -= diff;

        //Frenzy_Timer
        if (Frenzy_Timer < diff)
        {
            DoCast(m_creature,SPELL_FRENZY);
            DoTextEmote(EMOTE_FRENZY,NULL);
            Frenzy_Timer = 10000 + (rand() % 5000);
        }else Frenzy_Timer -= diff;

        //Enrage if not already enraged and below 20%
        if (!Enraged && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 20)
        {
            DoCast(m_creature,SPELL_ENRAGE);
            Enraged = true;
        }

        DoMeleeAttackIfReady();
    }