Ejemplo n.º 1
0
 void EnterCombat(Unit *who)
 {
     DoAttackerAreaInCombat(who, 100);
     Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
     if(target)
         SendAttacker(target);
 }
Ejemplo n.º 2
0
            void MoveInLineOfSight(Unit* who) override

            {
                if (!MoveEvent)
                {
                    ScriptedAI::MoveInLineOfSight(who);
                }
                else
                {
                    if (me->IsHostileTo(who))
                    {
                        if (!inMove)
                        {
                            switch (MovePhase)
                            {
                                case 0:
                                    if (me->IsWithinDistInMap(who, 50))
                                    {
                                        Talk(YELL_NALORAKK_WAVE1);

                                        (*me).GetMotionMaster()->MovePoint(1, NalorakkWay[1][0], NalorakkWay[1][1], NalorakkWay[1][2]);
                                        MovePhase ++;
                                        inMove = true;

                                        SendAttacker(who);
                                    }
                                    break;
                                case 2:
                                    if (me->IsWithinDistInMap(who, 40))
                                    {
                                        Talk(YELL_NALORAKK_WAVE2);

                                        (*me).GetMotionMaster()->MovePoint(3, NalorakkWay[3][0], NalorakkWay[3][1], NalorakkWay[3][2]);
                                        MovePhase ++;
                                        inMove = true;

                                        SendAttacker(who);
                                    }
                                    break;
                                case 5:
                                    if (me->IsWithinDistInMap(who, 40))
                                    {
                                        Talk(YELL_NALORAKK_WAVE3);

                                        (*me).GetMotionMaster()->MovePoint(6, NalorakkWay[6][0], NalorakkWay[6][1], NalorakkWay[6][2]);
                                        MovePhase ++;
                                        inMove = true;

                                        SendAttacker(who);
                                    }
                                    break;
                                case 7:
                                    if (me->IsWithinDistInMap(who, 50))
                                    {
                                        SendAttacker(who);

                                        Talk(YELL_NALORAKK_WAVE4);

                                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                                        MoveEvent = false;
                                    }
                                    break;
                            }
                        }
                    }
                }
            }
Ejemplo n.º 3
0
    void MoveInLineOfSight(Unit *who)
    {
        if (!MoveEvent)
        {
            ScriptedAI::MoveInLineOfSight(who);
        }
        else
        {
            if (m_creature->IsHostileTo(who))
            {
                if (!inMove)
                {
                    switch(MovePhase)
                    {
                        case 0:
                            if (m_creature->IsWithinDistInMap(who, 50))
                            {
                                m_creature->MonsterYell(YELL_NALORAKK_WAVE1, LANG_UNIVERSAL, NULL);
                                DoPlaySoundToSet(m_creature, SOUND_NALORAKK_WAVE1);

                                (*m_creature).GetMotionMaster()->MovePoint(1,NalorakkWay[1][0],NalorakkWay[1][1],NalorakkWay[1][2]);
                                MovePhase ++;
                                inMove = true;

                                SendAttacker(who);
                            }
                            break;
                        case 2:
                            if (m_creature->IsWithinDistInMap(who, 40))
                            {
                                m_creature->MonsterYell(YELL_NALORAKK_WAVE2, LANG_UNIVERSAL, NULL);
                                DoPlaySoundToSet(m_creature, SOUND_NALORAKK_WAVE2);

                                (*m_creature).GetMotionMaster()->MovePoint(3,NalorakkWay[3][0],NalorakkWay[3][1],NalorakkWay[3][2]);
                                MovePhase ++;
                                inMove = true;

                                SendAttacker(who);
                            }
                            break;
                        case 5:
                            if (m_creature->IsWithinDistInMap(who, 40))
                            {
                                m_creature->MonsterYell(YELL_NALORAKK_WAVE3, LANG_UNIVERSAL, NULL);
                                DoPlaySoundToSet(m_creature, SOUND_NALORAKK_WAVE3);

                                (*m_creature).GetMotionMaster()->MovePoint(6,NalorakkWay[6][0],NalorakkWay[6][1],NalorakkWay[6][2]);
                                MovePhase ++;
                                inMove = true;

                                SendAttacker(who);
                            }
                            break;
                        case 7:
                            if (m_creature->IsWithinDistInMap(who, 50))
                            {
                                SendAttacker(who);

                                m_creature->MonsterYell(YELL_NALORAKK_WAVE4, LANG_UNIVERSAL, NULL);
                                DoPlaySoundToSet(m_creature, SOUND_NALORAKK_WAVE4);

                                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                                MoveEvent = false;
                            }
                            break;
                    }
                }
            }
        }
    }
Ejemplo n.º 4
0
		void UpdateAI(uint32 const diff)
		{
			if (!UpdateVictim())
				return;
			if (me->GetPositionX() > 1140){

				if (GameObject* go = me->FindNearestGameObject(207343, 20.0f)){
					me->RemoveGameObject(go, true);
					go->Delete();
					Creature* c = me->SummonCreature(43438, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),
						me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); //summon corborus
					c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
					SendAttacker(43438, me->SelectNearestTarget(100.0f));

				}
			}
			
			events.Update(diff);
			if (me->HealthBelowPct(50)){
				me->GetMotionMaster()->MovePoint(nextWaypoint(), MillHouseWayPoint[nextWaypoint()][0], MillHouseWayPoint[nextWaypoint()][1], MillHouseWayPoint[nextWaypoint()][2]);
				me->SetHealth(me->GetMaxHealth());
				me->CombatStop(true);
				events.CancelEvent(EVENT_MILL_FEAR);
				events.CancelEvent(EVENT_SHADOW_BOLT);
				events.CancelEvent(EVENT_FROSTBOLT_VOLLEY);
				events.CancelEvent(EVENT_IMPENDING_DOOM);
				events.CancelEvent(EVENT_SHADOWFURY);
				me->SetReactState(REACT_PASSIVE);
				inMovement = true;
				if (actualWayPoint == 3){
					me->DisappearAndDie();
				}
				else{
					events.ScheduleEvent(EVENT_GUARDS, 1000);
				}
				
			}
			if (me->HasUnitState(UNIT_STATE_CASTING))
				return;

			while (uint32 eventId = events.ExecuteEvent())
			{
				switch (eventId)
				{
				case EVENT_GUARDS:
					scheduleEvents();
					me->SetReactState(REACT_AGGRESSIVE);
					return;
				case EVENT_MILL_FEAR:
					DoCastRandom(SPELL_FEAR, 0.0f);
					events.ScheduleEvent(EVENT_MILL_FEAR, 10000);
					return;
				case EVENT_SHADOW_BOLT:
					DoCastVictim(SPELL_SHADOW_BOLT);
					events.ScheduleEvent(EVENT_SHADOW_BOLT, 2000);
					return;
				case EVENT_FROSTBOLT_VOLLEY:
					DoCast(SPELL_FROSTBOLT_VOLLEY);
					events.ScheduleEvent(EVENT_FROSTBOLT_VOLLEY, urand(8000, 15000));
					return;
				case EVENT_IMPENDING_DOOM:
					DoCast(SPELL_IMPENDING_DOOM);
					DoCast(me, SPELL_IMPEMDING_DOOM_E, true);
					events.ScheduleEvent(EVENT_IMPENDING_DOOM, urand(60000, 65000));
					return;
				case EVENT_SHADOWFURY:
					DoCastRandom(SPELL_SHADOWFURY, 0.0f);
					events.ScheduleEvent(EVENT_SHADOWFURY, urand(8000, 20000));
					return;
				}
			}

			DoMeleeAttackIfReady();
		}