Esempio n. 1
0
            void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
            {
                std::list<Creature*> MinionList;
                GetTarget()->GetAllMinionsByEntry(MinionList, GetSpellInfo()->Effects[EFFECT_0].MiscValue);

                // Get the last summoned RoF, save it and despawn older ones
                for (std::list<Creature*>::iterator itr = MinionList.begin(); itr != MinionList.end(); itr++)
                {
                    TempSummon* summon = (*itr)->ToTempSummon();

                    if (ringOfFrost && summon)
                    {
                        if (summon->GetTimer() > ringOfFrost->GetTimer())
                        {
                            ringOfFrost->DespawnOrUnsummon();
                            ringOfFrost = summon;
                        }
                        else
                            summon->DespawnOrUnsummon();
                    }
                    else if (summon)
                        ringOfFrost = summon;
                }
            }
Esempio n. 2
0
		void UpdateAI(uint32 diff)
		{
			if (wipe_timer <= diff)
			{
				if (me->GetInstanceScript() && me->GetInstanceScript()->GetData(TYPE_IS_WIPE))
				{
					me->GetInstanceScript()->SetData(TYPE_IS_WIPE, 1);
					wipe_timer = 2000;
				}
			}
			else
				wipe_timer -= diff;

			if (!UpdateVictim())
				return;

			events.Update(diff);

			if (me->GetHealthPct() < 70.f && status == PHASE_1)
			{
				me->AddAura(SPELL_JADE_ESSENCE, me);

				events.Reset();
				events.ScheduleEvent(EVENT_JADE_SERPENT_STRIKE, 5000);
				events.ScheduleEvent(EVENT_JADE_SERPENT_KICK, 10000);
				Talk(TALK_EVENT_01);
				status = PHASE_2;
			}
			if (me->GetHealthPct() < 30.f && status == PHASE_2)
			{
				events.Reset();
				events.ScheduleEvent(EVENT_SUMMON_YULON, 500);
				Talk(TALK_EVENT_02);
				status = PHASE_3;
			}

			while (uint32 eventId = events.ExecuteEvent())
			{
				switch (eventId)
				{
				case EVENT_SERPENT_STRIKE:
				{
					me->CastSpell(me->GetVictim(), SPELL_SERPENT_STRIKE, false);
					Map::PlayerList const& PlayerList = me->GetInstanceScript()->instance->GetPlayers();

					if (!PlayerList.isEmpty())
					{
						for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
						{
							Player* plr = i->GetSource();
							if (!plr)
								continue;
							if (plr->GetDistance2d(me) < 10.f)
								plr->KnockbackFrom(me->GetPositionX(), me->GetPositionY(), 10, 10);
						}
					}
					events.ScheduleEvent(EVENT_SERPENT_STRIKE, 10000);
					events.ScheduleEvent(EVENT_SERPENT_WAVE, 4000);
				}
				break;
				case EVENT_SERPENT_KICK:
					me->CastSpell(me->GetVictim(), SPELL_SERPENT_KICK, false);
					events.ScheduleEvent(EVENT_SERPENT_KICK, 10000);
					break;
				case EVENT_SERPENT_WAVE:
				{
					TempSummon* sum = nullptr;
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 932.775f, -2548.743f, 179.821f, 1.254f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 939.796f, -2530.586f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 940.014f, -2564.114f, 179.821f, 5.978f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 957.711f, -2570.030f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 925.971f, -2572.423f, 179.821f, 4.395f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 919.606f, -2591.245f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 918.923f, -2557.356f, 179.821f, 2.821f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 901.839f, -2551.843f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
				}
				break;
				case EVENT_JADE_SERPENT_STRIKE:
				{
					me->CastSpell(me->GetVictim(), SPELL_JADE_SERPENT_STRIKE, false);

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

					if (!PlayerList.isEmpty())
					{
						for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
						{
							Player* plr = i->GetSource();
							if (!plr)
								continue;
							if (plr->GetDistance2d(me) < 10.f)
								plr->KnockbackFrom(me->GetPositionX(), me->GetPositionY(), 10, 10);
						}
					}
					events.ScheduleEvent(EVENT_JADE_SERPENT_STRIKE, 10000);
					events.ScheduleEvent(EVENT_JADE_SERPENT_WAVE, 4000);
				}
				break;
				case EVENT_JADE_SERPENT_KICK:
					me->CastSpell(me->GetVictim(), SPELL_JADE_SERPENT_KICK, false);
					events.ScheduleEvent(EVENT_JADE_SERPENT_KICK, 10000);
					break;
				case EVENT_JADE_SERPENT_WAVE:
				{
					TempSummon* sum = nullptr;
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 932.775f, -2548.743f, 179.821f, 1.254f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_JADE_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 939.796f, -2530.586f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 940.014f, -2564.114f, 179.821f, 5.978f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_JADE_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 957.711f, -2570.030f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 925.971f, -2572.423f, 179.821f, 4.395f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_JADE_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 919.606f, -2591.245f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 918.923f, -2557.356f, 179.821f, 2.821f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_JADE_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 901.839f, -2551.843f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
				}
				break;
				case EVENT_SUMMON_YULON:
					me->CastSpell(me, SPELL_SUMMON_JADE_SERPENT, false);
					me->CastSpell(me, SPELL_JADE_SOUL, false);
					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
					me->ApplySpellImmune(SPELL_JADE_SOUL, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
					me->ApplySpellImmune(SPELL_JADE_SOUL, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
					me->SetReactState(REACT_PASSIVE);
					me->AddUnitState(UNIT_STATE_ROOT);
					events.ScheduleEvent(EVENT_AURA_JADE, 3000);
					break;

				case EVENT_AURA_JADE:
					me->CastSpell(me, SPELL_JADE_SOUL, false);
					events.ScheduleEvent(EVENT_AURA_JADE, 2500);
					break;
				}
			}

			DoMeleeAttackIfReady();
		}