Пример #1
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
                
            events.Update(diff);
            
            if (me->hasUnitState(UNIT_STAT_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_MOVE_POS:
                        MovePos();
                        events.RescheduleEvent(EVENT_MOVE_POS, 10000);
                    break;
                    case EVENT_ENRAGE:
                        DoScriptText(SAY_BRUNDIR_BERSERK, me);
                        DoCast(SPELL_BERSERK);
                    break;
                    case EVENT_CHAIN_LIGHTNING:
                        if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                            DoCast(pTarget, SPELL_CHAIN_LIGHTNING);
                        events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(4000, 6000));
                    break;
                    case EVENT_OVERLOAD:
                        me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true);
                        DoScriptText(SAY_BRUNDIR_SPECIAL, me);
                        me->GetMotionMaster()->Initialize();
                        DoCast(SPELL_OVERLOAD);
                        events.ScheduleEvent(EVENT_OVERLOAD, urand(60000, 120000));
                    break;
                    case EVENT_LIGHTNING_WHIRL:
                        me->GetMotionMaster()->Initialize();
                        DoCast(SPELL_LIGHTNING_WHIRL);
                        events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(15000, 20000));
                    break;
                    case EVENT_LIGHTNING_TENDRILS:
                        DoScriptText(SAY_BRUNDIR_FLIGHT, me);
                        DoCast(SPELL_LIGHTNING_TENDRILS);
                        me->AttackStop();
                        me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
                        DoCast(SPELL_LIGHTNING_TENDRILS_SELF_VISUAL);
                        me->GetMotionMaster()->Initialize();
                        me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), 440);
                        events.DelayEvents(35000);
                        events.ScheduleEvent(EVENT_FLIGHT, 2500);
                        events.ScheduleEvent(EVENT_ENDFLIGHT, 28000);
                        events.ScheduleEvent(EVENT_LIGHTNING_TENDRILS, 90000);
                    break;
                    case EVENT_FLIGHT:
                        if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                            me->GetMotionMaster()->MovePoint(0, pTarget->GetPositionX(), pTarget->GetPositionY(), 440);
                        events.ScheduleEvent(EVENT_FLIGHT, 6000);
                    break;
                    case EVENT_ENDFLIGHT:
                        me->GetMotionMaster()->Initialize();
                        me->GetMotionMaster()->MovePoint(0, 1586.920166f, 119.848984f, 440);
                        events.CancelEvent(EVENT_FLIGHT);
                        events.CancelEvent(EVENT_ENDFLIGHT);
                        events.ScheduleEvent(EVENT_LAND, 4000);
                    break;
                    case EVENT_LAND:
                        me->GetMotionMaster()->Initialize();
                        me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), 427.28f);
                        events.CancelEvent(EVENT_LAND);
                        events.ScheduleEvent(EVENT_GROUND, 2500);
                    break;
                    case EVENT_GROUND:
                        me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
                        me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS);
                        me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_SELF_VISUAL);
                        events.CancelEvent(EVENT_GROUND);
                    break;
                }
            }
        }
Пример #2
0
 void Reset()
 {
     events.Reset();
 }
Пример #3
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_ENRAGE:
                        DoScriptText(SAY_MOLGEIM_BERSERK, me);
                        DoCast(SPELL_BERSERK);
                    break;
                    case EVENT_RUNE_OF_POWER: // random alive friendly
                    {
                        Creature* bosschoosed;
                        uint32 choice = urand(0,2);

                        if (!pInstance) break;
                        
                        bosschoosed = Unit::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+choice));

                        if (!bosschoosed || !bosschoosed->isAlive()) {
                            choice = ((choice == 2) ? 0 : choice++);
                            bosschoosed = Unit::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+choice));
                            if (!bosschoosed || !bosschoosed->isAlive()) {
                                choice = ((choice == 2) ? 0 : choice++);
                                bosschoosed = Unit::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+choice));
                            }
                        }

                        if (!bosschoosed || !bosschoosed->isAlive())
                            bosschoosed = Unit::GetCreature(*me, pInstance->GetData64(DATA_MOLGEIM));
                        
                        DoCast(bosschoosed, SPELL_RUNE_OF_POWER);
                        events.ScheduleEvent(EVENT_RUNE_OF_POWER, 35000);
                    }
                    break;
                    case EVENT_SHIELD_OF_RUNES:
                        DoCast(me, SPELL_SHIELD_OF_RUNES);
                        events.ScheduleEvent(EVENT_SHIELD_OF_RUNES, urand(60000, 80000));
                    break;
                    case EVENT_RUNE_OF_DEATH:
                    {
                        DoScriptText(SAY_MOLGEIM_RUNE_DEATH, me);
                        if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                            DoCast(pTarget, SPELL_RUNE_OF_DEATH);
                        events.ScheduleEvent(EVENT_RUNE_OF_DEATH, 30000);
                    }
                    break;
                    case EVENT_RUNE_OF_SUMMONING:
                    {
                        DoScriptText(SAY_MOLGEIM_SUMMON, me);
                        if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                            DoCast(pTarget, SPELL_RUNE_OF_SUMMONING);
                        events.ScheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(40000, 50000));
                    }
                    break;
                    
                }
            }

            DoMeleeAttackIfReady();
        }
Пример #4
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            events.Update(diff);

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

            switch (events.ExecuteEvent())
            {
            case EVENT_FURIOUS_STONE_BREATH:
                {
                    me->CastSpell(me->getVictim(), SPELL_FURIOUS_STONE_BREATH_DAMAGE);
                    events.ScheduleEvent(EVENT_FURIOUS_STONE_BREATH, 45000);
                    break;
                }
            case EVENT_SNAPPING_BITE:
                me->CastSpell(me->getVictim(), SPELL_SNAPPING_BITE);
                events.ScheduleEvent(EVENT_SNAPPING_BITE, 6000);
                break;
            case EVENT_ROCK_FALL:
                for (int i = 0; i <= 6; i++)
                {
                    if (Unit* pl = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                    {
                        Position pos;
                        pl->GetRandomNearPosition(pos, 30.0f);

                        me->SummonCreature(TRIGGER_ROCKFALL, pos, TEMPSUMMON_TIMED_DESPAWN, 10000);
                    }
                }
                events.ScheduleEvent(EVENT_ROCK_FALL, 15000);
                break;
            case EVENT_QUAKE_STOMP:
            {
                for (int i = 0; i <= 6; i++)
                {
                    if (Unit* pl = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                    {
                        Position pos;
                        pl->GetRandomNearPosition(pos, 30.0f);

                        me->SummonCreature(TRIGGER_ROCKFALL, pos, TEMPSUMMON_TIMED_DESPAWN, 10000);
                    }
                }

                me->CastSpell(me, SPELL_QUAKE_STOMP);
                events.ScheduleEvent(EVENT_QUAKE_STOMP, urand(18000, 24000));
                break;
            }
            case EVENT_SUMMON_BAT_CAVES:
                if (Unit* pl = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                {
                    for (int i = 0; i <= 5; i++)
                    {
                        Creature* vampiric = me->SummonCreature(CREATURE_VAMPIRIC_BAT_CAVE, pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN);

                        if (vampiric)
                            vampiric->SetReactState(REACT_AGGRESSIVE);
                    }
                    events.ScheduleEvent(EVENT_SUMMON_BAT_CAVES, 50000);
                }
                break;
            case EVENT_CALL_OF_TORTOS:
                for (int i = 0; i < 3; i++)
                {
                    me->SummonCreature(CREATURE_WHIRL_TURTLE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0);
                }
                events.ScheduleEvent(EVENT_CALL_OF_TORTOS, 35000);
                break;
            }
            DoMeleeAttackIfReady();
        }
            void UpdateAI(uint32 diff)
            {
                if (!pInstance || !UpdateVictim())
                    return;

                Summons.DespawnAll();
                events.Update(diff);

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                    case EVENT_LIGHTNING_BOLT:
                        if (me->HasUnitState(UNIT_STATE_CASTING))
                            return;
                        DoCastVictim(SPELL_LIGHTNING_BOLT);
                        events.ScheduleEvent(EVENT_LIGHTNING_BOLT, 2000);
                        break;
                    case EVENT_CALL_VORTEX:
                        for (uint8 i = 0; i < 8; i++)
                            if (_vortexes[i])
                            {
                                float _angle;
                                _angle = me->GetAngle(_vortexes[i]->GetPositionX(), _vortexes[i]->GetPositionY());
                                Position _pos = me->GetNearPosition(5.0f, _angle);
                                _vortexes[i]->GetMotionMaster()->MovementExpired(false);
                                _vortexes[i]->GetMotionMaster()->MovePoint(1, _pos);
                            }
                        
                        events.ScheduleEvent(EVENT_RESET_VORTEX, urand(14000, 17000));
                        break;
                    case EVENT_RESET_VORTEX:
                        for (uint8 i = 0; i < 8; i++)
                            if (_vortexes[i])
                            {
                                _vortexes[i]->GetMotionMaster()->MovementExpired(false);
                                _vortexes[i]->GetMotionMaster()->MovePoint(2, ertanvortexPos_1[i]);
                            }
                        events.ScheduleEvent(EVENT_CALL_VORTEX, urand(20000, 25000));
                        break;
                    case EVENT_STORM_EDGE:
                        _distance = me->GetDistance2d(_vortexes[1]);
                        if (me->GetMap()->GetPlayers().isEmpty())
                            return;
                        for (Map::PlayerList::const_iterator itr = me->GetMap()->GetPlayers().begin(); itr != me->GetMap()->GetPlayers().end(); ++itr)
                        {
                            if (Player* pPlayer = itr->GetSource())
                            {
                                if (me->GetDistance2d(pPlayer) > _distance)
                                {
                                    //uint8 i = urand(0, 7);
                                    //if (_vortexes[i])
                                        //_vortexes[i]->CastSpell(itr->GetSource(), SPELL_STORM_EDGE, true);
                                    DoCast(pPlayer, SPELL_STORM_EDGE, true);
                                }
                            }
                        }
                        events.ScheduleEvent(EVENT_STORM_EDGE, 2000);
                        break;
                    }
                }                    
            }
 void EnterCombat(Unit* who)
 {
     events.ScheduleEvent(EVENT_SOUL_SEVER, 1000);
     events.ScheduleEvent(EVENT_WAIL_OF_DARKNESS, urand(1000, 4000));
     me->CastSpell(who, SPELL_SOUL_SEVER, false);
 }
Пример #7
0
        void UpdateAI(uint32 diff) override
        {
            switch (phase)
            {
            case PHASE_CHAINED:
                if (!anchorGUID)
                {
                    if (Creature* anchor = me->FindNearestCreature(29521, 30))
                    {
                        anchor->AI()->SetGUID(me->GetGUID());
                        anchor->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true);
                        anchorGUID = anchor->GetGUID();
                    }
                    else
                        TC_LOG_ERROR("scripts", "npc_unworthy_initiateAI: unable to find anchor!");

                    float dist = 99.0f;
                    GameObject* prison = NULL;

                    for (uint8 i = 0; i < 12; ++i)
                    {
                        if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i], 30))
                        {
                            if (me->IsWithinDist(temp_prison, dist, false))
                            {
                                dist = me->GetDistance2d(temp_prison);
                                prison = temp_prison;
                            }
                        }
                    }

                    if (prison)
                        prison->ResetDoorOrButton();
                    else
                        TC_LOG_ERROR("scripts", "npc_unworthy_initiateAI: unable to find prison!");
                }
                break;
            case PHASE_TO_EQUIP:
                if (wait_timer)
                {
                    if (wait_timer > diff)
                        wait_timer -= diff;
                    else
                    {
                        me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ());
                        //TC_LOG_DEBUG("scripts", "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ());
                        phase = PHASE_EQUIPING;
                        wait_timer = 0;
                    }
                }
                break;
            case PHASE_TO_ATTACK:
                if (wait_timer)
                {
                    if (wait_timer > diff)
                        wait_timer -= diff;
                    else
                    {
                        me->setFaction(14);
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
                        phase = PHASE_ATTACKING;

                        if (Player* target = ObjectAccessor::GetPlayer(*me, playerGUID))
                            AttackStart(target);
                        wait_timer = 0;
                    }
                }
                break;
            case PHASE_ATTACKING:
                if (!UpdateVictim())
                    return;

                events.Update(diff);

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                    case EVENT_ICY_TOUCH:
                        DoCastVictim(SPELL_ICY_TOUCH);
                        events.DelayEvents(1000, GCD_CAST);
                        events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST);
                        break;
                    case EVENT_PLAGUE_STRIKE:
                        DoCastVictim(SPELL_PLAGUE_STRIKE);
                        events.DelayEvents(1000, GCD_CAST);
                        events.ScheduleEvent(EVENT_PLAGUE_STRIKE, 5000, GCD_CAST);
                        break;
                    case EVENT_BLOOD_STRIKE:
                        DoCastVictim(SPELL_BLOOD_STRIKE);
                        events.DelayEvents(1000, GCD_CAST);
                        events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST);
                        break;
                    case EVENT_DEATH_COIL:
                        DoCastVictim(SPELL_DEATH_COIL);
                        events.DelayEvents(1000, GCD_CAST);
                        events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST);
                        break;
                    }
                }

                DoMeleeAttackIfReady();
                break;
            default:
                break;
            }
        }
 void EnterCombat(Unit* /*who*/)
 {
     events.SetPhase(PHASE_BLAZE);
     me->CastSpell(me, SPELL_BLAZE_OF_THE_HEAVENS_PERIODIC, false);
     events.ScheduleEvent(EVENT_SUMMON_BLAZE_OF_THE_HEAVENS_GROUND, 3000, 0, PHASE_BLAZE);
 }
 void Reset()
 {
     Dead = false;
     events.Reset();
 }
Пример #10
0
 void Reset()
 {
     events.Reset();
     uiBlazeTimer = 5;
 }
Пример #11
0
        void UpdateAI(uint32 diff)
        {
            if (!UpdateVictim())
                return;

            events.Update(diff);

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

            if (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_REPENTANCE:
                        {
                            ++uiEventPhase;

                            switch(uiEventPhase)
                            {
                                case 1:
                                    me->CastSpell(me, SPELL_REPENTANCE_PLAYER_PULL, false);
                                    events.ScheduleEvent(EVENT_REPENTANCE, 1000, 0, PHASE_REPENTANCE);
                                    break;
                                case 2:
                                    me->CastSpell(me, SPELL_REPENTANCE_PLAYER_KNEEL, false);
                                    events.ScheduleEvent(EVENT_REPENTANCE, 6000, 0, PHASE_REPENTANCE);
                                    break;
                                case 3:
                                    me->CastSpell(me, SPELL_REPENTANCE_PLAYER_CHANGE_PHASE, false);
                                    me->CastSpell(me, SPELL_REPENTANCE_PLAYER_KNOCK_BACK, false);
                                    me->CastSpell(me, SPELL_WAIL_OF_DARKNESS_SUMMON_WAIL, false);
                                    events.ScheduleEvent(EVENT_REPENTANCE, 1000, 0, PHASE_REPENTANCE);
                                    break;
                                case 4:
                                    {
                                        events.ScheduleEvent(EVENT_REPENTANCE, 3000, 0, PHASE_REPENTANCE);

                                        if (Creature* veil = me->FindNearestCreature(NPC_WAIL_OF_DARKNESS, 30.0f))
                                            veil->CastSpell(veil, SPELL_WAIL_OF_DARKNESS_SUMMON_HARBINGER, false);
                                    }
                                    break;
                                case 5:
                                    {
                                        if (Creature* veil = me->FindNearestCreature(NPC_WAIL_OF_DARKNESS, 30.0f))
                                        {
                                            veil->RemoveAura(SPELL_WAIL_OF_DARKNESS_VISUAL);
                                            veil->DespawnOrUnsummon(3500);
                                        }
                                    }
                                    break;
                                case 6:
                                    {
                                        me->SetReactState(REACT_AGGRESSIVE);
                                        me->RemoveAura(SPELL_REPENTANCE_START);
                                        events.Reset();
                                        events.SetPhase(PHASE_BARIM);
                                        events.ScheduleEvent(EVENT_FIFTY_LASHINGS, 5000, 0, PHASE_BARIM);
                                        events.ScheduleEvent(EVENT_HEAVENS_FURY, 5000, 0, PHASE_BARIM);
                                        events.ScheduleEvent(EVENT_PLAGUE_OF_AGES, 6000, 0, PHASE_BARIM);

                                        if (instance)
											if (Creature* blaze = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLAZE)))
                                                blaze->AI()->DoAction(ACTION_REPENTANCE_DONE);
                                    }
                                    break;
                            }
                        }
                        break;
                    case EVENT_SUMMON_BLAZE_OF_THE_HEAVENS:
                        {
                            ++uiEventPhase;

                            switch (uiEventPhase)
                            {
                                case 1:
                                    me->CastSpell(me, SPELL_SUMMON_BLAZE_OF_THE_HEAVENS_SUMMONER, false);
                                    events.ScheduleEvent(EVENT_SUMMON_BLAZE_OF_THE_HEAVENS, 2000);
                                    break;
                                case 2:
                                    {
                                        events.ScheduleEvent(EVENT_SUMMON_BLAZE_OF_THE_HEAVENS, 3000);

                                        if (Creature* blaze = me->FindNearestCreature(NPC_BLAZE_OF_THE_HEAVENS_SUMMONER, 100.0f))
                                            blaze->CastSpell(blaze, SPELL_SUMMON_BLAZE_OF_THE_HEAVENS, false);
                                    }
                                    break;
                                case 3:
                                    {
                                        uiEventPhase = 0;

                                        if (Creature* blaze = me->FindNearestCreature(NPC_BLAZE_OF_THE_HEAVENS_SUMMONER, 100.0f))
                                        {
                                            blaze->RemoveAura(SPELL_BLAZE_OF_THE_HEAVENS_VISUAL);
                                            blaze->DespawnOrUnsummon(3500);
                                        }
                                    }
                                    break;
                            }
                        }
                        break;
                    case EVENT_HEAVENS_FURY:
                        {
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                                me->CastSpell(target, SPELL_HEAVENS_FURY, false);

                            events.ScheduleEvent(EVENT_HEAVENS_FURY, urand(15000, 30000), 0, PHASE_BARIM);
                        }
                        break;
                    case EVENT_FIFTY_LASHINGS:
                        events.ScheduleEvent(EVENT_FIFTY_LASHINGS, urand(15000, 30000), 0, PHASE_BARIM);
                        me->CastSpell(me, SPELL_FIFTY_LASHINGS, false);
                        break;
                    case EVENT_PLAGUE_OF_AGES:
                        {
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                                me->CastSpell(target, SPELL_PLAGUE_OF_AGES, false, NULL, NULL, target->GetGUID());

                            events.ScheduleEvent(EVENT_PLAGUE_OF_AGES, urand(10000, 25000), 0, PHASE_BARIM);
                        }
                        break;
                }
            }

            DoMeleeAttackIfReady();
        }
Пример #12
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            events.Update(diff);

            if (me->HasUnitState(UNIT_STAT_CASTING) && Phase!=PHASE_1)
                return;

            Creature* pCrystalHandler;
            Creature* summon;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_CRYSTAL:
                    DoScriptText(SAY_NECRO_ADD, me);
                    pCrystalHandler = me->SummonCreature(CREATURE_CRYSTAL_HANDLER, CrystalHandlerSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20*IN_MILLISECONDS);
                    pCrystalHandler->GetMotionMaster()->MovePoint(0, AddDestinyPoint);
                    events.ScheduleEvent(EVENT_CRYSTAL, 20000);
    //                events.ScheduleEvent(EVENT_CRYSTAL, urand(20000, 30000));
                    break;
                case EVENT_SUMMON:
                    summon = me->SummonCreature(RAND(CREATURE_FETID_TROLL_CORPSE, CREATURE_HULKING_CORPSE, CREATURE_RISEN_SHADOWCASTER), AddSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20*IN_MILLISECONDS);
                    summon->GetMotionMaster()->MovePoint(0, AddDestinyPoint);
                    events.ScheduleEvent(EVENT_SUMMON, 4000);
    //                events.ScheduleEvent(EVENT_SUMMON, DUNGEON_MODE(3000, 2000));
                    break;
                case EVENT_HERO_SUMMON:
                    for (int i=1;i<=MAX_SUMMONS;i++)
                        me->SummonCreature(CREATURE_FETID_TROLL_CORPSE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
                    events.ScheduleEvent(EVENT_HERO_SUMMON, urand(20000, 30000));
    //                events.ScheduleEvent(EVENT_HERO_SUMMON, urand(5000, 15000));
                case EVENT_BLIZZARD:
                    if (Unit* target=SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(target, SPELL_BLIZZARD);
                    events.ScheduleEvent(EVENT_BLIZZARD, 15000);
    //                events.ScheduleEvent(EVENT_BLIZZARD, 7500);
                    break;
                case EVENT_BOLT:
                    if (Unit* target=SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        if (!me->HasUnitState(UNIT_STAT_CASTING))
                            DoCast(target, SPELL_FROSTBOLT);
                        events.ScheduleEvent(EVENT_BOLT, 2500);
                    break;
                case EVENT_CURSE:
                    if (Unit* target=SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        if (!me->HasUnitState(UNIT_STAT_CASTING))
                            DoCast(target, SPELL_WARTH_OF_MISERY);
                        events.ScheduleEvent(EVENT_CURSE, 9000);
                    break;
                case EVENT_BLAST:
                    if (Unit* target=SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        if (!me->HasUnitState(UNIT_STAT_CASTING))
                            DoCast(target, SPELL_ARCANE_BLAST);
                        events.ScheduleEvent(EVENT_BLAST, urand(20000, 30000));
                    break;
                }
            }

            /*
            if (!me->hasUnitState(UNIT_STAT_CASTING))
            {
                uint8 cast=(urand(0, 100));
                if (cast<=65)
                    events.ScheduleEvent(EVENT_BOLT, 0);
                if (cast<90 && cast>65)
                    events.ScheduleEvent(EVENT_CURSE, 0);
                if (cast>=90)
                    events.ScheduleEvent(EVENT_BLAST, 0);
            } */
        }
		void UpdateAI(const uint32 diff)
		{
			if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING))
				return;

			if(chainsOfWoe != NULL)
				if(chainsOfWoe->isAlive())
				{
					/* Buggy!

					Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();

					if (!PlayerList.isEmpty())
					{
						for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
							if (!i->getSource()->HasAura(SPELL_CHAINS_OF_WOE_AURA))
								me->CastSpell(i->getSource(),SPELL_CHAINS_OF_WOE_AURA,true);
					}*/
				}else
					{
						chainsOfWoe->DespawnOrUnsummon();
						chainsOfWoe = NULL;
					}

				if(castSkullCracker)
				{
					me->MonsterYell("Stand still! Rom'ogg crack your skulls!", LANG_UNIVERSAL, NULL);

					castSkullCracker = false;
					DoCastAOE(SPELL_THE_SKULLCRACKER);

					return;
				}

				events.Update(diff);

				while (uint32 eventId = events.ExecuteEvent())
				{
					switch (eventId)
					{
					case EVENT_QUAKE:
						DoCastAOE(SPELL_QUAKE);

						if(me->GetMap()->IsHeroic())
						{ // Summon Angered Earth
							Position myPos;
							me->GetPosition(&myPos);

							for(uint8 i=1; i<=5; i++)
								me->SummonCreature(NPC_ANGERED_EARTH,myPos,TEMPSUMMON_CORPSE_DESPAWN);
						}

						events.ScheduleEvent(EVENT_QUAKE, 25000);
						break;
					case EVENT_CHAINS_OF_WOE:

						DoCastAOE(SPELL_CHAINS_OF_WOE);

						castSkullCracker = true;
						events.ScheduleEvent(EVENT_CHAINS_OF_WOE, 20000);
						break;
					case EVENT_WOUNDING_STRIKE:
						DoCastVictim(SPELL_WOUNDING_STRIKE);
						events.ScheduleEvent(EVENT_WOUNDING_STRIKE, 15000);
						break;
					}
				}

				DoMeleeAttackIfReady();
		}
Пример #14
0
        void UpdateAI(uint32 diff)
        {
            if(!UpdateVictim())
                return;

            ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
            ThreatContainer::StorageType::const_iterator i = threatlist.begin();

            events.Update(diff);

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

            while(uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {    
                    case EVENT_DISTANCE:
                        distanceMelee = true;
                        for (i = threatlist.begin(); i != threatlist.end(); ++i)
                        {
                            if (Unit* player = Unit::GetUnit(*me, (*i)->getUnitGuid()))
                                if (player && (player->GetTypeId() == TYPEID_PLAYER) && me->IsWithinMeleeRange(player, 5.0f))
                                {
                                    distanceMelee = false;
                                    break;
                                }
                        }

                        if (distanceMelee)
                            events.ScheduleEvent(EVENT_SEETHE, 2*IN_MILLISECONDS);

                        events.ScheduleEvent(EVENT_DISTANCE, 200);
                        break;

                    case EVENT_SEETHE:
                        me->CastSpell(me->getVictim(), SPELL_SEETHE);
                        distanceMelee = false;
                        break;

                    case EVENT_ENDLESS_RAGE:
                        me->CastSpell(me->getVictim(), SPELL_ENDLESS_RAGE);
                        Talk(SAY_ENDLESS_RAGE);
                        break;

                    case EVENT_GROWING_ANGER:
                        me->CastSpell(me, SPELL_GROWING_ANGER);
                        Talk(SAY_GROWING_ANGER);
                        break;

                    case EVENT_PHASE_GROWING_ANGER:
                        events.SetPhase(PHASE_GROWING_ANGER);
                        events.ScheduleEvent(EVENT_ENDLESS_RAGE, 20*IN_MILLISECONDS);
                        events.ScheduleEvent(EVENT_GROWING_ANGER, urand(30*IN_MILLISECONDS, 35*IN_MILLISECONDS));
                        events.ScheduleEvent(EVENT_UNLEASHED_WRATH, 50*IN_MILLISECONDS);
                        break;

                    case EVENT_UNLEASHED_WRATH:
                        DoCast(SPELL_UNLEASHED_WRATH);
                        events.SetPhase(PHASE_UNLEASHED_WRATH);
                        events.ScheduleEvent(EVENT_PHASE_GROWING_ANGER, 25*IN_MILLISECONDS, 0, PHASE_GROWING_ANGER);
                        events.ScheduleEvent(EVENT_ENDLESS_RAGE, 15*IN_MILLISECONDS);
                        break;

                    case EVENT_BERSERK:
                        DoCast(SPELL_BERSERK);
                        break;

                    default:
                        break;
                }
            }
            DoMeleeAttackIfReady();
        }