void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);
                _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STAT_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_ENRAGE:
                            DoScriptText(SAY_BRUNDIR_BERSERK, me);
                            DoCast(SPELL_BERSERK);
                            break;
                        case EVENT_CHAIN_LIGHTNING:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
                                DoCast(target, RAID_MODE(SPELL_CHAIN_LIGHTNING_N, SPELL_CHAIN_LIGHTNING_H));
                            events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(3000, 5000), 1);
                            break;
                        case EVENT_OVERLOAD:
                            DoCast(RAID_MODE(SPELL_OVERLOAD, SPELL_OVERLOAD_H));
                            events.ScheduleEvent(EVENT_OVERLOAD, urand(60000, 80000), 1);
                            break;
                        case EVENT_LIGHTNING_WHIRL:
                            DoCast(RAID_MODE(SPELL_LIGHTNING_WHIRL, SPELL_LIGHTNING_WHIRL_H));
                            events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000, 40000), 1);
                            break;
                        case EVENT_THREAT_WIPE:
                            DoResetThreat();
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            {
                                me->AddThreat(target, 99999.9f);
                                me->GetMotionMaster()->MovePoint(POINT_CHASE, target->GetPositionX(), target->GetPositionY(), 435.0f);
                            }
                            events.ScheduleEvent(EVENT_THREAT_WIPE, 5000);
                            break;
                        case EVENT_LIGHTNING_TENDRILS_START:
                            me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
                            me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);
                            DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H));
                            me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
                            me->SendMovementFlagUpdate();
                            me->GetMotionMaster()->MovePoint(POINT_FLY, me->GetPositionX(), me->GetPositionY(), 435.0f);
                            events.DelayEvents(35000, 1);
                            break;
                        case EVENT_LIGHTNING_TENDRILS_END:
                            me->GetMotionMaster()->MovePoint(POINT_LAND, me->GetPositionX(), me->GetPositionY(), 427.28f);
                            me->RemoveAurasDueToSpell(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H));
                            events.ScheduleEvent(EVENT_LIGHTNING_TENDRILS_START, urand(40000, 80000));
                            events.CancelEvent(EVENT_THREAT_WIPE);
                            break;
                    }
                }

            }
Exemplo n.º 2
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            _DoAggroPulse(diff);
            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_STRIKE:
                        DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE);
                        events.ScheduleEvent(EVENT_STRIKE, 30000);
                        return;
                    case EVENT_SHOUT:
                        DoCastAOE(SPELL_DISRUPTING_SHOUT);
                        events.ScheduleEvent(EVENT_SHOUT, 25000);
                        return;
                    case EVENT_KNIFE:
                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f))
                            DoCast(pTarget, SPELL_JAGGED_KNIFE);
                        events.ScheduleEvent(EVENT_KNIFE, 10000);
                        return;
                    case EVENT_COMMAND:
                        DoPlaySoundToSet(me, SOUND_COMMND);
                        events.ScheduleEvent(EVENT_COMMAND, 40000);
                        return;
                }
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 3
0
        void UpdateAI(const uint32 diff)
        {
            if (checkFeugenAlive && checkStalaggAlive)
                uiAddsTimer = 0;

            if (checkStalaggAlive != checkFeugenAlive)
            {
                uiAddsTimer += diff;
                if (uiAddsTimer > 5000)
                {
                    if (!checkStalaggAlive)
                    {
                        if (instance)
                            if (Creature *pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG)))
                                pStalagg->Respawn();
                    }
                    else
                    {
                        if (instance)
                            if (Creature *pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
                                pFeugen->Respawn();
                    }
                }
            }

            if (!UpdateVictim())
                return;

            _DoAggroPulse(diff);
            events.Update(diff);

            if (me->HasUnitState(UNIT_STAT_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_SHIFT:
                        DoCastAOE(SPELL_POLARITY_SHIFT);
                        events.ScheduleEvent(EVENT_SHIFT, 30000);
                        events.RescheduleEvent(EVENT_CHAIN, 6000);
                        return;
                    case EVENT_CHAIN:
                        DoCast(me->getVictim(), RAID_MODE(SPELL_CHAIN_LIGHTNING, H_SPELL_CHAIN_LIGHTNING));
                        events.ScheduleEvent(EVENT_CHAIN, urand(10000,20000));
                        return;
                    case EVENT_BERSERK:
                        me->InterruptNonMeleeSpells(false);
                        DoCast(me, SPELL_BERSERK);
                        return;
                }
            }

            Unit* pMelee = SelectTarget(SELECT_TARGET_RANDOM, 0, me->GetMeleeReach(), true);
            if (events.GetTimer() > 15000 && !pMelee)  // && !me->IsWithinMeleeRange(me->getVictim())
                DoCast(me->getVictim(), SPELL_BALL_LIGHTNING);
            else
                DoMeleeAttackIfReady();
        }
Exemplo n.º 4
0
            void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                _DoAggroPulse(diff);
                events.Update(diff);

                if (me->HasUnitState(UNIT_STATE_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_TERRIFYING_SCREECH:
                            DoCast(SPELL_TERRIFYING_SCREECH);
                            events.ScheduleEvent(EVENT_TERRIFYING_SCREECH, 35000);
                            return;
                        case EVENT_SONIC_SCREECH:
                            DoCastVictim(RAID_MODE(SPELL_SONIC_SCREECH_10, SPELL_SONIC_SCREECH_25));
                            events.ScheduleEvent(EVENT_SONIC_SCREECH, 27000);
                            return;
                        case EVENT_GUARDIAN_SWARM:
                            DoCastVictim(SPELL_SUMMON_SWARMING_GUARDIAN);
                            events.ScheduleEvent(EVENT_GUARDIAN_SWARM, 35000);
                            return;
                        case EVENT_SENTINEL_BLAST:
                            DoCast(RAID_MODE(SPELL_SENTINEL_BLAST_10, SPELL_SENTINEL_BLAST_25));
                            events.ScheduleEvent(EVENT_SENTINEL_BLAST, 25000);
                            return;
                        case EVENT_FERAL_DEFENDER_SUMMON:
                            DoCast(SPELL_FERAL_DEFENDER_SUMMON);
                            if (Creature* defender = me->FindNearestCreature(NPC_FERAL_DEFENDER, 100.0f, true))
                            {
                                defender->AddAura(SPELL_FERAL_ESSENCE, defender);
                                defender->SetAuraStack(SPELL_FERAL_ESSENCE, defender, _defenderLifeCount);
                            }
                            return;
                        case EVENT_FERAL_DEFENDER_RESURRECTION:
                            if (Creature* defender = me->FindNearestCreature(NPC_FERAL_DEFENDER, 500.0f, false))
                            {
                                defender->Respawn();
                                defender->SetInCombatWithZone();
                                defender->AddAura(SPELL_FERAL_ESSENCE, defender);
                                defender->SetAuraStack(SPELL_FERAL_ESSENCE, defender, _defenderLifeCount);
                            }
                            return;
                        case EVENT_BERSERK:
                            DoScriptText(SAY_BERSERK, me);
                            DoCast(me, SPELL_BERSERK, true);
                            return;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
Exemplo n.º 5
0
            void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);
                _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STAT_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_ROCK_SHARDS:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                                DoCast(target, SPELL_ROCK_SHARDS);
                            events.ScheduleEvent(EVENT_ROCK_SHARDS, 15000, 1);
                            break;
                        case EVENT_LEAP:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -10, true))
                            {
                                DoCast(target, SPELL_CRUSHING_LEAP);
                                events.ScheduleEvent(EVENT_LEAP, 30000);
                            }
                            else
                                events.ScheduleEvent(EVENT_LEAP, 3000);
                            break;
                        case EVENT_STOMP:
                            DoCast(SPELL_STOMP);
                            events.DelayEvents(3000, 1);
                            events.ScheduleEvent(EVENT_STOMP, 45000);
                            break;
                        case EVENT_IMPALE_DAMAGE:
                        {
                            Unit* target = ObjectAccessor::GetUnit(*me, _impaleTarget);
                            if (target && target->isAlive())
                            {
                                DoCast(target, SPELL_IMPALE, true);
                                _impaleTarget = 0;
                            }
                            break;
                        }
                        case EVENT_BERSERK:
                            DoCast(me, SPELL_BERSERK, true);
                            DoScriptText(EMOTE_BERSERK, me);
                            break;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
Exemplo n.º 6
0
        void UpdateAI(uint32 const diff)
        {
            if (!me->isInCombat() && me->isAlive())
            {
                if (_spawntextTimer <= diff)
                {
                    Talk(SAY_SPAWN);
                    _spawntextTimer = 60 *IN_MILLISECONDS;
                }
                else
                    _spawntextTimer -= diff;
            }

            if (!UpdateVictim())
                return;

            events.Update(diff);
            _DoAggroPulse(diff);

            if (me->HasUnitState(UNIT_STATE_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_ENERGIZE_CORES:
                    DoCast(me, DUNGEON_MODE(SPELL_ENERGIZE_CORES, SPELL_ENERGIZE_CORES_H));
                    break;
                case EVENT_ENERGIZE_CORES_VISUAL:
                    energizedCore += 2;
                    if (energizedCore >= 8)
                        energizedCore -= 8;
                    DoCast(me, SPELL_ENERGIZE_CORES_VISUAL);
                    events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000);
                    events.ScheduleEvent(EVENT_ENERGIZE_CORES, 4000);
                    break;
                case EVENT_CALL_AZURE:
                    DoCast(me, SPELL_CALL_AZURE_RING_CAPTAIN);
                    Talk(SAY_AIR_STRIKE);
                    events.ScheduleEvent(EVENT_CALL_AZURE, urand(20, 25) * IN_MILLISECONDS);
                    break;
                case EVENT_AMPLIFY_MAGIC:
                    DoCastVictim(DUNGEON_MODE(SPELL_CALL_AMPLIFY_MAGIC, SPELL_CALL_AMPLIFY_MAGIC_H));
                    events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(17, 20) * IN_MILLISECONDS);
                    break;
                }
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 7
0
            void UpdateAI(uint32 const diff)
            {
                if (!me->isInCombat() && me->isAlive())
                {
                    if (_spawntextTimer <= diff)
                    {
                        Talk(SAY_SPAWN);
                        _spawntextTimer = 60 *IN_MILLISECONDS;
                    }
                    else
                        _spawntextTimer -= diff;
                }                
            
                if (!UpdateVictim())
                    return;

                events.Update(diff);
                _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STAT_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_ARCANE_BARRAGE:
                            DoCastVictim(DUNGEON_MODE(SPELL_ARCANE_BARRAGE, SPELL_ARCANE_BARRAGE_H));
                            events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3, 10) * IN_MILLISECONDS, 0, PHASE_NORMAL);
                            break;
                        case EVENT_ARCANE_VOLLEY:
                            DoCastAOE(DUNGEON_MODE(SPELL_ARCANE_VOLLEY, SPELL_ARCANE_VOLLEY_H));
                            events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10, 25) * IN_MILLISECONDS, 0, PHASE_NORMAL);
                            break;
                        case EVENT_ENRAGED_ASSAULT:
                            Talk(SAY_FRENZY);
                            DoCast(SPELL_ENRAGED_ASSAULT);
                            events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35, 50) * IN_MILLISECONDS, 0, PHASE_NORMAL);
                            break;
                        case EVENT_SUMMON_LEY_WHELP:
                            for (uint8 i = 0; i < 3; ++i)
                                DoCast(SPELL_SUMMON_LEY_WHELP);
                            events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, 15*IN_MILLISECONDS, 0, PHASE_NORMAL);
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
            void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);
                _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STAT_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_ENRAGE:
                            DoScriptText(SAY_MOLGEIM_BERSERK, me);
                            DoCast(SPELL_BERSERK);
                            break;
                        case EVENT_RUNE_OF_POWER:
                        {
                            Unit* target = DoSelectLowestHpFriendly(60);
                            if (!target || !target->isAlive())
                                target = me;
                            DoCast(target, SPELL_SUMMON_RUNE_OF_POWER);
                            events.ScheduleEvent(EVENT_RUNE_OF_POWER, 60000);
                            break;
                        }
                        case EVENT_SHIELD_OF_RUNES:
                            DoCast(me, RAID_MODE(SPELL_SHIELD_OF_RUNES, SPELL_SHIELD_OF_RUNES_H));
                            events.ScheduleEvent(EVENT_SHIELD_OF_RUNES, urand(27000, 34000));
                            break;
                        case EVENT_RUNE_OF_DEATH:
                            DoScriptText(SAY_MOLGEIM_RUNE_DEATH, me);
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
                                DoCast(target, SPELL_RUNE_OF_DEATH);
                            events.ScheduleEvent(EVENT_RUNE_OF_DEATH, urand(30000, 40000));
                            break;
                        case EVENT_RUNE_OF_SUMMONING:
                            DoScriptText(SAY_MOLGEIM_SUMMON, me);
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
                                DoCast(target, SPELL_RUNE_OF_SUMMONING);
                            events.ScheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(35000, 45000));
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
Exemplo n.º 9
0
            void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);
                _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STAT_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_ENERGIZE_CORES:
                            DoCast(me, DUNGEON_MODE(SPELL_ENERGIZE_CORES, SPELL_ENERGIZE_CORES_H));
                            events.CancelEvent(EVENT_ENERGIZE_CORES);
                            break;
                        case EVENT_ENERGIZE_CORES_VISUAL:
                            if (!firstCoreEnergize)
                            {
                                coreEnergizeOrientation = me->GetOrientation();
                                firstCoreEnergize = true;
                            }
                            else
                                coreEnergizeOrientation = MapManager::NormalizeOrientation(coreEnergizeOrientation - 2.0f);

                            DoCast(me, SPELL_ENERGIZE_CORES_VISUAL);
                            events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000);
                            events.ScheduleEvent(EVENT_ENERGIZE_CORES, 4000);
                            break;
                        case EVENT_CALL_AZURE:
                            DoCast(me, SPELL_CALL_AZURE_RING_CAPTAIN);
                            Talk(SAY_AZURE);
                            Talk(SAY_AZURE_EMOTE);
                            events.ScheduleEvent(EVENT_CALL_AZURE, urand(20, 25) * IN_MILLISECONDS);
                            break;
                        case EVENT_AMPLIFY_MAGIC:
                            DoCastVictim(DUNGEON_MODE(SPELL_CALL_AMPLIFY_MAGIC, SPELL_CALL_AMPLIFY_MAGIC_H));
                            events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(17, 20) * IN_MILLISECONDS);
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
            void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);
                _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STAT_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_ENRAGE:
                            DoScriptText(SAY_STEELBREAKER_BERSERK, me);
                            DoCast(SPELL_BERSERK);
                            break;
                        case EVENT_FUSION_PUNCH:
                            DoCastVictim(RAID_MODE<uint32>(SPELL_FUSION_PUNCH, SPELL_FUSION_PUNCH_H));
                            events.ScheduleEvent(EVENT_FUSION_PUNCH, urand(13000, 22000));
                            break;
                        case EVENT_STATIC_DISRUPTION:
                        {
                            Unit* target = GetDisruptionTarget();
                            if (!target)
                                target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true);
                            if (target)
                                DoCast(target, RAID_MODE<uint32>(SPELL_STATIC_DISRUPTION, SPELL_STATIC_DISRUPTION_H));
                            events.ScheduleEvent(EVENT_STATIC_DISRUPTION, 20000);
                            break;
                        }
                        case EVENT_OVERWHELMING_POWER:
                            if (me->getVictim() && !me->getVictim()->HasAura(RAID_MODE<uint32>(SPELL_OVERWHELMING_POWER, SPELL_OVERWHELMING_POWER_H)))
                            {
                                DoScriptText(SAY_STEELBREAKER_POWER, me);
                                DoCastVictim(RAID_MODE<uint32>(SPELL_OVERWHELMING_POWER, SPELL_OVERWHELMING_POWER_H));
                            }
                            events.ScheduleEvent(EVENT_OVERWHELMING_POWER, 2000);
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
Exemplo n.º 11
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() || !CheckInRoom())
                return;

            _DoAggroPulse(diff);
            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_DISRUPT:
                        DoCastAOE(SPELL_SPELL_DISRUPTION);
                        events.ScheduleEvent(EVENT_DISRUPT, urand(5000, 10000));
                        break;
                    case EVENT_FEVER:
                        DoCastAOE(SPELL_DECREPIT_FEVER);
                        events.ScheduleEvent(EVENT_FEVER, urand(20000, 25000));
                        break;
                    case EVENT_PHASE:
                        // TODO : Add missing texts for both phase switches
                        EnterPhase(phase == PHASE_FIGHT ? PHASE_DANCE : PHASE_FIGHT);
                        break;
                    case EVENT_ERUPT:
                        instance->SetData(DATA_HEIGAN_ERUPT, eruptSection);
                        TeleportHeiganCheaters();

                        if (eruptSection == 0)
                            eruptDirection = true;
                        else if (eruptSection == 3)
                            eruptDirection = false;

                        eruptDirection ? ++eruptSection : --eruptSection;

                        events.ScheduleEvent(EVENT_ERUPT, phase == PHASE_FIGHT ? 10000 : 4000);
                        break;
                }
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 12
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING))
                return;

            events.Update(diff);
            _DoAggroPulse(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {

                    // Ground Phase
                case EVENT_SONAR_PULSE:
                    for(uint8 i=0; i<=7; i++)
                        me->SummonCreature(NPC_SONAR_PULSE,me->GetPosition(),TEMPSUMMON_TIMED_DESPAWN,30000);

                    events.ScheduleEvent(EVENT_SONAR_PULSE, 50000);
                    break;
                case EVENT_MODULATION:

                    events.ScheduleEvent(EVENT_MODULATION, 20000);
                    break;
                case EVENT_SONIC_BREATH:

                    events.ScheduleEvent(EVENT_SONIC_BREATH, 20000);
                    break;
                case EVENT_SEARING_FLAMES:

                    events.ScheduleEvent(EVENT_SONAR_PULSE, 20000);
                    break;

                default:
                    break;
                }
            }		

            if(isOnGround)
                DoMeleeAttackIfReady();
        }
Exemplo n.º 13
0
            void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);
                _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STATE_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_CHAIN_LIGHTNING:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                                DoCast(target, SPELL_CHAIN_LIGHTNING);
                            events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(10000, 12000));
                            break;
                        case EVENT_LIGHTNING_NOVA:
                            DoCastAOE(SPELL_LIGHTNING_NOVA);
                            events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000);
                            break;
                        case EVENT_OVERCHARGE:
                            DoCast(SPELL_OVERCHARGE);
                            DoScriptText(EMOTE_OVERCHARGE, me);
                            events.ScheduleEvent(EVENT_OVERCHARGE, 45000);
                            break;
                        case EVENT_BERSERK:
                            DoCast(me, SPELL_BERSERK, true);
                            DoScriptText(EMOTE_BERSERK, me);
                            break;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
Exemplo n.º 14
0
            void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);
                _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STAT_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BOMB_SUMMON:
                            Position position;
                            me->GetPosition(&position);
                            for (uint8 i = 0; i <= (_postPull ? 3 : 0); ++i)
                            {
                                me->GetRandomNearPosition(position, float(urand(0, 10)));
                                me->SummonCreature(NPC_UNSTABLE_SPHERE, position);
                            }
                            events.ScheduleEvent(EVENT_BOMB_SUMMON, 3000);
                            break;
                        case EVENT_MAGIC_PULL:
                            Talk(SAY_PULL);
                            DoCast(SPELL_MAGIC_PULL);
                            _postPull = true;
                            events.ScheduleEvent(EVENT_MAGIC_PULL, 15000);
                            break;
                        case EVENT_STOMP:
                            Talk(SAY_STOMP);
                            DoCast(SPELL_THUNDERING_STOMP);
                            events.ScheduleEvent(EVENT_STOMP, 17000);
                            break;
                    }
                }
                DoMeleeAttackIfReady();
            }
Exemplo n.º 15
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            _DoAggroPulse(diff);
            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_AURA:
                        DoCastAOE(SPELL_NECROTIC_AURA);
                        events.ScheduleEvent(EVENT_AURA, 20000);
                        break;
                    case EVENT_BLOOM:
                        // TODO : Add missing text
                        DoCastAOE(SPELL_SUMMON_SPORE, true);
                        DoCastAOE(RAID_MODE(SPELL_DEATHBLOOM, H_SPELL_DEATHBLOOM));
                        events.ScheduleEvent(EVENT_BLOOM, 30000);
                        break;
                    case EVENT_DOOM:
                        DoCastAOE(RAID_MODE(SPELL_INEVITABLE_DOOM, H_SPELL_INEVITABLE_DOOM));
                        events.ScheduleEvent(EVENT_DOOM, events.GetTimer() < 5*60000 ? 30000 : 15000);
                        break;
                    case EVENT_BERSERK:
                        if(GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
                        {
                            if(!me->HasAura(SPELL_BERSERK))
                                DoCast(me,SPELL_BERSERK,true);
                        }
                         events.ScheduleEvent(EVENT_BERSERK, 60000);
                        break;
                }
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 16
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() || !CheckInRoom())
                return;

            _DoAggroPulse(diff);
            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_CURSE:
                        if(!me->IsNonMeleeSpellCasted(false))
                        {
                            DoCastAOE(SPELL_CURSE_PLAGUEBRINGER);
                        events.ScheduleEvent(EVENT_CURSE, urand(50000, 60000));
                        }
                        return;
                    case EVENT_WARRIOR:
                        DoScriptText(SAY_SUMMON, me);
                        SummonUndead(MOB_WARRIOR, RAID_MODE(2, 3));
                        events.ScheduleEvent(EVENT_WARRIOR, 30000);
                        return;
                    case EVENT_BLINK:
                        if(!me->IsNonMeleeSpellCasted(false))
                        {
                            DoCastAOE(SPELL_CRIPPLE, true);
                            DoCastAOE(SPELL_BLINK);
                            DoResetThreat();
                            events.ScheduleEvent(EVENT_BLINK, 20000);
                        }
                        return;
                    case EVENT_BALCONY:
                        me->SetReactState(REACT_PASSIVE);
                        me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        me->AttackStop();
                        me->RemoveAllAuras();
                        me->NearTeleportTo(TELE_X, TELE_Y, TELE_Z, TELE_O);
                        me->getThreatManager().resetAllAggro();
                        events.Reset();
                        events.ScheduleEvent(EVENT_WAVE, 10000);
                        waveCount = 0;
                        return;
                    case EVENT_WAVE:
                        DoScriptText(SAY_SUMMON, me);
                        switch (balconyCount)
                        {
                            case 0: SummonUndead(MOB_CHAMPION, RAID_MODE(2, 4)); break;
                            case 1: SummonUndead(MOB_CHAMPION, RAID_MODE(1, 2));
                                    SummonUndead(MOB_GUARDIAN, RAID_MODE(1, 2)); break;
                            case 2: SummonUndead(MOB_GUARDIAN, RAID_MODE(2, 4)); break;
                            default:SummonUndead(MOB_CHAMPION, RAID_MODE(5, 10));
                                    SummonUndead(MOB_GUARDIAN, RAID_MODE(5, 10));break;
                        }
                        ++waveCount;
                        events.ScheduleEvent(waveCount < 2 ? EVENT_WAVE : EVENT_GROUND, 30000);
                        return;
                    case EVENT_GROUND:
                    {
                        ++balconyCount;
                        float x, y, z, o;
                        me->GetHomePosition(x, y, z, o);
                        me->NearTeleportTo(x, y, z, o);
                        events.ScheduleEvent(EVENT_BALCONY, 110000);
                        EnterPhaseGround();
                        return;
                    }
                }
            }

            if(balconyCount > 3)
            {
                if(!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && !me->HasAura(SPELL_BERSERK))
                    DoCast(me,SPELL_BERSERK,true);
            }

            if (me->HasReactState(REACT_AGGRESSIVE))
                DoMeleeAttackIfReady();
        }
Exemplo n.º 17
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            _DoAggroPulse(diff);

            if (enterHardMode)
            {
                SetPhaseOne();
                enterHardMode = false;
            }

            // Handles spell casting. These spells only occur during phase 1 or hard mode
            if (phase == 1 || hardMode)
            {
                if (uiSearingLightTimer <= diff)
                {
                    if (!me->HasAura(SPELL_TYMPANIC_TANTRUM))
                        DoCast(me, RAID_MODE<uint32>(SPELL_SEARING_LIGHT_10, SPELL_SEARING_LIGHT_25), true);
                    uiSearingLightTimer = TIMER_SEARING_LIGHT;
                } else uiSearingLightTimer -= diff;

                if (uiGravityBombTimer <= diff)
                {
                    if (!me->HasAura(SPELL_TYMPANIC_TANTRUM))
                        DoCast(me, RAID_MODE<uint32>(SPELL_GRAVITY_BOMB_10, SPELL_GRAVITY_BOMB_25), true);
                    uiGravityBombTimer = TIMER_GRAVITY_BOMB;
                } else uiGravityBombTimer -= diff;

                if (uiTympanicTantrumTimer <= diff)
                {
                    DoScriptText(SAY_TYMPANIC_TANTRUM, me);
                    me->MonsterTextEmote(EMOTE_TYMPANIC, 0, true);
                    DoCast(SPELL_TYMPANIC_TANTRUM);
                    uiTympanicTantrumTimer = TIMER_TYMPANIC_TANTRUM;
                } else uiTympanicTantrumTimer -= diff;
            }

            if (!hardMode)
            {
                if (phase == 1)
                {
                    if (HealthBelowPct(100 - (heart_exposed + 1) * 25))
                        exposeHeart();

                    DoMeleeAttackIfReady();
                }
                else
                {
                    // Start summoning adds
                    if (uiSpawnAddTimer <= diff)
                    {
                        DoScriptText(SAY_SUMMON, me);

                        // Spawn Pummeller
                        switch (rand() % 4)
                        {
                            case 0: me->SummonCreature(NPC_XM024_PUMMELLER, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                            case 1: me->SummonCreature(NPC_XM024_PUMMELLER, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                            case 2: me->SummonCreature(NPC_XM024_PUMMELLER, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                            case 3: me->SummonCreature(NPC_XM024_PUMMELLER, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                        }

                        // Spawn 5 Scrapbots
                        for (int8 n = 0; n < 5; n++)
                        {
                            // Some randomes are added so they wont spawn in a pile
                            switch(rand() % 4)
                            {
                                case 0: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(LR_X - 3, LR_X + 3)), float(irand(LR_Y - 3, LR_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                case 1: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(LL_X - 3, LL_X + 3)), float(irand(LL_Y - 3, LL_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                case 2: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(UR_X - 3, UR_X + 3)), float(irand(UR_Y - 3, UR_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                case 3: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(UL_X - 3, UL_X + 3)), float(irand(UL_Y - 3, UL_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                            }
                        }

                        // Spawn 3 Bombs
                        for (int8 n = 0; n < 3; n++)
                        {
                            switch (rand() % 4)
                            {
                                case 0: me->SummonCreature(NPC_XE321_BOOMBOT, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                case 1: me->SummonCreature(NPC_XE321_BOOMBOT, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                case 2: me->SummonCreature(NPC_XE321_BOOMBOT, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                case 3: me->SummonCreature(NPC_XE321_BOOMBOT, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                            }
                        }

                        uiSpawnAddTimer = TIMER_SPAWN_ADD;
                    } else uiSpawnAddTimer -= diff;

                    // Is the phase over?
                    if (uiHeartPhaseTimer <= diff)
                    {
                        DoScriptText(SAY_HEART_CLOSED, me);
                        SetPhaseOne();
                    }
                    else uiHeartPhaseTimer -= diff;
                }
            }
            else
            {
                // Adding life sparks when searing light debuff runs out if hard mode
                if (searing_light_active)
                {
                    if (uiSpawnLifeSparkTimer <= diff)
                    {
                        Unit* searingLightTarget = me->GetUnit(*me, uiSearingLightTarget);
                        if (searingLightTarget && searingLightTarget->isAlive())
                            me->SummonCreature(NPC_LIFE_SPARK, *searingLightTarget);

                        uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK;
                        searing_light_active = false;
                    } else uiSpawnLifeSparkTimer -= diff;
                }

                if (gravity_bomb_active)
                {
                    if (uiGravityBombAuraTimer <= diff)
                    {
                        Unit* gravityBombTarget = me->GetUnit(*me, uiGravityBombTarget);
                        if (gravityBombTarget && gravityBombTarget->isAlive())
                            me->SummonCreature(NPC_VOID_ZONE, *gravityBombTarget, TEMPSUMMON_TIMED_DESPAWN, 180000);

                        uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA;
                        gravity_bomb_active = false;
                    } else uiGravityBombAuraTimer -= diff;
                }

                DoMeleeAttackIfReady();
            }

            //Enrage stuff
            if (!enraged)
            {
                if (uiEnrageTimer <= diff)
                {
                    DoScriptText(SAY_BERSERK, me);
                    DoCast(me, SPELL_ENRAGE);
                    enraged = true;
                } else uiEnrageTimer -= diff;
            }else
            {
                if (!me->HasAura(SPELL_ENRAGE))
                    DoCast(me, SPELL_ENRAGE);
            }
        }
Exemplo n.º 18
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING))
                return;

            if(me->GetHealthPct() < 20 && phase == 1)
            {
                phase = 2;

                if(Creature* finkle_einhorn = ObjectAccessor::GetCreature(*me,instance->GetData64(NPC_FINKLE_EINHORN)))
                    DoScriptText(SAY_FINAL_PHASE, finkle_einhorn);

                DoCast(me, SPELL_MORTALITY);
                DoCastAOE(SPELL_MORTALITY_RAID_DEBUFF);

                events.CancelEvent(EVENT_MASSACRE);
                events.CancelEvent(EVENT_BREAK);
                events.CancelEvent(EVENT_CAUSTIC_SLIME);
            }

            events.Update(diff);
            _DoAggroPulse(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {

                case EVENT_MASSACRE:
                    DoCastVictim(SPELL_MASSACRE);
                    me->AttackStop();
                    if(urand(0,2) == 0)
                        if(Creature* bile_o_tron = ObjectAccessor::GetCreature(*me,instance->GetData64(NPC_BILE_O_TRON)))
                        {
                            bile_o_tron->AI()->DoAction(ACTION_BILE_O_TRON_SYSTEM_FAILURE);

                            events.ScheduleEvent(EVENT_MASSACRE, 45000);
                            events.ScheduleEvent(EVENT_DOUBLE_ATTACK, urand(2000, 3000));
                        }else
                            events.ScheduleEvent(EVENT_MASSACRE, 27000);
                        break;

                case EVENT_FEUD:
                    DoCast(me,SPELL_FEUD);
                    if(Creature* victor_nefarian = ObjectAccessor::GetCreature(*me,instance->GetData64(NPC_LORD_VICTOR_NEFARIAN)))
                        DoScriptText(SAY_FEUD, victor_nefarian);
                    break;

                case EVENT_DOUBLE_ATTACK:
                    DoCast(me, SPELL_DOUBLE_ATTACK);
                    events.ScheduleEvent(EVENT_DOUBLE_ATTACK, urand(13000,15000));
                    break;

                case EVENT_CAUSTIC_SLIME:
                    DoCastAOE(SPELL_CAUSTIC_SLIME);
                    events.ScheduleEvent(EVENT_CAUSTIC_SLIME, urand(10000,12000));
                    break;

                case EVENT_BREAK:
                    DoCastVictim(SPELL_BREAK);
                    events.ScheduleEvent(EVENT_BREAK, 14000);
                    break;

                default:
                    break;
                }
            }		

            if(!me->HasAura(SPELL_FEUD))
                DoMeleeAttackIfReady();
        }
Exemplo n.º 19
0
            void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                _DoAggroPulse(diff);

                if (_enterHardMode)
                {
                    SetPhaseOne();
                    _enterHardMode = false;
                }

                // Handles spell casting. These spells only occur during phase 1 or hard mode
                if (_phase == 1 || _hardMode)
                {
                    if (_searingLightTimer <= diff)
                    {
                        if (!me->HasAura(SPELL_TYMPANIC_TANTRUM))
                            DoCast(me, RAID_MODE<uint32>(SPELL_SEARING_LIGHT_10, SPELL_SEARING_LIGHT_25), true);
                        _searingLightTimer = 20*IN_MILLISECONDS;
                    }
                    else
                        _searingLightTimer -= diff;

                    if (_gravityBombTimer <= diff)
                    {
                        if (!me->HasAura(SPELL_TYMPANIC_TANTRUM))
                            DoCast(me, RAID_MODE<uint32>(SPELL_GRAVITY_BOMB_10, SPELL_GRAVITY_BOMB_25), true);
                        _gravityBombTimer = 20*IN_MILLISECONDS;
                    }
                    else
                        _gravityBombTimer -= diff;

                    if (_tympanicTantrumTimer <= diff)
                    {
                        DoScriptText(SAY_TYMPANIC_TANTRUM, me);
                        me->MonsterTextEmote(EMOTE_TYMPANIC, 0, true);
                        DoCast(SPELL_TYMPANIC_TANTRUM);
                        _tympanicTantrumTimer = 1*MINUTE*IN_MILLISECONDS;
                    }
                    else
                        _tympanicTantrumTimer -= diff;
                }

                if (!_hardMode)
                {
                    if (_phase == 1)
                    {
                        if (HealthBelowPct(100 - (_heartExposed + 1) * 25))
                            exposeHeart();

                        DoMeleeAttackIfReady();
                    }
                    else
                    {
                        // Start summoning adds
                        if (_spawnAddTimer <= diff)
                        {
                            DoScriptText(SAY_SUMMON, me);

                            // Spawn Pummeller
                            switch (rand() % 4)
                            {
                                case 0: me->SummonCreature(NPC_XM024_PUMMELLER, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                case 1: me->SummonCreature(NPC_XM024_PUMMELLER, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                case 2: me->SummonCreature(NPC_XM024_PUMMELLER, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                case 3: me->SummonCreature(NPC_XM024_PUMMELLER, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                            }

                            // Spawn 5 Scrapbots
                            for (int8 n = 0; n < 5; ++n)
                            {
                                // Some randomes are added so they wont spawn in a pile
                                switch (rand() % 4)
                                {
                                    case 0: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(LR_X - 3, LR_X + 3)), float(irand(LR_Y - 3, LR_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                    case 1: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(LL_X - 3, LL_X + 3)), float(irand(LL_Y - 3, LL_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                    case 2: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(UR_X - 3, UR_X + 3)), float(irand(UR_Y - 3, UR_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                    case 3: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(UL_X - 3, UL_X + 3)), float(irand(UL_Y - 3, UL_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                }
                            }

                            // Spawn 3 Bombs
                            for (int8 n = 0; n < 3; ++n)
                            {
                                switch (rand() % 4)
                                {
                                    case 0: me->SummonCreature(NPC_XE321_BOOMBOT, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                    case 1: me->SummonCreature(NPC_XE321_BOOMBOT, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                    case 2: me->SummonCreature(NPC_XE321_BOOMBOT, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                    case 3: me->SummonCreature(NPC_XE321_BOOMBOT, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break;
                                }
                            }

                            _spawnAddTimer = 12*IN_MILLISECONDS;
                        }
                        else
                            _spawnAddTimer -= diff;

                        // Is the phase over?
                        if (_heartPhaseTimer <= diff)
                        {
                            DoScriptText(SAY_HEART_CLOSED, me);
                            SetPhaseOne();
                        }
                        else
                            _heartPhaseTimer -= diff;
                    }
                }
                else
                    DoMeleeAttackIfReady();

                if (!_enraged)
                {
                    if (_enrageTimer <= diff)
                    {
                        DoScriptText(SAY_BERSERK, me);
                        DoCast(me, SPELL_ENRAGE, true);
                        _enraged = true;
                    }
                    else
                        _enrageTimer -= diff;
                }
            }
Exemplo n.º 20
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING))
                return;

            events.Update(diff);
            _DoAggroPulse(diff);

            if(me->GetHealthPct() < 25 && phase != PHASE_FINAL)
            {   // Enter Final Phase

                uint32 uiBerserker = events.GetNextEventTime(EVENT_BERSERK);
                events.Reset();
                events.ScheduleEvent(EVENT_BERSERK, uiBerserker);

                phase = PHASE_FINAL;
                me->InterruptNonMeleeSpells(true);
                
                DoCast(SPELL_RELEASE_ALL_ABBERATIONS);

                DoScriptText(SAY_LOW_HEALTH, me);
            };

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    // General and Phase Switching
                case EVENT_NEW_PHASE:
                    UpdatePhase(urand(PHASE_RED, PHASE_BLUE));
                    spellsLocked = true;
                    events.ScheduleEvent(EVENT_NEW_PHASE, TIMER_PHASE);
                    break;

                case EVENT_DRINK_BOTTLE:

                    if(GameObject* cauldron = me->FindNearestGameObject(GOB_MALORIAKS_CAULDRON,100.f))
                    {
                        switch(phase)
                        {
                        case PHASE_RED:
                            DoCast(cauldron->ToCreature(), SPELL_THROW_RED_BOTTLE);
                            break;

                        case PHASE_BLUE:
                            DoCast(cauldron->ToCreature(), SPELL_THROW_BLUE_BOTTLE);
                            break;

                        case PHASE_GREEN:
                            DoCast(cauldron->ToCreature(), SPELL_THROW_GREEN_BOTTLE);
                            break;

                        case PHASE_BLACK:
                            DoCast(cauldron->ToCreature(), SPELL_THROW_BLACK_BOTTLE);
                            me->AddAura(SPELL_SHADOW_IMBUED, me);
                            break;
                        }
                    }

                    events.ScheduleEvent(EVENT_WAIT_SWITCH_PHASE, 1000);
                    break;

                case EVENT_WAIT_SWITCH_PHASE:
                    me->SetReactState(REACT_AGGRESSIVE);
                    me->GetMotionMaster()->MoveChase(me->getVictim());

                    // Intialize Phase Events
                    switch(phase)
                    {
                    case PHASE_RED:
                        events.ScheduleEvent(EVENT_SCORCHING_BLAST, 7000);
                        events.ScheduleEvent(EVENT_CONSUMING_FLAMES, 3000);
                        break;

                    case PHASE_BLUE:
                        events.ScheduleEvent(EVENT_BITING_CHILL, 7000);
                        events.ScheduleEvent(EVENT_FLASH_FREEZE, 9000);
                        break;

                    case PHASE_GREEN:
                        events.ScheduleEvent(EVENT_CAULDRON_EXPLODE, 2000);
                        break;

                    case PHASE_BLACK:
                        events.ScheduleEvent(EVENT_SUMMON_VILE_SWILL, urand(4000,6000));
                        events.ScheduleEvent(EVENT_ENGULFING_DARKNESS, 9000);
                        break;
                    }

                    if(phase != PHASE_BLACK)
                    {
                        events.ScheduleEvent(EVENT_RELEASE_ABBERATIONS, urand(12000,17000));
                        DoScriptText(SAY_VIAL-phase, me);
                    }

                    events.ScheduleEvent(EVENT_UNLOCK_SPELLS, 1500);
                    break;

                    // Misc
                case EVENT_UNLOCK_SPELLS:
                    spellsLocked = false;
                    break;

                case EVENT_BERSERK:
                    DoCast(me,SPELL_BERSERK);
                    break;

                case EVENT_REMEDY:
                    if(spellsLocked)
                        events.ScheduleEvent(EVENT_REMEDY, 1500);
                    else
                    {
                        DoCast(me,SPELL_REMEDY);
                        events.ScheduleEvent(EVENT_REMEDY, urand(15000,18000));
                    }
                    break;

                case EVENT_ARCANE_STORM:
                    if(spellsLocked)
                        events.ScheduleEvent(EVENT_ARCANE_STORM, 1500);
                    else
                    {
                        me->AttackStop();
                        DoCastAOE(SPELL_ARCANE_STORM);
                        events.ScheduleEvent(EVENT_ARCANE_STORM, urand(27000,29000));
                    }
                    break;

                    // Red Phase
                case EVENT_SCORCHING_BLAST:
                    DoCastAOE(SPELL_SCORCHING_BLAST);
                    events.ScheduleEvent(EVENT_SCORCHING_BLAST, urand(15000, 17000));
                    break;

                case EVENT_CONSUMING_FLAMES:
                    if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true))
                        DoCast(target, SPELL_CONSUMING_FLAMES);

                    events.ScheduleEvent(EVENT_CONSUMING_FLAMES, urand(7000, 8500));
                    break;

                    // Blue Phase
                case EVENT_BITING_CHILL:
                    if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true))
                        DoCast(target, SPELL_BITING_CHILL);

                    events.ScheduleEvent(EVENT_BITING_CHILL, urand(8000, 10000));
                    break;

                case EVENT_FLASH_FREEZE:
                    if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true))
                        target->CastSpell(target, SPELL_FLASH_FREEZE_SUMMON, true);

                    events.ScheduleEvent(EVENT_FLASH_FREEZE, urand(11000, 13000));
                    break;

                    // Green Phase
                case EVENT_CAULDRON_EXPLODE:
                    me->FindNearestCreature(NPC_SLIME_TRIGGER, 100.f)->AI()->DoCastAOE(SPELL_DEBILITATING_SLIME);
                    DoCastCausticSlime();
                    events.ScheduleEvent(EVENT_CAULDRON_EXPLODE, 15000);
                    break;

                case EVENT_RELEASE_ABBERATIONS:
                    DoCast(SPELL_RELEASE_ABBERATIONS);
                    break;

                    // Black Phase
                case EVENT_SUMMON_VILE_SWILL:
                    me->SummonCreature(NPC_VILE_SWILL, MaloriakPositions[urand(1,4)]);
                    events.ScheduleEvent(EVENT_SUMMON_VILE_SWILL, urand(4000,5000));
                    break;

                case EVENT_ENGULFING_DARKNESS:
                    DoCastAOE(SPELL_ENGULFING_DARKNESS);
                    events.ScheduleEvent(EVENT_ENGULFING_DARKNESS, 16000);
                    break;

                    // Final Phase

                default:
                    break;
                }
            }		

            DoMeleeAttackIfReady();
        }
Exemplo n.º 21
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            _DoAggroPulse(diff);
            events.Update(diff);
            ConstructTimer += diff;

            if (me->HasUnitState(UNIT_STAT_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_JET:
                        me->MonsterTextEmote(EMOTE_JETS, 0, true);
                        DoCastAOE(SPELL_FLAME_JETS);
                        events.DelayEvents(5000, 1);
                        events.ScheduleEvent(EVENT_JET, urand(35000, 40000));
                        break;
                    case EVENT_SLAG_POT:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
                        {
                            DoScriptText(SAY_SLAG_POT, me);
                            SlagPotGUID = target->GetGUID();
                            DoCast(target, SPELL_GRAB);
                            events.ScheduleEvent(EVENT_GRAB_POT, 500);
                        }
                        events.ScheduleEvent(EVENT_SLAG_POT, RAID_MODE(30000, 15000), 1);
                        break;
                    case EVENT_GRAB_POT:
                        if (Unit* SlagPotTarget = Unit::GetUnit(*me, SlagPotGUID))
                        {
                            SlagPotTarget->CastCustomSpell(SPELL_GRAB_ENTER_VEHICLE, SPELLVALUE_BASE_POINT0, 1, me, true);
                            events.ScheduleEvent(EVENT_CHANGE_POT, 1000);
                        }
                        break;
                    case EVENT_CHANGE_POT:
                        if (Unit* SlagPotTarget = Unit::GetUnit(*me, SlagPotGUID))
                        {
                            SlagPotTarget->AddAura(SPELL_SLAG_POT, SlagPotTarget);
                            SlagPotTarget->ExitVehicle();
                            SlagPotTarget->CastCustomSpell(SPELL_GRAB_ENTER_VEHICLE, SPELLVALUE_BASE_POINT0, 2, me, true);
                            SlagPotTarget->ClearUnitState(UNIT_STAT_ONVEHICLE); // Hack
                            SlagPotGUID = 0;
                        }
                        break;
                    case EVENT_SCORCH:
                        DoScriptText(RAND(SAY_SCORCH_1, SAY_SCORCH_2), me);
                        if (Unit* target = me->getVictim())
                            me->SummonCreature(NPC_GROUND_SCORCH, *target, TEMPSUMMON_TIMED_DESPAWN, 45000);
                        DoCast(SPELL_SCORCH);
                        events.ScheduleEvent(EVENT_SCORCH, 25000);
                        break;
                    case EVENT_CONSTRUCT:
                    {
                        DoScriptText(SAY_SUMMON, me);
                        if (!creatureList.empty())
                        {
                            std::list<Creature*>::iterator itr = creatureList.begin();
                            std::advance(itr, urand(0, creatureList.size()-1));
                            if (Creature* construct = (*itr))
                            {
                                construct->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM);
                                construct->SetReactState(REACT_AGGRESSIVE);
                                construct->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED | UNIT_FLAG_DISABLE_MOVE);
                                construct->AI()->AttackStart(me->getVictim());
                                construct->AI()->DoZoneInCombat();
                                DoCast(me, SPELL_STRENGTH, true);
                                creatureList.erase(itr);
                            }
                        }
                        DoCast(SPELL_ACTIVATE_CONSTRUCT);
                        events.ScheduleEvent(EVENT_CONSTRUCT, RAID_MODE(40000, 30000));
                        break;
                    }
                    case EVENT_BERSERK:
                        DoCast(me, SPELL_BERSERK, true);
                        DoScriptText(SAY_BERSERK, me);
                        break;
                }
            }
            DoMeleeAttackIfReady();
        }
Exemplo n.º 22
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() )
                return;

            _DoAggroPulse(diff);

            if (!AnimusSummoned)
                if (SummonVarpor_Timer < diff)
                {
                    DoSummon(ENTRY_SARONIT_VARPOR, me, 45.0f, 30000, TEMPSUMMON_MANUAL_DESPAWN);
                    SummonVarpor_Timer = 30000;
                }else SummonVarpor_Timer -= diff;

            if (SurgeOfDarkness_Timer < diff)
            {
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(me, SPELL_SURGE_OF_DARKNESS);
                    DoScriptText(SAY_KITE, me);
                    DoScriptText(EMOTE_SURGE_OF_DARKNESS, me);
                    SurgeOfDarkness_Timer = 63000;
                }
            }else SurgeOfDarkness_Timer -= diff;

            if (ShadowCrash_Timer < diff)
            {
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    Unit* target = CheckPlayersInRange(RAID_MODE<uint8>(4, 9), 15.0f, 50.0f);
                    if (!target)
                        target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150.0f, true);
                    if (target)
                        DoCast(target, SPELL_SHADOW_CRASH);

                    ShadowCrash_Timer = 10000;
                }
            }else ShadowCrash_Timer -= diff;

            if (!AnimusSummoned || AnimusKilled)
                if (SearingFlames_Timer < diff)
                {
                    if (!me->IsNonMeleeSpellCasted(false))
                    {
                         me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false);
                         DoCast(SPELL_SEARING_FLAMES);
                         SearingFlames_Timer = urand(10000, 15000);
                         ImmunityToReset = true;
                         ResetImmunity_Timer = 2000;
                    }
                }else SearingFlames_Timer -= diff;

            if (ImmunityToReset)
                if (ResetImmunity_Timer < diff)
                {
                    me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
                    ResetImmunity_Timer = 0;
                    ImmunityToReset = false;
                }else ResetImmunity_Timer -= diff;

            if (MarkOfTheFaceless < diff)
            {
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    Unit* target = CheckPlayersInRange(RAID_MODE<uint8>(4, 9), 15.0f, 50.0f);
                    if (!target)
                        target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150.0f, true);
                    if (target)
                        DoCast(target, SPELL_MARK_OF_THE_FACELESS);

                    MarkOfTheFaceless = urand(15000, 25000);
                }
            }else MarkOfTheFaceless -= diff;

            if (!Berserk)
                if (Berserk_Timer < diff)
                {
                    if (!me->IsNonMeleeSpellCasted(false))
                    {
                        DoCast(me, SPELL_BERSERK, true);
                        DoScriptText(SAY_BERSERK, me);
                        Berserk = true;
                    }
                }else Berserk_Timer -= diff;

            DoMeleeAttackIfReady();
        }
Exemplo n.º 23
0
            void UpdateAI(uint32 const diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);
                _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STAT_CASTING))
                    return;

                switch (events.GetEvent())
                {
                    case EVENT_MELEE_CHECK:
                        if (!me->IsWithinMeleeRange(me->getVictim()))
                            DoCast(SPELL_PETRIFY_BREATH);
                        events.RepeatEvent(1000);
                        break;
                    case EVENT_SWEEP:
                        if (left)
                        {
                            DoCast(SPELL_ARM_SWEEP);
                            DoScriptText(SAY_SHOCKWAVE, me);
                        }
                        events.RepeatEvent(25000);
                        break;
                    case EVENT_SMASH:
                        if (left && right)
                            DoCastVictim(SPELL_TWO_ARM_SMASH);
                        else if (left || right)
                            DoCastVictim(SPELL_ONE_ARM_SMASH);
                        events.RepeatEvent(15000);
                        break;
                    case EVENT_STONE_SHOUT:
                        DoCast(SPELL_STONE_SHOUT);
                        events.RepeatEvent(2000);
                        break;
                    case EVENT_ENRAGE:
                        DoCast(SPELL_BERSERK);
                        DoScriptText(SAY_BERSERK, me);
                        events.CancelEvent(EVENT_ENRAGE);
                        break;
                    case EVENT_RESPAWN_LEFT_ARM:
                    {
                        RespawnArm(NPC_LEFT_ARM);
                        me->MonsterTextEmote(EMOTE_LEFT, 0, true);
                        events.CancelEvent(EVENT_RESPAWN_LEFT_ARM);
                        break;
                    }
                    case EVENT_RESPAWN_RIGHT_ARM:
                    {
                        RespawnArm(NPC_RIGHT_ARM);
                        me->MonsterTextEmote(EMOTE_RIGHT, 0, true);
                        events.CancelEvent(EVENT_RESPAWN_RIGHT_ARM);
                        break;
                    }
                    case EVENT_STONE_GRIP:
                    {
                        if (right)
                        {
                            DoCast(SPELL_STONE_GRIP);
                            me->MonsterTextEmote(EMOTE_STONE, 0, true);
                            DoScriptText(SAY_GRAB_PLAYER, me);
                        }
                        events.RepeatEvent(25000);
                        break;
                    }
					case EVENT_SHOCKWAVE:
						if (left)
						{
							DoScriptText(SAY_SHOCKWAVE, me);
							DoCastAOE(SPELL_SHOCKWAVE, true);
							DoCastAOE(SPELL_SHOCKWAVE_VISUAL, true);
						}
						events.RepeatEvent(urand(15000, 25000));
						break;
                    case EVENT_FOCUSED_EYEBEAM:
                        Unit* eyebeamTargetUnit = GetEyeBeamTarget();
                        if (!eyebeamTargetUnit)
                            eyebeamTargetUnit = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true, -SPELL_STONE_GRIP_DOT);
                        if (eyebeamTargetUnit)
                        {
                            eyebeamTarget = eyebeamTargetUnit->GetGUID();
                            me->MonsterWhisper(EMOTE_EYEBEAM, eyebeamTarget, true);
                            eyebeamTargetUnit->CastSpell(eyebeamTargetUnit, 63343, true, NULL, NULL, me->GetGUID());
                            eyebeamTargetUnit->CastSpell(eyebeamTargetUnit, 63701, true, NULL, NULL, me->GetGUID());
                            //DoCast(SPELL_SUMMON_FOCUSED_EYEBEAM);
                        }
                        events.RepeatEvent(urand(15000, 35000));
                        break;
                }

                DoMeleeAttackIfReady();
            }
Exemplo n.º 24
0
            void UpdateAI(uint32 const Diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(Diff);
                _DoAggroPulse(Diff);

                if (HealthBelowPct(50) && !PermaGround)
                    EnterPermaGround();

                if (EnrageTimer <= Diff && !Enraged)
                {
                    DoCast(me, SPELL_BERSERK);
                    Enraged = true;
                }
                else
                    EnrageTimer -= Diff;

                if (HarpoonCounter == RAID_MODE<uint8>(2, 4))
                {
                    HarpoonCounter = 0;
                    events.CancelEvent(EVENT_SUMMON);
                    me->GetMotionMaster()->MovePoint(1, RazorGround);
                }

                if (phase == PHASE_GROUND)
                {
                    while (uint32 eventId = events.ExecuteEvent())
                    {
                        switch (eventId)
                        {
                            case EVENT_FLIGHT:
                                phase = PHASE_FLIGHT;
                                events.SetPhase(PHASE_FLIGHT);
                                me->SetFlying(true);
                                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                me->RemoveAllAuras();
                                me->SetReactState(REACT_PASSIVE);
                                me->AttackStop();
                                me->GetMotionMaster()->MovePoint(0, RazorFlight);
                                events.ScheduleEvent(EVENT_FIREBALL, 7000, 0, PHASE_FLIGHT);
                                events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_FLIGHT);
                                events.ScheduleEvent(EVENT_SUMMON, 5000, 0, PHASE_FLIGHT);
                                ++FlyCount;
                                return;
                            case EVENT_LAND:
                                me->SetFlying(false);
                                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED);
                                if (Creature* commander = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_EXP_COMMANDER) : 0))
                                    commander->AI()->DoAction(ACTION_GROUND_PHASE);
                                events.ScheduleEvent(EVENT_BREATH, 30000, 0, PHASE_GROUND);
                                events.ScheduleEvent(EVENT_BUFFET, 33000, 0, PHASE_GROUND);
                                events.ScheduleEvent(EVENT_FLIGHT, 35000, 0, PHASE_GROUND);
                                return;
                            case EVENT_BREATH:
                                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED);
                                me->RemoveAurasDueToSpell(SPELL_HARPOON_TRIGGER);
                                me->SetReactState(REACT_AGGRESSIVE);
                                DoScriptText(EMOTE_BREATH, me, 0);
                                DoCastAOE(SPELL_FLAMEBREATH);
                                events.CancelEvent(EVENT_BREATH);
                                return;
                            case EVENT_BUFFET:
                                DoCastAOE(SPELL_WINGBUFFET);
                                if (Creature* controller = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_RAZORSCALE_CONTROL) : 0))
                                    controller->CastSpell(controller, SPELL_FLAMED, true);
                                events.CancelEvent(EVENT_BUFFET);
                                return;
                        }
                    }
                }
                else if (phase == PHASE_PERMAGROUND)
                {
                    while (uint32 eventId = events.ExecuteEvent())
                    {
                        switch (eventId)
                        {
                            case EVENT_FLAME:
                                DoCastAOE(SPELL_FLAMEBUFFET);
                                events.ScheduleEvent(EVENT_FLAME, 10000, 0, PHASE_PERMAGROUND);
                                return;
                            case EVENT_BREATH:
                                me->MonsterTextEmote(EMOTE_BREATH, 0, true);
                                DoCastVictim(SPELL_FLAMEBREATH);
                                events.ScheduleEvent(EVENT_BREATH, 20000, 0, PHASE_PERMAGROUND);
                                return;
                            case EVENT_FIREBALL:
                                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true))
                                    DoCast(target, SPELL_FIREBALL);
                                events.ScheduleEvent(EVENT_FIREBALL, 3000, 0, PHASE_PERMAGROUND);
                                return;
                            case EVENT_DEVOURING:
                                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true))
                                    DoCast(target, SPELL_DEVOURING_FLAME);
                                events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_PERMAGROUND);
                                return;
                            case EVENT_BUFFET:
                                DoCastAOE(SPELL_WINGBUFFET);
                                events.CancelEvent(EVENT_BUFFET);
                                return;
                            case EVENT_FUSE:
                                DoCast(me->getVictim(), SPELL_FUSEARMOR);
                                events.ScheduleEvent(EVENT_FUSE, 10000, 0, PHASE_PERMAGROUND);
                                return;
                        }
                    }
                    DoMeleeAttackIfReady();
                }
                else
                {
                    if (uint32 eventId = events.ExecuteEvent())
                    {
                        switch (eventId)
                        {
                            case EVENT_FIREBALL:
                                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true))
                                    DoCast(target, SPELL_FIREBALL);
                                events.ScheduleEvent(EVENT_FIREBALL, 3000, 0, PHASE_FLIGHT);
                                return;
                            case EVENT_DEVOURING:
                                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true))
                                    me->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_DEVOURING_FLAME, true);
                                events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_FLIGHT);
                                return;
                            case EVENT_SUMMON:
                                SummonMoleMachines();
                                events.ScheduleEvent(EVENT_SUMMON, 45000, 0, PHASE_FLIGHT);
                                return;
                        }
                    }
                }
            }
Exemplo n.º 25
0
        void UpdateAI(uint32 const diff)
        {
            if (!UpdateVictim() )
                return;

                events.Update(diff);
            _DoAggroPulse(diff);

                if (me->HasUnitState(UNIT_STAT_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_SUMMON_VAPOR:
                            float x, y, angle;
                            angle = float(2 * M_PI * rand_norm());
                            x = 1841.98f + float(25) * cos(angle);
                            y = 113.078f + float(25) * sin(angle);
                            me->SummonCreature(ENTRY_SARONIT_VAPOR, x, y, 344.13f, 0.0f);
                            if (!_animusSummoned)
                                events.ScheduleEvent(EVENT_SUMMON_VAPOR, 30*IN_MILLISECONDS);
                            else
                                summons.DespawnEntry(ENTRY_SARONIT_VAPOR);
                            break;
                        case EVENT_SURGE_OF_DARKNESS:
                    DoCast(me,SPELL_SURGE_OF_DARKNESS);
                    DoScriptText(SAY_KITE,me);
                    DoScriptText(EMOTE_SURGE_OF_DARKNESS, me);
                            events.ScheduleEvent(EVENT_SURGE_OF_DARKNESS, 63*IN_MILLISECONDS);
                            break;
                        case EVENT_SHADOW_CRASH:
                        {
                            Unit* target = CheckPlayersInRange(RAID_MODE<uint8>(4, 9), 15.0f, 100.0f);
                    if (!target)
                                target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true);
                    if (target)
                            {
                                me->SetTarget(target->GetGUID());
                        DoCast(target, SPELL_SHADOW_CRASH);
                            }
                            events.ScheduleEvent(EVENT_SHADOW_CRASH, 10*IN_MILLISECONDS);
                            events.ScheduleEvent(EVENT_RESET_TARGET, 1*IN_MILLISECONDS);
                            break;
                        }
                        case EVENT_RESET_TARGET:
                            if (me->getVictim())
                                me->SetTarget(me->getVictim()->GetGUID());
                            break;
                        case EVENT_MARK_OF_THE_FACELESS:
                        {
                            Unit* target = CheckPlayersInRange(RAID_MODE<uint8>(4, 9), 15.0f, 100.0f);
                            if (!target)
                                target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true);
                            if (target)
                                DoCast(target, SPELL_MARK_OF_THE_FACELESS);
                            events.ScheduleEvent(EVENT_MARK_OF_THE_FACELESS, urand(15, 25) * IN_MILLISECONDS);
                            break;
                        }
                        case EVENT_BERSERK:
                            DoCast(me, SPELL_BERSERK, true);
                            DoScriptText(SAY_BERSERK, me);
                            break;
                        case EVENT_RESET_IMMUNITY: // called right after Searing Flames' UNIT_STAT_CASTING gets removed
                            me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
                            break;
                        case EVENT_SEARING_FLAMES:
                         me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false);
                         DoCast(SPELL_SEARING_FLAMES);
                            events.ScheduleEvent(EVENT_SEARING_FLAMES, urand(10, 15) * IN_MILLISECONDS);
                            events.ScheduleEvent(EVENT_RESET_IMMUNITY, 0);
                            return;
                    }
                }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 26
0
        void UpdateAI(uint32 const diff)
        {
            if (!phase)
                return;

            events.Update(diff);

            if ((phase != PHASE_BIRTH && !UpdateVictim()) || !CheckInRoom())
                return;

            _DoAggroPulse(diff);

            if (CanTheHundredClub)
            {
                if (CheckFrostResistTimer <= diff)
                {
                    CheckPlayersFrostResist();
                    CheckFrostResistTimer = (rand() % 5 + 5) * 1000;
                } else CheckFrostResistTimer -= diff;
            }

            if (phase == PHASE_GROUND)
            {
                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BERSERK:
                            DoScriptText(EMOTE_ENRAGE, me);
                            DoCast(me, SPELL_BERSERK);
                            return;
                        case EVENT_CLEAVE:
                            DoCastVictim(SPELL_CLEAVE);
                            events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND);
                            return;
                        case EVENT_TAIL:
                            DoCastAOE(SPELL_TAIL_SWEEP);
                            events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND);
                            return;
                        case EVENT_DRAIN:
                            DoCastAOE(SPELL_LIFE_DRAIN);
                            events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND);
                            return;
                        case EVENT_BLIZZARD:
                        {
                            //DoCastAOE(SPELL_SUMMON_BLIZZARD);
                            Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
                            if (!target)
                                target = me->getVictim();
                            if (Creature* Summon = DoSummon(MOB_BLIZZARD, target, 0.0f, 20000, TEMPSUMMON_TIMED_DESPAWN))
                                Summon->GetMotionMaster()->MoveRandom(40);
                            events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20000, 7000), 0, PHASE_GROUND);
                            break;
                        }
                        case EVENT_FLIGHT:
                            if (HealthAbovePct(10))
                            {
                                phase = PHASE_FLIGHT;
                                events.SetPhase(PHASE_FLIGHT);
                                me->SetReactState(REACT_PASSIVE);
                                me->AttackStop();
                                float x, y, z, o;
                                me->GetHomePosition(x, y, z, o);
                                me->GetMotionMaster()->MovePoint(1, x, y, z);
                                return;
                            }
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
            else
            {
                if (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_LIFTOFF:
                            me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
                            me->SetLevitate(true);
                            me->SendMovementFlagUpdate();
                            events.ScheduleEvent(EVENT_ICEBOLT, 1500);
                            iceboltCount = RAID_MODE(2, 3);
                            return;
                        case EVENT_ICEBOLT:
                        {
                            std::vector<Unit*> targets;
                            std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
                            for (; i != me->getThreatManager().getThreatList().end(); ++i)
                                if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT))
                                    targets.push_back((*i)->getTarget());

                            if (targets.empty())
                                iceboltCount = 0;
                            else
                            {
                                std::vector<Unit*>::const_iterator itr = targets.begin();
                                advance(itr, rand()%targets.size());
                                iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0));
                                DoCast(*itr, SPELL_ICEBOLT);
                                --iceboltCount;
                            }

                            if (iceboltCount)
                                events.ScheduleEvent(EVENT_ICEBOLT, 1000);
                            else
                                events.ScheduleEvent(EVENT_BREATH, 1000);
                            return;
                        }
                        case EVENT_BREATH:
                        {
                            DoScriptText(EMOTE_BREATH, me);
                            DoCastAOE(SPELL_FROST_MISSILE);
                            events.ScheduleEvent(EVENT_EXPLOSION, 8000);
                            return;
                        }
                        case EVENT_EXPLOSION:
                            CastExplosion();
                            ClearIceBlock();
                            events.ScheduleEvent(EVENT_LAND, 3000);
                            return;
                        case EVENT_LAND:
                            me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
                            me->SetLevitate(false);
                            me->SendMovementFlagUpdate();
                            events.ScheduleEvent(EVENT_GROUND, 1500);
                            return;
                        case EVENT_GROUND:
                            EnterPhaseGround();
                            return;
                        case EVENT_BIRTH:
                            me->SetVisible(true);
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            me->SetReactState(REACT_AGGRESSIVE);
                            return;
                    }
                }
            }
        }
Exemplo n.º 27
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (phase == 1 && HealthBelowPct(20))
            {
                phase = 2;
                DoScriptText(SAY_PHASE_2, me);
                summons.DespawnAll();
                events.CancelEvent(EVENT_COLLAPSINGSTAR);
                events.CancelEvent(EVENT_LIVINGCONSTELLATION);
                events.ScheduleEvent(EVENT_DARKMATTER, 5*IN_MILLISECONDS);

                // summon 4 unstable black holes
                for (uint8 i = 0; i < 4; ++i)
                    me->SummonCreature(CREATURE_BLACK_HOLE, collapsingLocations[i]);
            }

            if (HealthBelowPct(2))
            {
                me->SummonGameObject(GO_GIFT_OF_THE_OBSERVER, 1634.258667f, -295.101166f,417.321381f,0,0,0,0,0,0);

                // All of them. or random?
                DoScriptText(SAY_DEATH_1, me);
                DoScriptText(SAY_DEATH_2, me);
                DoScriptText(SAY_DEATH_3, me);
                DoScriptText(SAY_DEATH_4, me);
                DoScriptText(SAY_DEATH_5, me);

                me->DisappearAndDie();
                _JustDied();
                return;
            }

            if (!summon)
            {
                if (stepTimer <= diff)
                {
                    switch (step)
                    {
                        case 1:
                            DoScriptText(SAY_SUMMON_1, me);
                            JumpToNextStep(7500);
                            break;
                        case 2:
                            DoScriptText(SAY_SUMMON_2, me);
                            JumpToNextStep(6000);
                            break;
                        case 3:
                            DoScriptText(SAY_SUMMON_3, me);
                            JumpToNextStep(11000);
                            break;
                        case 4:
                            DoScriptText(SAY_ENGAGED_FOR_FIRST_TIME, me);
                            JumpToNextStep(11000);
                            break;
                        case 5:
                            DoScriptText(SAY_AGGRO, me);
                            JumpToNextStep(7000);
                            break;
                        case 6:
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            me->SetReactState(REACT_AGGRESSIVE);
                            SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_ID_OFF_HAND, EQUIP_NO_CHANGE);
                            summon = true;
                            break;
                    }
                } else stepTimer -= diff;
                return;
            }

            _DoAggroPulse(diff);
            events.Update(diff);

            if (me->HasUnitState(UNIT_STAT_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_BIGBANG:
                        DoScriptText(RAND(SAY_BIG_BANG_1, SAY_BIG_BANG_2), me);
                        DoCast(RAID_MODE(SPELL_BIG_BANG_10, SPELL_BIG_BANG_25));
                        events.ScheduleEvent(EVENT_BIGBANG, 90*IN_MILLISECONDS);
                        break;
                    case EVENT_PHASEPUNCH:
                        DoCast(me->getVictim(), SPELL_PHASE_PUNCH, true);
                        events.ScheduleEvent(EVENT_PHASEPUNCH, 15*IN_MILLISECONDS);
                        break;
                    case EVENT_QUANTUMSTRIKE:
                        DoCast(me->getVictim(), RAID_MODE(SPELL_QUANTUM_STRIKE_10, SPELL_QUANTUM_STRIKE_25));
                        events.ScheduleEvent(EVENT_QUANTUMSTRIKE, urand(4*IN_MILLISECONDS, 14*IN_MILLISECONDS));
                        break;
                    case EVENT_COSMICSMASH:
                        DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH_10, SPELL_COSMIC_SMASH_25));
                        events.ScheduleEvent(EVENT_COSMICSMASH, 25*IN_MILLISECONDS);
                        break;
                    case EVENT_COLLAPSINGSTAR:
                        DoScriptText(SAY_SUMMON_COLLAPSING_STAR, me);
                        for (uint8 i = starCount; i < 4; ++i)
                            me->SummonCreature(CREATURE_COLLAPSING_STAR, collapsingLocations[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3*IN_MILLISECONDS);
                        events.ScheduleEvent(EVENT_COLLAPSINGSTAR, 45*IN_MILLISECONDS);
                        break;
                    case EVENT_LIVINGCONSTELLATION:
                        for (uint8 i = 0; i < 3; ++i)
                            me->SummonCreature(CREATURE_LIVING_CONSTELLATION, constellationLocations[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1*IN_MILLISECONDS);
                        events.ScheduleEvent(EVENT_LIVINGCONSTELLATION, 50*IN_MILLISECONDS);
                        break;
                    case EVENT_DARKMATTER:
                        for (uint8 i = 0; i < 4; ++i)
                            me->SummonCreature(CREATURE_UNLEASHED_DARK_MATTER, collapsingLocations[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3*IN_MILLISECONDS);
                        events.ScheduleEvent(EVENT_DARKMATTER, 20*IN_MILLISECONDS);
                        break;
                    case EVENT_BERSERK:
                        DoScriptText(SAY_BERSERK, me);
                        DoCast(me, SPELL_BERSERK, true);
                        events.ScheduleEvent(EVENT_ASCEND, 3*IN_MILLISECONDS);
                        break;
                    case EVENT_ASCEND:
                        DoCast(SPELL_ASCEND);
                        events.ScheduleEvent(EVENT_ASCEND, 10*IN_MILLISECONDS);
                        break;
                    default:
                        break;
                }
            }

            DoMeleeAttackIfReady();
            //EnterEvadeIfOutOfCombatArea(diff);
        }
Exemplo n.º 28
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() || !CheckInRoom())
                return;

            if (!enraged && HealthBelowPct(30))
            {
                enraged = true;
                events.ScheduleEvent(EVENT_FRENZY, 0); // will be cast immediately
            }

            _DoAggroPulse(diff);
            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_WRAP:
                        // TODO : Add missing text
                        for (uint8 i = 0; i < RAID_MODE(1,2); ++i)
                        {
                            if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP))
                            {
                                pTarget->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25));
                                uint8 pos = rand()%MAX_POS_WRAP;
                                pTarget->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20);
                                if (Creature *wrap = DoSummon(MOB_WEB_WRAP, PosWrap[pos], 0, TEMPSUMMON_CORPSE_DESPAWN))
                                    wrap->AI()->SetGUID(pTarget->GetGUID());
                            }
                        }
                        events.ScheduleEvent(EVENT_WRAP, 40000);
                        break;
                    case EVENT_SPRAY:
                        if(!me->IsNonMeleeSpellCasted(false))
                        {
                            DoCastAOE(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25));
                            events.ScheduleEvent(EVENT_SPRAY, 40000);
                        }
                        break;
                    case EVENT_SHOCK:
                        if(!me->IsNonMeleeSpellCasted(false))
                        {
                            DoCastAOE(RAID_MODE(SPELL_POISON_SHOCK_10,SPELL_POISON_SHOCK_25));
                            events.ScheduleEvent(EVENT_SHOCK, urand(10000,20000));
                        }
                        break;
                    case EVENT_POISON:
                        if(!me->IsNonMeleeSpellCasted(false))
                        {
                            DoCast(me->getVictim(), RAID_MODE(SPELL_NECROTIC_POISON_10,SPELL_NECROTIC_POISON_25));
                            events.ScheduleEvent(EVENT_POISON, urand(10000, 20000));
                        }
                        break;
                    case EVENT_FRENZY:
                        DoCast(me, RAID_MODE(SPELL_FRENZY_10,SPELL_FRENZY_25), true);
                        events.ScheduleEvent(EVENT_FRENZY, 600000);
                        break;
                    case EVENT_SUMMON:
                        // TODO : Add missing text
                        uint8 amount = urand(8,10);
                        for (uint8 i = 0; i < amount; ++i)
                            DoSummon(MOB_SPIDERLING, me, 0, TEMPSUMMON_CORPSE_DESPAWN);
                        events.ScheduleEvent(EVENT_SUMMON, 40000);
                        break;
                }
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 29
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() || !CheckInRoom())
                return;

            _DoAggroPulse(diff);
            events.Update(diff);

            if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo)
            {
                thirtyPercentReached = true;
                if (instance)
                    instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
            }

            if (me->HasUnitState(UNIT_STAT_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_SUMMON:
                        if (waves[waveCount].entry)
                        {
                            if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))
                               DoGothikSummon(waves[waveCount].entry);
                            else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))
                                DoGothikSummon(waves[waveCount].entry);
                            else if (waves[waveCount].mode == 1)
                                DoGothikSummon(waves[waveCount].entry);

                            // if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11)
                            if (waveCount == 11)
                            {
                                if (!CheckGroupSplitted())
                                {
                                    if (instance)
                                        instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
                                    summons.DoAction(0, 0);
                                    summons.DoZoneInCombat();
                                    mergedSides = true;
                                }
                            }

                            if (waves[waveCount].mode == 1)
                                events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time);
                            else if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))
                                events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time);
                            else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))
                                events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time);
                            else
                                events.ScheduleEvent(EVENT_SUMMON, 0);

                            ++waveCount;
                        }
                        else
                        {
                            phaseTwo = true;
                            DoScriptText(SAY_TELEPORT, me);
                            DoTeleportTo(PosGroundLiveSide);
                            me->SetReactState(REACT_AGGRESSIVE);
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
                            summons.DoAction(0, 0);
                            summons.DoZoneInCombat();
                            events.ScheduleEvent(EVENT_BOLT, 1000);
                            events.ScheduleEvent(EVENT_HARVEST, urand(3000,15000));
                            events.ScheduleEvent(EVENT_TELEPORT, 20000);
                        }
                        break;
                    case EVENT_BOLT:
                        DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT));
                        events.ScheduleEvent(EVENT_BOLT, 1000);
                        break;
                    case EVENT_HARVEST:
                        DoCast(me->getVictim(), SPELL_HARVEST_SOUL, true);
                        events.ScheduleEvent(EVENT_HARVEST, urand(20000,25000));
                        break;
                    case EVENT_TELEPORT:
                        if (!thirtyPercentReached)
                        {
                            me->AttackStop();
                            if (IN_LIVE_SIDE(me))
                            {
                                DoTeleportTo(PosGroundDeadSide);
                            }
                            else
                            {
                                DoTeleportTo(PosGroundLiveSide);
                            }

                            me->getThreatManager().resetAggro(NotOnSameSide(me));
                            if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0))
                            {
                                me->getThreatManager().addThreat(pTarget, 100.0f);
                                AttackStart(pTarget);
                            }

                            events.ScheduleEvent(EVENT_TELEPORT, 20000);
                        }
                        break;
                }
            }

            DoMeleeAttackIfReady();
        }