示例#1
0
 void SummonedCreatureDespawn(Creature* summon)
 {
     summons.Despawn(summon);
     if (summon->GetEntry() != NPC_SUNWELL_DEFENDER && me->isActiveObject())
     {
         if (summon->GetEntry() == NPC_MORLEN_COLDGRIP)
         {
             me->RemoveAurasDueToSpell(67541);
             me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
             me->GetMotionMaster()->MoveCharge(11779.30f, -7065.43f, 24.92f, me->GetSpeed(MOVE_RUN), EVENT_CHARGE);
             events.ScheduleEvent(EVENT_OUTRO_0, 0);
             events.ScheduleEvent(EVENT_OUTRO_1, 5000);
             events.ScheduleEvent(EVENT_OUTRO_2, 12000);
             events.ScheduleEvent(EVENT_OUTRO_3, 19000);
         }
         else if (summons.size() == 1)
         {
             me->RemoveAurasDueToSpell(67541);
             me->GetMotionMaster()->MoveCharge(11779.30f, -7065.43f, 24.92f, me->GetSpeed(MOVE_RUN), EVENT_CHARGE);
             switch(summon->GetEntry())
             {
                 case NPC_SCOURGE_ZOMBIE:
                     events.ScheduleEvent(EVENT_SPAWN_WAVE_2, 3000);
                     break;
                 case NPC_GHOUL_INVADER:
                     events.ScheduleEvent(EVENT_SPAWN_WAVE_3, 3000);
                     break;
                 case NPC_CRYPT_RAIDER:
                     events.ScheduleEvent(EVENT_SUMMONS_ATTACK, 3000);
                     break;
             }
         }
     }
 }
 void JustSummoned(Creature* summon)
 {
     if(summon->GetEntry() != me->GetEntry())
     {
         summon->GetMotionMaster()->MovePoint(0, *me, false);
         summon->GetMotionMaster()->MoveFollow(me, 0.1f, 0.0f + M_PI*0.3f*summons.size());
     }
     summons.Summon(summon);
 }
        void JustSummoned(Creature* summon)
        {
            summons.Summon(summon);
            if (Creature* thrall = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(DATA_THRALL_GUID)))
                thrall->AI()->JustSummoned(summon);
            summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);

            if (summon->GetEntry() == NPC_SKARLOC_MOUNT)
                return;

            if (summons.size() == 1)
                summon->GetMotionMaster()->MovePoint(0, 2060.788f, 237.301f, 63.999f);
            else
                summon->GetMotionMaster()->MovePoint(0, 2056.870f, 234.853f, 63.839f);
        }
示例#4
0
            void EnterCombat(Unit* who)
            {
				events.Reset();
				if (summons.size() < 4)
					ResetSummons();

                summons.DoZoneInCombat();

                events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 5000);
                events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000);
                events.ScheduleEvent(EVENT_BERSERK, 360000);
                events.ScheduleEvent(EVENT_OVERCHARGE, 47000);

				if (pInstance)
					pInstance->SetData(EVENT_EMALON, IN_PROGRESS);
            }
示例#5
0
		void OozesMeetCheck()
		{
			if (summons.empty() || summons.size()==1)
				return;

			for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
			{
				Creature* ooze = ObjectAccessor::GetCreatureOrPetOrVehicle((*me), (*itr));
				if (!ooze || !ooze->isAlive())
					continue;
				if (ooze->GetEntry() != CREATURE_LITTLE_OOZE && ooze->GetEntry() != CREATURE_OOZE_BIG)
					continue;

				bool little = (ooze->GetEntry() == CREATURE_LITTLE_OOZE);

				for(SummonList::const_iterator itr2 = summons.begin(); itr2 != summons.end(); ++itr2)
				{
					Creature* ooze2 = ObjectAccessor::GetCreatureOrPetOrVehicle((*me), (*itr2));
					if (!ooze2 || !ooze2->isAlive())
						continue;
					if (ooze2->GetEntry() != CREATURE_LITTLE_OOZE && ooze2->GetEntry() != CREATURE_OOZE_BIG)
						continue;
					if (ooze2 == ooze)
						continue;

					if (ooze->GetDistance2d(ooze2) > 5.0f)
						continue;

					bool little2 = (ooze2->GetEntry() == CREATURE_LITTLE_OOZE);

					//if first ooze is big ooze
					if (!little)
					{
						//and if second ooze is little
						if (little2)
						{
							ooze->CastSpell(ooze, SPELL_UNSTABLE_OOZE, false);

							if (ooze->GetAura(SPELL_UNSTABLE_OOZE) && ooze->GetAura(SPELL_UNSTABLE_OOZE)->GetStackAmount() >= 5)
								ooze->CastSpell(ooze2->getVictim(), SPELL_UNSTABLE_EXPLOSION, true);

							continue;
						}
						else //big ooze meet another big ooze, check wich one have more buff stack and despawn second one
						{
							uint8 stack1, stack2 = 0;
							if (Aura* aura = ooze->GetAura(SPELL_UNSTABLE_OOZE))
								stack1 = aura->GetStackAmount();
							if (Aura* aura = ooze2->GetAura(SPELL_UNSTABLE_OOZE))
								stack2 = aura->GetStackAmount();

							if (stack1 < stack2)
							{
								ooze2->CastSpell(ooze, SPELL_UNSTABLE_OOZE, false);
								ooze->ForcedDespawn();
								if (ooze2->GetAura(SPELL_UNSTABLE_OOZE) && ooze2->GetAura(SPELL_UNSTABLE_OOZE)->GetStackAmount() >= 5)
								{
									ooze2->CastSpell(ooze2->getVictim(), SPELL_UNSTABLE_EXPLOSION, true);
									ooze2->ForcedDespawn();
								}

								break;
							}
							else
							{
								ooze->CastSpell(ooze, SPELL_UNSTABLE_OOZE, false);
								ooze2->ForcedDespawn();
								if (ooze->GetAura(SPELL_UNSTABLE_OOZE) && ooze->GetAura(SPELL_UNSTABLE_OOZE)->GetStackAmount() >= 5)
								{
									ooze->CastSpell(ooze2->getVictim(), SPELL_UNSTABLE_EXPLOSION, true);
									ooze->ForcedDespawn();
								}
								continue;
							}
						}
					}
					else  //if first ooze is little
					{
						if (little2) //and second ooze is little, despawn both and summon big ooze
						{
							DoSummon(CREATURE_OOZE_BIG, (*ooze));
							ooze->ForcedDespawn();
							ooze2->ForcedDespawn();
							break;
						}
						else
						{
							ooze2->CastSpell(ooze, SPELL_UNSTABLE_OOZE, false);
							ooze->ForcedDespawn();
							if (ooze2->GetAura(SPELL_UNSTABLE_OOZE) && ooze2->GetAura(SPELL_UNSTABLE_OOZE)->GetStackAmount() >= 5)
							{
								ooze2->CastSpell(ooze2->getVictim(), SPELL_UNSTABLE_EXPLOSION, true);
								ooze2->ForcedDespawn();
							}
							break;
						}
					}
				}
			}
		}
        void UpdateAI(const uint32 diff)
        {
            // World Notify Cooldown
            if (notifyCooldown >= diff)
                notifyCooldown -= diff;
            else
                notifyCooldown = 0;

            if (!UpdateVictim())
                return;

            // Defender Quest Credit
            if (!defenderCredit)
                if (me->getThreatManager().getThreatList().size() >= 5 && me->GetHealthPct() < 90.f) // Anti-Farming Conditions
                    defenderCredit = true;

            // Boss rescaling
            if (rescaleTimer <= diff)
            {
                HandleScaling();
                rescaleTimer = 10000;
            } else rescaleTimer -= diff;

            events.Update(diff);

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

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case SPELL_BLIZZARD:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true))
                            DoCast(target, SPELL_BLIZZARD);
                        events.ScheduleEvent(SPELL_BLIZZARD, urand(15000, 18000));
                        break;
                    case SPELL_FIRE_BLAST:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true))
                            DoCast(target, SPELL_FIRE_BLAST);
                        events.ScheduleEvent(SPELL_FIRE_BLAST, urand(5000, 8000));
                        break;
                    case SPELL_FIREBALL:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
                            DoCast(target, SPELL_FIREBALL);
                        events.ScheduleEvent(SPELL_FIREBALL, urand(7000, 10000));
                        break;
                    case SPELL_SUMMON_WATER_ELEMENT:
                        if (Summons.size() < 4)
                            DoCast(me, SPELL_SUMMON_WATER_ELEMENT);
                        events.ScheduleEvent(SPELL_SUMMON_WATER_ELEMENT, urand(20000, 30000));
                        break;
                    case SPELL_TELEPORT:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
                        {
                            DoModifyThreatPercent(target, 100); // Delete Target from Threat List
                            DoCast(target, SPELL_TELEPORT);
                        }
                        events.ScheduleEvent(SPELL_TELEPORT, urand(37000, 52000));
                        break;
                }
            }

            DoMeleeAttackIfReady();
        }
示例#7
0
        void UpdateAI(uint32 diff)
        {
            if (!me->isActiveObject())
                return;

            UpdateVictim();

            events.Update(diff);

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

            switch (uint32 evId = events.GetEvent())
            {
                case 0:
                    break;
                case EVENT_CHECK_PLAYER:
                    if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID))
                        if (p->GetExactDist(me) <= 50.0f)
                        {
                            events.RepeatEvent(5000);
                            break;
                        }
                    events.PopEvent();
                    me->setActive(false);
                    EnterEvadeMode();
                    return;
                case EVENT_SUMMON_SOLDIERS:
                    for (uint8 i=0; i<SUNWELL_DEFENDER_NUM; ++i)
                        me->SummonCreature(NPC_SUNWELL_DEFENDER, SunwellDefenderPos[i], TEMPSUMMON_TIMED_DESPAWN, 33000+(i/5)*5000);
                    events.PopEvent();
                    break;
                case EVENT_TALK_INTRO_0:
                case EVENT_TALK_INTRO_1:
                case EVENT_TALK_INTRO_2:
                case EVENT_TALK_INTRO_3:
                    Talk(SAY_INTRO_0 + (evId-EVENT_TALK_INTRO_0));
                    events.PopEvent();
                    break;
                case EVENT_SALUTE:
                    me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
                    for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
                        if (Creature* c = ObjectAccessor::GetCreature(*me, *itr))
                            c->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
                    events.PopEvent();
                    break;
                case EVENT_SOLDIERS_RUN_AWAY:
                    {
                        uint8 count = 0;
                        for (SummonList::iterator itr = summons.begin(); itr != summons.end();)
                        {
                            ++count;
                            if (Creature* c = ObjectAccessor::GetCreature(*me, *itr))
                            {
                                c->SetWalk(false);
                                c->GetMotionMaster()->MovePoint(0, 11863.35f, -7073.44f, 27.40f);
                            }
                            SummonList::iterator itr2 = itr++;
                            summons.erase(itr2);
                            if (count >= 5)
                            {
                                if (!summons.empty())
                                {
                                    events.RepeatEvent(5000);
                                    return;
                                }
                                else
                                {
                                    events.PopEvent();
                                    return;
                                }
                            }
                        }
                    }
                    events.PopEvent();
                    break;
                case EVENT_GO_FIGHTPOINT:
                    me->SetWalk(true);
                    me->GetMotionMaster()->MovePoint(0, 11779.30f, -7065.43f, 24.92f);
                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
                    events.PopEvent();
                    break;
                case EVENT_TALK_SPAWN_0:
                case EVENT_TALK_SPAWN_1:
                    Talk(SAY_SPAWN_0 + (evId-EVENT_TALK_SPAWN_0));
                    events.PopEvent();
                    break;
                case EVENT_SUMMON_MORLEN:
                    if (Creature* c = me->SummonCreature(NPC_MORLEN_COLDGRIP, 11766.70f, -7050.57f, 25.17f, 5.56f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
                        morlenGUID = c->GetGUID();
                    events.PopEvent();
                    break;
                case EVENT_TALK_MORLEN_0:
                case EVENT_TALK_MORLEN_1:
                    if (Creature* c = ObjectAccessor::GetCreature(*me, morlenGUID))
                        c->AI()->Talk(SAY_MORLEN_0 + (evId-EVENT_TALK_MORLEN_0));
                    events.PopEvent();
                    break;
                case EVENT_SPAWN_WAVE_1:
                case EVENT_SPAWN_WAVE_2:
                case EVENT_SPAWN_WAVE_3:
                    if (Creature* c = ObjectAccessor::GetCreature(*me, morlenGUID))
                    {
                        c->AI()->Talk(SAY_MORLEN_1 + (evId-EVENT_SPAWN_WAVE_1));
                        switch (evId)
                        {
                            // emerge cast tr false 66947
                            case EVENT_SPAWN_WAVE_1:
                                {
                                    Position spawnPos;
                                    c->GetPosition(&spawnPos);
                                    spawnPos.m_orientation = 5.80f;
                                    spawnPos.m_positionX += 5.0f*cos(4.5f);
                                    spawnPos.m_positionY += 5.0f*sin(4.5f);
                                    for (uint8 i=0; i<5; ++i)
                                        if (Creature* s = me->SummonCreature(NPC_SCOURGE_ZOMBIE, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000))
                                        {
                                            spawnPos.m_positionX += 2.5f*cos(4.5f);
                                            spawnPos.m_positionY += 2.5f*sin(4.5f);
                                        }
                                }
                                break;
                            case EVENT_SPAWN_WAVE_2:
                                {
                                    Position spawnPos;
                                    c->GetPosition(&spawnPos);
                                    spawnPos.m_orientation = 5.80f;
                                    spawnPos.m_positionX += 7.0f*cos(4.0f);
                                    spawnPos.m_positionY += 7.0f*sin(4.0f);
                                    for (uint8 i=0; i<3; ++i)
                                        if (Creature* s = me->SummonCreature(NPC_GHOUL_INVADER, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000))
                                        {
                                            s->CastSpell(s, 66947, false); // emerge effect
                                            spawnPos.m_positionX += 4.0f*cos(4.5f);
                                            spawnPos.m_positionY += 4.0f*sin(4.5f);
                                        }
                                }
                                break;
                            case EVENT_SPAWN_WAVE_3:
                                {
                                    Position spawnPos;
                                    c->GetPosition(&spawnPos);
                                    spawnPos.m_orientation = 5.80f;
                                    spawnPos.m_positionX += 8.0f*cos(4.0f);
                                    spawnPos.m_positionY += 8.0f*sin(4.0f);
                                    for (uint8 i=0; i<3; ++i)
                                        if (Creature* s = me->SummonCreature(NPC_CRYPT_RAIDER, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000))
                                        {
                                            s->CastSpell(s, 66947, false); // emerge effect
                                            spawnPos.m_positionX += 4.0f*cos(4.5f);
                                            spawnPos.m_positionY += 4.0f*sin(4.5f);
                                        }
                                }
                                break;
                        }
                    }
                    events.PopEvent();
                    events.ScheduleEvent(EVENT_SUMMONS_ATTACK, 3000);
                    break;
                case EVENT_SUMMONS_ATTACK:
                    for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
                        if (Creature* c = ObjectAccessor::GetCreature(*me, *itr))
                        {
                            if (c->GetEntry() == NPC_MORLEN_COLDGRIP && summons.size() != 1)
                                continue;
                            else
                                c->AI()->Talk(SAY_MORLEN_4);
                            c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
                            c->AI()->AttackStart(me);
                        }
                    events.PopEvent();
                    break;
                case EVENT_OUTRO_0:
                case EVENT_OUTRO_1:
                case EVENT_OUTRO_2:
                case EVENT_OUTRO_3:
                    Talk(SAY_OUTRO_0 + (evId-EVENT_OUTRO_0));
                    events.PopEvent();
                    if (evId == EVENT_OUTRO_3)
                        events.ScheduleEvent(EVENT_OUTRO_KNEEL, 6000);
                    break;
                case EVENT_OUTRO_KNEEL:
                    if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID))
                        p->KilledMonsterCredit(NPC_THALORIEN_KILL_CREDIT, 0);
                    me->SetStandState(UNIT_STAND_STATE_KNEEL);
                    events.PopEvent();
                    events.ScheduleEvent(EVENT_DISAPPEAR, 6000);
                    break;
                case EVENT_DISAPPEAR:
                    events.PopEvent();
                    me->SetVisible(false);
                    me->setActive(false);
                    EnterEvadeMode();
                    break;
                case EVENT_SET_FACING:
                    me->SetFacingTo(2.45f);
                    events.PopEvent();
                    break;

                case EVENT_SPELL_BLADESTORM:
                    if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()))
                        me->CastSpell(me->GetVictim(), 67541, false);
                    events.RepeatEvent(urand(25000, 35000));
                    break;
                case EVENT_SPELL_MORTAL_STRIKE:
                    if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()))
                        me->CastSpell(me->GetVictim(), 67542, false);
                    events.RepeatEvent(urand(7000, 12000));
                    break;
                case EVENT_SPELL_HEROIC_STRIKE:
                    if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()))
                        me->CastSpell(me->GetVictim(), 57846, false);
                    events.RepeatEvent(urand(5000, 10000));
                    break;
            }

            DoMeleeAttackIfReady();
        }
示例#8
0
        void UpdateAI(const uint32 diff)
        {
            if (LamentEvent)
            {
                if (LamentEventTimer <= diff)
                {
                    DoSummon(ENTRY_HIGHBORNE_BUNNY, me, 10.0f, 3000, TEMPSUMMON_TIMED_DESPAWN);

                    LamentEventTimer = 2000;
                    if (!me->HasAura(SPELL_SYLVANAS_CAST))
                    {
                        DoScriptText(SAY_LAMENT_END, me);
                        DoScriptText(EMOTE_LAMENT_END, me);
                        LamentEvent = false;
                    }
                } else LamentEventTimer -= diff;
            }

            // World Notify Cooldown
            if (notifyCooldown >= diff)
                notifyCooldown -= diff;
            else
                notifyCooldown = 0;

            if (!UpdateVictim())
                return;

            // Defender Quest Credit
            if (!defenderCredit)
                if (me->getThreatManager().getThreatList().size() >= 5 && me->GetHealthPct() < 90.f) // Anti-Farming Conditions
                    defenderCredit = true;

            // Boss rescaling
            if (rescaleTimer <= diff)
            {
                HandleScaling();
                rescaleTimer = 10000;
            } else rescaleTimer -= diff;

            events.Update(diff);

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

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case SPELL_BLACK_ARROW:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true))
                            DoCast(target, SPELL_BLACK_ARROW);
                        events.ScheduleEvent(SPELL_BLACK_ARROW, urand(15000, 25000));
                        break;
                    case SPELL_FADE:
                        DoCast(me, SPELL_FADE);
                        events.ScheduleEvent(SPELL_FADE, urand(25000, 35000));
                        break;
                    case SPELL_MULTI_SHOT:
                        DoCastVictim(SPELL_MULTI_SHOT);
                        events.ScheduleEvent(SPELL_MULTI_SHOT, urand(11000, 14000));
                        break;
                    case SPELL_SHOOT_SYLVANAS:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true))
                            if (me->GetDistance(target) > 5.0f)
                                DoCast(target, SPELL_SHOOT_SYLVANAS);
                        events.ScheduleEvent(SPELL_SHOOT_SYLVANAS, urand(6000, 9000));
                        break;
                    case SPELL_SUMMON_SKELETON:
                        if (Summons.size() < 7)
                            DoCast(me, SPELL_SUMMON_SKELETON);
                        events.ScheduleEvent(SPELL_SUMMON_SKELETON, urand(17000, 23000));
                        break;
                }
            }

            DoMeleeAttackIfReady();
        }