void Reset() override
            {
                _Reset();

                if (_phase == PHASE_FLIGHT)
                    ClearIceBlock();

                Initialize();
            }
Exemple #2
0
		void Reset() {
			_Reset();

			if (phase == PHASE_FLIGHT)
				ClearIceBlock();

			phase = PHASE_NULL;

			CanTheHundredClub = true;
			CheckFrostResistTimer = 5000;
		}
            void Reset()
            {
                _Reset();

                if (_phase == PHASE_FLIGHT)
                    ClearIceBlock();

                _phase = PHASE_NULL;

                _canTheHundredClub = true;
                _checkFrostResistTimer = 5 * IN_MILLISECONDS;
            }
        void Reset()
        {
            _Reset();

            if (phase == PHASE_FLIGHT)
            {
                ClearIceBlock();
                me->SetReactState(REACT_AGGRESSIVE);
                me->SetDisableGravity(false);
            }

            phase = PHASE_NULL;

            CanTheHundredClub = true;
            CheckFrostResistTimer = 5000;
        }
Exemple #5
0
		void Reset() override
		{
			_Reset();

			if (_phase == PHASE_FLIGHT)
			{
				ClearIceBlock();
				me->SetReactState(REACT_AGGRESSIVE);
				if (me->IsHovering())
				{
					me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
					me->SetHover(false);
				}
				me->SetDisableGravity(false);
			}

			Initialize();
		}
        void UpdateAI(const uint32 diff)
        {
            if (!phase)
                return;

            events.Update(diff);

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

            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:
                            DoCast(me->getVictim(), 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);
                            if (Creature* summon = DoSummon(MOB_BLIZZARD, me, 0.0f, urand(25000, 30000), 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;
                    }
                }//if (uint32 eventId = events.ExecuteEvent())
            }//if (phase == PHASE_GROUND)
        }
Exemple #7
0
		void UpdateAI(uint32 diff) override
		{
			if (!_phase)
				return;

			events.Update(diff);

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

			if (_phase == PHASE_GROUND)
			{
				while (uint32 eventId = events.ExecuteEvent())
				{
					switch (eventId)
					{
					case EVENT_CHECK_RESISTS:
						DoCast(me, SPELL_CHECK_RESISTS);
						events.ScheduleEvent(EVENT_CHECK_RESISTS, 30 * IN_MILLISECONDS);
						return;
					case EVENT_BERSERK:
						Talk(EMOTE_ENRAGE);
						DoCast(me, SPELL_BERSERK);
						return;
					case EVENT_CLEAVE:
						DoCastVictim(SPELL_CLEAVE);
						events.ScheduleEvent(EVENT_CLEAVE, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND);
						return;
					case EVENT_TAIL:
						DoCastAOE(SPELL_TAIL_SWEEP);
						events.ScheduleEvent(EVENT_TAIL, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND);
						return;
					case EVENT_DRAIN:
						DoCastAOE(SPELL_LIFE_DRAIN);
						events.ScheduleEvent(EVENT_DRAIN, 24 * IN_MILLISECONDS, 0, PHASE_GROUND);
						return;
					case EVENT_BLIZZARD:
					{
						if (Creature* summon = DoSummon(NPC_BLIZZARD, me, 0.0f, urand(25, 30) * IN_MILLISECONDS, TEMPSUMMON_TIMED_DESPAWN))
							summon->GetMotionMaster()->MoveRandom(40);
						events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20, 7) * IN_MILLISECONDS, 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_CHECK_RESISTS:
						DoCast(me, SPELL_CHECK_RESISTS);
						events.ScheduleEvent(EVENT_CHECK_RESISTS, 30 * IN_MILLISECONDS);
						return;
					case EVENT_LIFTOFF:
						Talk(EMOTE_AIR_PHASE);
						me->SetDisableGravity(true);
						me->SetHover(true);
						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, rand32() % targets.size());
							_iceblocks.insert(std::make_pair((*itr)->GetGUID(), ObjectGuid::Empty));
							DoCast(*itr, SPELL_ICEBOLT);
							--_iceboltCount;
						}

						if (_iceboltCount)
							events.ScheduleEvent(EVENT_ICEBOLT, 1 * IN_MILLISECONDS);
						else
							events.ScheduleEvent(EVENT_BREATH, 1 * IN_MILLISECONDS);
						return;
					}
					case EVENT_BREATH:
					{
						Talk(EMOTE_BREATH);
						DoCastAOE(SPELL_FROST_MISSILE);
						events.ScheduleEvent(EVENT_EXPLOSION, 8 * IN_MILLISECONDS);
						return;
					}
					case EVENT_EXPLOSION:
						CastExplosion();
						ClearIceBlock();
						events.ScheduleEvent(EVENT_LAND, 3 * IN_MILLISECONDS);
						return;
					case EVENT_LAND:
						me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
						Talk(EMOTE_GROUND_PHASE);
						me->SetHover(false);
						me->SetDisableGravity(false);
						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;
					}
				}
			}
		}