当前位置: 首页>>代码示例>>C++>>正文


C++ EventMap::Update方法代码示例

本文整理汇总了C++中EventMap::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ EventMap::Update方法的具体用法?C++ EventMap::Update怎么用?C++ EventMap::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventMap的用法示例。


在下文中一共展示了EventMap::Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            events.Update(diff);
            switch (events.ExecuteEvent())
            {
                case EVENT_START_INTRO:
                    me->GetMotionMaster()->MovePoint(0, MoveThronePos);
                    // Begining of intro is differents between factions as the speech sequence and timers are differents.
                    if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
                        events.ScheduleEvent(EVENT_INTRO_A2_1, 0);
                    else
                        events.ScheduleEvent(EVENT_INTRO_H2_1, 0);
                    break;

            // A2 Intro Events
                case EVENT_INTRO_A2_1:
                    DoScriptText(SAY_JAINA_INTRO_3, me);
                    events.ScheduleEvent(EVENT_INTRO_A2_2, 5000);
                    break;
                case EVENT_INTRO_A2_2:
                    DoScriptText(SAY_JAINA_INTRO_4, me);
                    events.ScheduleEvent(EVENT_INTRO_A2_3, 10000);
                    break;
                case EVENT_INTRO_A2_3:
                    // TODO: she's doing some kind of spell casting emote
                    instance->HandleGameObject(instance->GetData64(DATA_FROSTMOURNE), true);
                    events.ScheduleEvent(EVENT_INTRO_A2_4, 10000);
                    break;
                case EVENT_INTRO_A2_4:
                    // spawn UTHER during speach 2
                    if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
                    {
                        pUther->GetMotionMaster()->MoveIdle();
                        pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas
                        uiUther = pUther->GetGUID();
                    }
                    events.ScheduleEvent(EVENT_INTRO_A2_5, 2000);
                    break;
                case EVENT_INTRO_A2_5:
                    if (Creature* pUther = me->GetCreature(*me, uiUther))
                        DoScriptText(SAY_UTHER_INTRO_A2_1, pUther);
                    events.ScheduleEvent(EVENT_INTRO_A2_6, 3000);
                    break;
                case EVENT_INTRO_A2_6:
                    DoScriptText(SAY_JAINA_INTRO_5, me);
                    events.ScheduleEvent(EVENT_INTRO_A2_7, 6000);
                    break;
                case EVENT_INTRO_A2_7:
                    if (Creature* pUther = me->GetCreature(*me, uiUther))
                        DoScriptText(SAY_UTHER_INTRO_A2_2, pUther);
                    events.ScheduleEvent(EVENT_INTRO_A2_8, 6500);
                    break;
                case EVENT_INTRO_A2_8:
                    DoScriptText(SAY_JAINA_INTRO_6, me);
                    events.ScheduleEvent(EVENT_INTRO_A2_9, 2000);
                    break;
                case EVENT_INTRO_A2_9:
                    if (Creature* pUther = me->GetCreature(*me, uiUther))
                        DoScriptText(SAY_UTHER_INTRO_A2_3, pUther);
                    events.ScheduleEvent(EVENT_INTRO_A2_10, 9000);
                    break;
                case EVENT_INTRO_A2_10:
                    DoScriptText(SAY_JAINA_INTRO_7, me);
                    events.ScheduleEvent(EVENT_INTRO_A2_11, 5000);
                    break;
                case EVENT_INTRO_A2_11:
                    if (Creature* pUther = me->GetCreature(*me, uiUther))
                        DoScriptText(SAY_UTHER_INTRO_A2_4, pUther);
                    events.ScheduleEvent(EVENT_INTRO_A2_12, 11000);
                    break;
                case EVENT_INTRO_A2_12:
                    DoScriptText(SAY_JAINA_INTRO_8, me);
                    events.ScheduleEvent(EVENT_INTRO_A2_13, 4000);
                    break;
                case EVENT_INTRO_A2_13:
                    if (Creature* pUther = me->GetCreature(*me, uiUther))
                        DoScriptText(SAY_UTHER_INTRO_A2_5, pUther);
                    events.ScheduleEvent(EVENT_INTRO_A2_14, 12500);
                    break;
                case EVENT_INTRO_A2_14:
                    DoScriptText(SAY_JAINA_INTRO_9, me);
                    events.ScheduleEvent(EVENT_INTRO_A2_15, 10000);
                    break;
                case EVENT_INTRO_A2_15:
                    if (Creature* pUther = me->GetCreature(*me, uiUther))
                        DoScriptText(SAY_UTHER_INTRO_A2_6, pUther);
                    events.ScheduleEvent(EVENT_INTRO_A2_16, 22000);
                    break;
                case EVENT_INTRO_A2_16:
                    if (Creature* pUther = me->GetCreature(*me, uiUther))
                        DoScriptText(SAY_UTHER_INTRO_A2_7, pUther);
                    events.ScheduleEvent(EVENT_INTRO_A2_17, 4000);
                    break;
                case EVENT_INTRO_A2_17:
                    DoScriptText(SAY_JAINA_INTRO_10, me);
                    events.ScheduleEvent(EVENT_INTRO_A2_18, 2000);
                    break;
                case EVENT_INTRO_A2_18:
                    if (Creature* pUther = me->GetCreature(*me, uiUther))
                    {
//.........这里部分代码省略.........
开发者ID:A-Shox,项目名称:TrinityCore,代码行数:101,代码来源:halls_of_reflection.cpp

示例2: UpdateAI

        void UpdateAI(uint32 diff) override
        {
            events.Update(diff);

            switch (events.ExecuteEvent())
            {
                case EVENT_SPAWN:
                    {
                        if (Creature* Dalfors = DoSummon(NPC_CRUSADER_LORD_DALFORS, DalforsPos[0]))
                        {
                            guidDalfors = Dalfors->GetGUID();
                            Dalfors->GetMotionMaster()->MovePoint(0, DalforsPos[1]);
                        }
                        if (Creature* Priest1 = DoSummon(NPC_ARGENT_BATTLE_PRIEST, Priest1Pos[0]))
                        {
                            guidPriest[0] = Priest1->GetGUID();
                            Priest1->GetMotionMaster()->MovePoint(0, Priest1Pos[1]);
                        }
                        if (Creature* Priest2 = DoSummon(NPC_ARGENT_BATTLE_PRIEST, Priest2Pos[0]))
                        {
                            guidPriest[1] = Priest2->GetGUID();
                            Priest2->GetMotionMaster()->MovePoint(0, Priest2Pos[1]);
                        }
                        if (Creature* Priest3 = DoSummon(NPC_ARGENT_BATTLE_PRIEST, Priest3Pos[0]))
                        {
                            guidPriest[2] = Priest3->GetGUID();
                            Priest3->GetMotionMaster()->MovePoint(0, Priest3Pos[1]);
                        }
                        if (Creature* Mason1 = DoSummon(NPC_ARGENT_MASON, Mason1Pos[0]))
                        {
                            guidMason[0] = Mason1->GetGUID();
                            Mason1->GetMotionMaster()->MovePoint(0, Mason1Pos[1]);
                        }
                        if (Creature* Mason2 = DoSummon(NPC_ARGENT_MASON, Mason2Pos[0]))
                        {
                            guidMason[1] = Mason2->GetGUID();
                            Mason2->GetMotionMaster()->MovePoint(0, Mason2Pos[1]);
                        }
                        if (Creature* Mason3 = DoSummon(NPC_ARGENT_MASON, Mason3Pos[0]))
                        {
                            guidMason[2] = Mason3->GetGUID();
                            Mason3->GetMotionMaster()->MovePoint(0, Mason3Pos[1]);
                        }
                        events.ScheduleEvent(EVENT_INTRO_1, 15000);
                    }
                    break;
                case EVENT_INTRO_1:
                    {
                        if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors))
                            Dalfors->AI()->Talk(DALFORS_SAY_PRE_1);
                        events.ScheduleEvent(EVENT_INTRO_2, 5000);
                    }
                    break;
                case EVENT_INTRO_2:
                    {
                        if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors))
                        {
                            Dalfors->SetFacingTo(6.215f);
                            Dalfors->AI()->Talk(DALFORS_SAY_PRE_2);
                        }
                    events.ScheduleEvent(EVENT_INTRO_3, 5000);
                    }
                    break;
                case EVENT_INTRO_3:
                    {
                        if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors))
                        {
                            Dalfors->GetMotionMaster()->MovePoint(0, DalforsPos[2]);
                            Dalfors->SetHomePosition(DalforsPos[2]);
                        }
                        if (Creature* Priest1 = ObjectAccessor::GetCreature(*me, guidPriest[0]))
                        {
                            Priest1->SetFacingTo(5.7421f);
                            Priest1->SetHomePosition(Priest1Pos[1]);
                        }
                        if (Creature* Priest2 = ObjectAccessor::GetCreature(*me, guidPriest[1]))
                        {
                            Priest2->SetFacingTo(5.7421f);
                            Priest2->SetHomePosition(Priest2Pos[1]);
                        }
                        if (Creature* Priest3 = ObjectAccessor::GetCreature(*me, guidPriest[2]))
                        {
                            Priest3->SetFacingTo(5.7421f);
                            Priest3->SetHomePosition(Priest3Pos[1]);
                        }
                        if (Creature* Mason1 = ObjectAccessor::GetCreature(*me, guidMason[0]))
                        {
                            Mason1->GetMotionMaster()->MovePoint(0, Mason1Pos[2]);
                            Mason1->SetHomePosition(Mason1Pos[2]);
                        }
                        if (Creature* Mason2 = ObjectAccessor::GetCreature(*me, guidMason[1]))
                        {
                            Mason2->GetMotionMaster()->MovePoint(0, Mason2Pos[2]);
                            Mason2->SetHomePosition(Mason2Pos[2]);
                        }
                        if (Creature* Mason3 = ObjectAccessor::GetCreature(*me, guidMason[2]))
                        {
                            Mason3->GetMotionMaster()->MovePoint(0, Mason3Pos[2]);
                            Mason3->SetHomePosition(Mason3Pos[2]);
                        }
//.........这里部分代码省略.........
开发者ID:beyourself,项目名称:DeathCore_6.x,代码行数:101,代码来源:zone_icecrown.cpp

示例3: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
            {
                if (phase == PHASE_FLIGHT && !me->IsInEvadeMode())
                    EnterEvadeMode();
                return;
            }

            events.Update(diff);

            if (me->IsNonMeleeSpellCasted(false))
                return;

            if (phase == PHASE_GROUND)
            {
                switch (events.ExecuteEvent())
                {
                    case EVENT_BERSERK:
                        DoScriptText(YELL_BERSERK, me);
                        DoCast(me, SPELL_BERSERK, true);
                        events.ScheduleEvent(EVENT_BERSERK, 10000);
                        break;
                    case EVENT_CLEAVE:
                        DoCast(me->getVictim(), SPELL_CLEAVE, false);
                        events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000));
                        break;
                    case EVENT_CORROSION:
                        DoCast(me->getVictim(), SPELL_CORROSION, false);
                        events.ScheduleEvent(EVENT_CORROSION, urand(20000, 30000));
                        break;
                    case EVENT_GAS_NOVA:
                        DoCast(me, SPELL_GAS_NOVA, false);
                        events.ScheduleEvent(EVENT_GAS_NOVA, urand(20000, 25000));
                        break;
                    case EVENT_ENCAPSULATE:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true))
                            DoCast(target, SPELL_ENCAPSULATE_CHANNEL, false);
                        events.ScheduleEvent(EVENT_ENCAPSULATE, urand(25000, 30000));
                        break;
                    case EVENT_FLIGHT:
                        EnterPhase(PHASE_FLIGHT);
                        break;
                    default:
                        DoMeleeAttackIfReady();
                        break;
                }
            }

            if (phase == PHASE_FLIGHT)
            {
                switch (events.ExecuteEvent())
                {
                    case EVENT_BERSERK:
                        DoScriptText(YELL_BERSERK, me);
                        DoCast(me, SPELL_BERSERK, true);
                        break;
                    case EVENT_FLIGHT_SEQUENCE:
                        HandleFlightSequence();
                        break;
                    case EVENT_SUMMON_FOG:
                        {
                            float x, y, z;
                            me->GetPosition(x, y, z);
                            me->UpdateGroundPositionZ(x, y, z);
                            if (Creature* Fog = me->SummonCreature(MOB_VAPOR_TRAIL, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 10000))
                            {
                                Fog->RemoveAurasDueToSpell(SPELL_TRAIL_TRIGGER);
                                Fog->CastSpell(Fog, SPELL_FOG_TRIGGER, true);
                                me->CastSpell(Fog, SPELL_FOG_FORCE, true);
                            }
                        }
                        events.ScheduleEvent(EVENT_SUMMON_FOG, 1000);
                        break;
                }
            }
        }
开发者ID:Cailiaock,项目名称:5.4.7-Wow-source,代码行数:77,代码来源:boss_felmyst.cpp

示例4: UpdateAI

            void UpdateAI(uint32 diff)
            {
                if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING))
                    return;

                events.Update(diff);

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_PYROBLAST:
                            DoCastVictim(SPELL_PYROBLAST);
                            events.ScheduleEvent(EVENT_PYROBLAST, urand(3500, 4500));
                            break;

                        case EVENT_FLARECORE:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                                DoCast(target, SPELL_FLARECORE_MISSILE);
                            events.ScheduleEvent(EVENT_FLARECORE, urand(19000, 21000));
                            break;

                        case EVENT_BLINK:
                            Talk(SAY_BLINK);
                            DoCast(me, SPELL_BLINK);
                            if (Creature* blink = me->FindNearestCreature(NPC_BLINK_TARGT, 200.0f, true))
                                me->NearTeleportTo(blink->GetPositionX(), blink->GetPositionY(), blink->GetPositionZ(), blink->GetOrientation());
                            events.CancelEvent(EVENT_PYROBLAST);
                            events.CancelEvent(EVENT_FLARECORE);
                            events.ScheduleEvent(EVENT_FROST_BLADES, 1500);
                            events.ScheduleEvent(EVENT_FROSTBOLT_VOLLEY, 2000);
                            events.ScheduleEvent(EVENT_BLINK, 31500);
                            break;

                        case EVENT_FROSTBOLT_VOLLEY:
                            if(VolleyCount < 3)
                            {
                                DoCast(me, SPELL_FROSTBOLT_VOLLEY);
                                events.ScheduleEvent(EVENT_FROSTBOLT_VOLLEY, 2200);
                                VolleyCount++;
                            }
                            else
                            {
                                Talk(SAY_FROSTBOLT_VOLLEY);
                                DoCast(me, SPELL_FROSTBOLT_VOLLEY);
                                events.CancelEvent(EVENT_FROSTBOLT_VOLLEY);
                                VolleyCount = 0;
                                events.ScheduleEvent(EVENT_PYROBLAST, urand(3000, 3500));
                                events.ScheduleEvent(EVENT_FLARECORE, urand (7500, 8500));
                            }
                            break;

                        case EVENT_FROST_BLADES:
                            Talk(SAY_FROST_BLADES);
                            me->SummonCreature(NPC_FROSTBLADES, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation() - 0.1f, TEMPSUMMON_TIMED_DESPAWN, 10000);
                            me->SummonCreature(NPC_FROSTBLADES, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 10000);
                            me->SummonCreature(NPC_FROSTBLADES, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation() + 0.1f, TEMPSUMMON_TIMED_DESPAWN, 10000);
                            break;
                    }
                }
            }
开发者ID:samaelsacred,项目名称:4.3.4,代码行数:61,代码来源:boss_echo_of_jaina.cpp

示例5: UpdateAI

			void UpdateAI(uint32 diff)
			{
				events2.Update(diff);
				switch (events2.ExecuteEvent())
				{
					case EVENT_SHADE_GATHER_NPCS:
					{
						std::list<Creature*> ChannelerList;
						me->GetCreaturesWithEntryInRange(ChannelerList, 100.0f, NPC_ASHTONGUE_CHANNELER);
						for (std::list<Creature*>::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr)
							summonsChanneler.Summon(*itr);

						std::list<Creature*> SpawnerList;
						me->GetCreaturesWithEntryInRange(SpawnerList, 100.0f, NPC_CREATURE_GENERATOR_AKAMA);
						for (std::list<Creature*>::const_iterator itr = SpawnerList.begin(); itr != SpawnerList.end(); ++itr)
							summonsGenerator.Summon(*itr);

						summonsChanneler.Respawn();
						summonsGenerator.Respawn();
						ChannelersAction(ACTION_CHANNELERS_START_CHANNEL);
						
						if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE)))
							akama->Respawn(true);
						break;
					}
					case EVENT_SHADE_RESET_ENCOUNTER:
						me->SetVisible(true);
						summonsGenerator.Respawn();
						summonsChanneler.Respawn();
						ChannelersAction(ACTION_CHANNELERS_START_CHANNEL);

						if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE)))
							akama->Respawn(true);
						break;
				}

				if (!UpdateVictim())
					return;

				events.Update(diff);
				if (me->HasUnitState(UNIT_STATE_CASTING))
					return;

				switch (events.ExecuteEvent())
				{
					case EVENT_SHADE_CHECK_DISTANCE:
						if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)
						{
							int32 slow = me->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED);
							if (slow > -100)
							{
								me->SetWalk(true);
								me->GetMotionMaster()->MovePoint(POINT_START, 510.0f, 400.7993f, 112.7837f);
							}
						}
						else
						{
							int32 slow = me->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED);
							if (slow < -100)
								me->GetMotionMaster()->Clear();
							else if (slow == 0)
							{
								summonsGenerator.DoAction(ACTION_NO_SORCERERS);
								me->SetWalk(false);
							}
						}

						if (me->IsWithinMeleeRange(me->GetVictim()))
						{
							me->SetReactState(REACT_AGGRESSIVE);
							DoResetThreat();
							me->GetVictim()->InterruptNonMeleeSpells(false);
							me->AddThreat(me->GetVictim(), 1000000.0f);
							me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE);
							summonsGenerator.DoAction(ACTION_STOP_SPAWNING);
							break;
						}
						events.ScheduleEvent(EVENT_SHADE_CHECK_DISTANCE, 1000);
						break;
				}

				DoMeleeAttackIfReady();
				EnterEvadeIfOutOfCombatArea();
			}
开发者ID:AlexHjelm,项目名称:sunwell,代码行数:84,代码来源:boss_shade_of_akama.cpp

示例6: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (phase == PHASE_INTRO)
            {
                if (!instance)
                    return;

                events.Update(diff);
                switch (events.ExecuteEvent())
                {
                case EVENT_INTRO_1:
                    DoScriptText(SAY_JAINA_INTRO_1, me);
                    events.ScheduleEvent(EVENT_INTRO_2, 8000);
                    break;

                case EVENT_INTRO_2:
                    DoScriptText(SAY_JAINA_INTRO_2, me);
                    events.ScheduleEvent(EVENT_INTRO_3, 8500);
                    break;

                case EVENT_INTRO_3:
                    DoScriptText(SAY_JAINA_INTRO_3, me);
                    events.ScheduleEvent(EVENT_INTRO_4, 8000);
                    break;

                case EVENT_INTRO_4:
                    DoScriptText(SAY_JAINA_INTRO_4, me);
                    events.ScheduleEvent(EVENT_INTRO_5, 10000);
                    break;

                case EVENT_INTRO_5:
                    DoScriptText(SAY_JAINA_INTRO_5, me);
                    events.ScheduleEvent(EVENT_INTRO_6, 8000);
                    break;

                case EVENT_INTRO_6:
                    DoScriptText(SAY_JAINA_INTRO_6, me);
                    events.ScheduleEvent(EVENT_INTRO_7, 12000);
                    break;

                case EVENT_INTRO_7:
                    DoScriptText(SAY_JAINA_INTRO_7, me);
                    events.ScheduleEvent(EVENT_INTRO_8, 8000);
                    break;

                case EVENT_INTRO_8:
                    DoScriptText(SAY_JAINA_INTRO_8, me);
                    // End of Intro
                    phase = PHASE_NORMAL;
                    break;
                }
            }

            //Return since we have no target
            if (!UpdateVictim())
                return;

            events.Update(diff);

            DoMeleeAttackIfReady();
        }
开发者ID:Westen0xf,项目名称:SkyFireEMU,代码行数:61,代码来源:forge_of_souls.cpp

示例7: UpdateAI

        void UpdateAI(uint32 diff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (insanityHandled)
            {
                if (!CheckPhaseMinions())
                    return;

                insanityHandled = 0;
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->SetControlled(false, UNIT_STATE_STUNNED);
                me->RemoveAurasDueToSpell(INSANITY_VISUAL);
            }

            events.Update(diff);
            if (me->HasUnitState(UNIT_STATE_CASTING))
                return;

            switch (events.GetEvent())
            {
                case EVENT_HERALD_HEALTH:
                {
                    if (insanityTimes == 0 && me->GetHealthPct() <= 66)
                    {
                        me->CastSpell(me, SPELL_INSANITY, false);
                        insanityTimes++;
                    }
                    else if (insanityTimes == 1 && me->GetHealthPct() <= 33)
                    {
                        me->CastSpell(me, SPELL_INSANITY, false);
                        insanityTimes++;
                    }

                    events.RepeatEvent(1000);
                    break;
                }
                case EVENT_HERALD_MIND_FLAY:
                {
                    me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_MIND_FLAY_H : SPELL_MIND_FLAY, false);
                    events.RepeatEvent(20000);
                    break;
                }
                case EVENT_HERALD_SHADOW:
                {
                    me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SHADOW_BOLT_VOLLEY_H : SPELL_SHADOW_BOLT_VOLLEY, false);
                    events.RepeatEvent(5000);
                    break;
                }
                case EVENT_HERALD_SHIVER:
                {
                    if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        me->CastSpell(pTarget, IsHeroic() ? SPELL_SHIVER_H : SPELL_SHIVER, false);

                    events.RepeatEvent(15000);
                    break;
                }
            }

            DoMeleeAttackIfReady();
        }
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:63,代码来源:boss_herald_volazj.cpp

示例8: UpdateAI

        void UpdateAI(uint32 diff)
        {
            m_events.Update(diff);
            while (uint32 eventId = m_events.ExecuteEvent())
            {
                switch (eventId)
                {
                case 1:
                {
                    // if (GameObject* door = ObjectAccessor::GetGameObject(*me, m_instance->GetData64(DATA_FACTORY_DOOR)))
                    // door->UseDoorOrButton();

                    

                    m_events.ScheduleEvent(1, 10000);
                    break;
                }
                }
            }

            if (!UpdateVictim())
                return;

            if (phase == 1)
            {
                if (SpellTimer <= diff)
                {
                    switch (urand(0, 1))
                    {
                    case 0:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                            DoCast(me, SPELL_FIST_OF_FLAME);
                        Talk(SAY_FISTS_OF_FLAME);
                        break;

                    case 1:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                            DoCast(me, SPELL_FIST_OF_FROST);
                        Talk(SAY_FISTS_OF_FROST);
                        break;
                    }

                    SpellTimer = urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS);
                }
                else SpellTimer -= diff;

                if (HealthBelowPct(50))
                {
                    phase = 2;
                    DoCast(me, SPELL_ARCANE_POWER);
                    Talk(SAY_ARCANE_POWER);
                }

                DoMeleeAttackIfReady();
            }
            else
            {
                if (SpellTimer <= diff)
                {
                    DoCast(me, urand(1, 2) == 1 ? SPELL_FROST_BLOSSOM : SPELL_FIRE_BLOSSOM);
                    SpellTimer = urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS);
                }
                else SpellTimer -= diff;
            }

            if (PhaseChangeTimer <= diff && Phase == PHASE_NORMAL)
            {
                if (PhaseChangeTimer <= diff)
                {
                    me->SetReactState(REACT_AGGRESSIVE);
                    elemental_fists = 20000;
                    blinkTimer = 12000;
                    Phase = PHASE_NORMAL;
                }
                else PhaseChangeTimer -= diff;

                if (elemental_fists <= diff && Phase == PHASE_NORMAL)
                {
                    if (elemental_fists <= diff)
                    {
                        DoCast(me, elemental_fists);
                        me->MonsterYell(SAY_FLAME, LANG_UNIVERSAL, NULL);
                        elemental_fists = 20000;
                    }
                    else elemental_fists -= diff;
                }

                if (blinkTimer <= diff && Phase == PHASE_NORMAL)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 10.0f, true))
                        DoCast(me, SPELL_BLINK);
                    blinkTimer = 12000;
                }
                else blinkTimer -= diff;

                DoMeleeAttackIfReady();
            }
        }
开发者ID:Arkania,项目名称:ArkCORE-NG,代码行数:98,代码来源:boss_glubtok.cpp

示例9: UpdateAI

            void UpdateAI(const uint32 diff)
            {
                if (!UpdateVictim())
                    return;

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

                events.Update(diff);

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BLOODY_PREY:
                            if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
                                me->CastSpell(target, SPELL_BLOODY_PREY, false);
                            events.ScheduleEvent(EVENT_BLOODY_PREY,      10000);
                            break;
                        case EVENT_CLAW_RIP:
                            if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
                                me->CastSpell(target, SPELL_CLAW_RIP, false);
                            events.ScheduleEvent(EVENT_CLAW_RIP,      15000);
                            break;
                        case EVENT_GROWL:
                            if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
                                me->CastSpell(target, SPELL_GROWL, false);
                            events.ScheduleEvent(EVENT_GROWL,      28000);
                            break;
                        case EVENT_ROAR_OF_COURAGE:
                            if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
                                me->CastSpell(target, SPELL_ROAR_OF_COURAGE, false);
                            events.ScheduleEvent(EVENT_ROAR_OF_COURAGE,      70000);
                            break;
                        case EVENT_BLOOD_CRAZED:
                            if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
                                me->CastSpell(target, SPELL_BLOOD_CRAZED, false);
                            events.ScheduleEvent(EVENT_BLOOD_CRAZED,      31000);
                            break;
                        case EVENT_BLOODTHIRST:
                            if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
                                me->CastSpell(target, SPELL_BLOODTHIRST, false);
                            events.ScheduleEvent(EVENT_BLOODTHIRST,      40000);
                            break;
                        case EVENT_CLAW_SLASH:
                            if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
                                me->CastSpell(target, SPELL_CLAW_SLASH, false);
                            events.ScheduleEvent(EVENT_CLAW_SLASH,      25000);
                            break;
                        case EVENT_FRENZY:
                            if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
                                me->CastSpell(target, SPELL_FRENZY, false);
                            events.ScheduleEvent(EVENT_FRENZY,      50000);
                            break;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
开发者ID:CATACLYSMDEV,项目名称:JadeCore-5.4.8-18291--dev-,代码行数:61,代码来源:jade_forest.cpp

示例10: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (me->GetVictim())
            {
                float x,y,z;
                me->GetVictim()->GetPosition(x, y, z);
                if (TSDistCheckPos.GetExactDist(x,y,z) > 100.0f || z > TSDistCheckPos.GetPositionZ()+20.0f || z < TSDistCheckPos.GetPositionZ()-20.0f)
                {
                    me->SetHealth(me->GetMaxHealth());
                    EnterEvadeMode();
                    return;
                }
            }

            events.Update(diff);

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

            switch(events.GetEvent())
            {
                case 0:
                    break;
                case EVENT_SPELL_FORCEFUL_SMASH:
                    if (me->IsWithinMeleeRange(me->GetVictim()))
                    {
                        me->CastSpell(me->GetVictim(), SPELL_FORCEFUL_SMASH, false);
                        events.PopEvent();
                        events.RescheduleEvent(EVENT_SPELL_UNHOLY_POWER, 1000);
                        break;
                    }
                    events.RepeatEvent(3000);
                    break;
                case EVENT_SPELL_UNHOLY_POWER:
                    Talk(SAY_SMASH);
                    Talk(EMOTE_SMASH);
                    me->CastSpell(me, SPELL_UNHOLY_POWER, false);
                    events.PopEvent();
                    events.ScheduleEvent(EVENT_SPELL_FORCEFUL_SMASH, urand(40000, 48000));
                    break;
                case EVENT_SPELL_OVERLORDS_BRAND:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 95.0f, true))
                        me->CastSpell(target, SPELL_OVERLORDS_BRAND, false);
                    events.RepeatEvent(urand(11000,12000));
                    break;
                case EVENT_RIMEFANG_SPELL_ICY_BLAST:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 190.0f, true))
                        if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID)))
                            c->CastSpell(target, RIMEFANG_SPELL_ICY_BLAST, false);
                    events.RepeatEvent(5000);
                    break;
                case EVENT_SPELL_MARK_OF_RIMEFANG:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 190.0f, true))
                        if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID)))
                        {
                            Talk(SAY_MARK);
                            c->AI()->Talk(EMOTE_RIMEFANG_ICEBOLT, target);
                            c->CastSpell(target, RIMEFANG_SPELL_HOARFROST, false);
                        }
                    events.RepeatEvent(25000);
                    events.RescheduleEvent(EVENT_RIMEFANG_SPELL_ICY_BLAST, 10000);
                    break;
            }

            DoMeleeAttackIfReady();
        }
开发者ID:AzerothShard-Dev,项目名称:azerothcore,代码行数:69,代码来源:boss_scourgelord_tyrannus.cpp

示例11: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (me->GetDistance(me->GetHomePosition()) > 60.0f)
            {
                EnterEvadeMode();
                return;
            }

            events.Update(diff);

            /*if (me->GetHealthPct() <= 66 && stage == 0)
            {
                events.Reset();
                stage = 1;
                DoCast(SPELL_CHAINS_OF_WOE);
                events.ScheduleEvent(EVENT_SKULLCRACKER, 2100);
            }

            if (me->GetHealthPct() <= 33 && stage == 1)
            {
                events.Reset();
                stage = 2;
                DoCast(SPELL_CHAINS_OF_WOE);
                events.ScheduleEvent(EVENT_SKULLCRACKER, 2100);
            }*/

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

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_WOUNDING_STRIKE:
                    DoCast(me->getVictim(), DUNGEON_MODE(SPELL_WOUNDING_STRIKE, SPELL_WOUNDING_STRIKE_H));
                    events.ScheduleEvent(EVENT_WOUNDING_STRIKE, urand(6000, 7000));
                    break;
                case EVENT_QUAKE:
                    DoCast(me, SPELL_QUAKE);
                    if (IsHeroic())
                    {
                        Map::PlayerList const& players = me->GetMap()->GetPlayers();
                        if (me->GetMap()->IsDungeon() && !players.isEmpty())
                        {
                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                            {
                                Player* pPlayer = itr->getSource();
                                me->SummonCreature(NPC_ANGERED_EARTH, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(),0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
                            }
                        }
                    }
                    events.ScheduleEvent(EVENT_QUAKE, urand(18000, 20000));
                    break;
                }
            }

            DoMeleeAttackIfReady();
        }
开发者ID:Grimtonz1337,项目名称:JadeCore,代码行数:61,代码来源:boss_romogg_bonecrusher.cpp

示例12: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (phase == PHASE_OUTRO)
            {
                if (!pInstance)
                    return;

                events.Update(diff);
                switch(events.ExecuteEvent())
                {
                    case EVENT_OUTRO_1:
                    {
                        DoScriptText(SAY_KRICK_OUTRO_1, me);
                        events.ScheduleEvent(EVENT_OUTRO_2, 14000);
                        break;
                    }
                    case EVENT_OUTRO_2:
                    {
                        Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog);
                        if (pNpcDialog)
                        {
                            if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE)
                                DoScriptText(SAY_JAYNA_OUTRO_2, pNpcDialog);
                            else
                                DoScriptText(SAY_SYLVANAS_OUTRO_2, pNpcDialog);
                        }
                        events.ScheduleEvent(EVENT_OUTRO_3, 8500);
                        break;
                    }
                    case EVENT_OUTRO_3:
                        DoScriptText(SAY_KRICK_OUTRO_3, me);
                        events.ScheduleEvent(EVENT_OUTRO_4, 12000);
                        break;
                    case EVENT_OUTRO_4:
                    {
                        Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog);
                        if (pNpcDialog)
                        {
                            if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE)
                                DoScriptText(SAY_JAYNA_OUTRO_4, pNpcDialog);
                            else
                                DoScriptText(SAY_SYLVANAS_OUTRO_4, pNpcDialog);
                        }
                        events.ScheduleEvent(EVENT_OUTRO_5, 8000);
                        break;
                    }
                    case EVENT_OUTRO_5:
                        DoScriptText(SAY_KRICK_OUTRO_5, me);
                        events.ScheduleEvent(EVENT_OUTRO_6, 4000);
                        break;
                    case EVENT_OUTRO_6:
                        // TODO spawn Tyrannus at some distance and MovePoint near-by (flying on rimefang)
                        // store uiTyrannus
                        // Adjust timer so tyrannus has time to come
                        uiTyrannus = (pInstance ? pInstance->GetData64(DATA_TYRANNUS) : 0);
                        events.ScheduleEvent(EVENT_OUTRO_7, 1);
                        break;
                    case EVENT_OUTRO_7:
                        if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus))
                            DoScriptText(SAY_TYRANNUS_OUTRO_7, pTyrannus);
                        events.ScheduleEvent(EVENT_OUTRO_8, 7000);
                        break;
                    case EVENT_OUTRO_8:
                        DoScriptText(SAY_KRICK_OUTRO_8, me);
                        // TODO: Tyrannus starts killing Krick.
                        // there shall be some visual spell effect
                        events.ScheduleEvent(EVENT_OUTRO_9, 6000);
                        break;
                    case EVENT_OUTRO_9:
                        // tyrannus kills krick
                        me->SetStandState(UNIT_STAND_STATE_DEAD);
                        me->SetHealth(0);

                        if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus))
                            DoScriptText(SAY_TYRANNUS_OUTRO_9, pTyrannus);

                        events.ScheduleEvent(EVENT_OUTRO_10, 12000);
                        break;
                    case EVENT_OUTRO_10:
                    {
                        Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog);
                        if (pNpcDialog)
                        {
                            if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE)
                                DoScriptText(SAY_JAYNA_OUTRO_10, pNpcDialog);
                            else
                                DoScriptText(SAY_SYLVANAS_OUTRO_10, pNpcDialog);
                        }

                        // End of OUTRO. for now...
                        events.ScheduleEvent(EVENT_OUTRO_END, 8000);
                        break;
                    }
                    case EVENT_OUTRO_END:
                    {
                        Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog);
                        if (pNpcDialog)
                            pNpcDialog->DisappearAndDie();

                        me->DisappearAndDie();
//.........这里部分代码省略.........
开发者ID:techno42,项目名称:SkyFireEMU,代码行数:101,代码来源:boss_krickandick.cpp

示例13: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            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
                        sLog->outError("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
                        sLog->outError("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());
                        //sLog->outDebug(LOG_FILTER_TSCR, "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_OOC_NOT_ATTACKABLE);
                        phase = PHASE_ATTACKING;

                        if (Player* target = Unit::GetPlayer(*me, playerGUID))
                            me->AI()->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:
                        DoCast(me->getVictim(), SPELL_ICY_TOUCH);
                        events.DelayEvents(1000, GCD_CAST);
                        events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST);
                        break;
                    case EVENT_PLAGUE_STRIKE:
                        DoCast(me->getVictim(), SPELL_PLAGUE_STRIKE);
                        events.DelayEvents(1000, GCD_CAST);
                        events.ScheduleEvent(SPELL_PLAGUE_STRIKE, 5000, GCD_CAST);
                        break;
                    case EVENT_BLOOD_STRIKE:
                        DoCast(me->getVictim(), SPELL_BLOOD_STRIKE);
                        events.DelayEvents(1000, GCD_CAST);
                        events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST);
                        break;
                    case EVENT_DEATH_COIL:
                        DoCast(me->getVictim(), SPELL_DEATH_COIL);
                        events.DelayEvents(1000, GCD_CAST);
                        events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST);
                        break;
                    }
                }
//.........这里部分代码省略.........
开发者ID:Deviuss,项目名称:TrinityCore,代码行数:101,代码来源:chapter1.cpp

示例14: UpdateAI

            void UpdateAI(const uint32 diff)
            { 
                // Falled to water in out of platform = die
                CheckPlayersInWater();

                if (!UpdateVictim())
                    return;

                events.Update(diff);

                switch (events.ExecuteEvent())
                {
                    case EVENT_HARD_STARE:
                        if (me->getVictim())
                        {
                            DoPlaySoundToSet(me, 35334); // wound
                            DoCast(me->getVictim(),SPELL_HARD_STARE);
                        }
                        events.ScheduleEvent(EVENT_HARD_STARE, 13000);
                        break;
                    case EVENT_GAZE:
                        {
                            Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 2.0f, true);
                            if (!target)
                                if (!me->HasUnitState(UNIT_STATE_CASTING))
                                    DoCast(SPELL_GAZE);
                            events.ScheduleEvent(EVENT_GAZE, 2000);
                            break;
                        }
                    case EVENT_BERSERK:
                        events.CancelEventGroup(0); // clear all events
                        me->AI()->Talk(SAY_BERSERK);
                        DoCast(SPELL_BERSERK_KILLALL);
                        break;
                    // Spectrum phase start
                    case EVENT_LIGHT_SPECTRUM_SAY_SUMMON:
                        FogKilled = 0;
                        me->AI()->Talk(SAY_SUMMON_SPECTRUM);
                        SummonSomeCreatures(RED_FOG, 3, 10.0f); // 3 red fog
                        SummonSomeCreatures(BLUE_FOG, 1, 10.0f); // 1 blue fog
                        events.ScheduleEvent(EVENT_LIGHT_SPECTRUM, 3000);
                        break;
                    case EVENT_LIGHT_SPECTRUM:
                        me->AI()->Talk(SAY_SPECTRUM_INF);
                        SummonBeamsEye();
                        break;
                    // Spectrum phase end

                    // Disintegration Beam phase start
                    case EVENT_MAZE_TIME:
                        Maze(true);
                        events.ScheduleEvent(EVENT_MAZE_ORIENTATION, 5000);
                        events.ScheduleEvent(EVENT_MAZE_END, 47000);
                        events.ScheduleEvent(EVENT_MIND_DAGGERS, 6000);
                        SendMazeToEyes(true);
                        break;
                    case EVENT_MAZE_ORIENTATION:
                        UpdateOrientation();
                        TryKillPlayerInFront();
                        events.ScheduleEvent(EVENT_MAZE_ORIENTATION, 200);
                        break;
                    case EVENT_MAZE_END:
                        Maze(false);
                        SendMazeToEyes(false);
                        events.ScheduleEvent(EVENT_LIGHT_SPECTRUM_SAY_SUMMON, 40000);
                        break;
                    case EVENT_MIND_DAGGERS:
                        DoCast(SPELL_MIND_DAGGERS);
                        events.ScheduleEvent(EVENT_MIND_DAGGERS, 6000);
                        break;
                    // Disintegration Beam phase end
                    default:
                        break;
                }

                if (!me->HasUnitState(UNIT_STATE_CASTING))
                    DoMeleeAttackIfReady();
            }
开发者ID:Exodius,项目名称:JadeCore548,代码行数:78,代码来源:boss_durumu.cpp

示例15: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if (me->GetVictim())
                if(!me->HasAura(RAID_MODE(SPELL_FACE_RAGE_10N, SPELL_FACE_RAGE_25N,SPELL_FACE_RAGE_10H, SPELL_FACE_RAGE_25H)) && me->GetVictim()->HasAura(SPELL_FACE_RAGE) && !me->HasAura(CRYSTAL_PRISON_EFFECT))
                {
                    if (Unit* RageTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 500.0f, true, SPELL_RAGE))
                    {
                        me->getThreatManager().resetAllAggro();
                        me->AddThreat(RageTarget, 500.0f);

                        if (me->GetDistance(RageTarget) >= 13.0f)
                            me->JumpTo(RageTarget,15);

                        me->GetMotionMaster()->MoveChase(RageTarget);
                        me->AI()->AttackStart(RageTarget);
                    }
                    me->GetVictim()->RemoveAurasDueToSpell(SPELL_FACE_RAGE);
                }

            if(GetShannox() && !me->IsInCombat())
            {
                if (me->GetDistance(GetShannox()) > 20.0f)
                    me->SetPosition(GetShannox()->GetPositionX()+5,GetShannox()->GetPositionY()-5,GetShannox()->GetPositionZ(),0);
                else
                    me->GetMotionMaster()->MoveFollow(GetShannox(), walkRagefaceDistance, walkRagefaceAngle);
            }

            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_CHANGE_TARGET:
                    if (!me->GetVictim()->HasAura(SPELL_RAGE) && !me->HasAura(RAID_MODE(SPELL_FACE_RAGE_10N, SPELL_FACE_RAGE_25N,SPELL_FACE_RAGE_10H, SPELL_FACE_RAGE_25H)))
                        SelectNewTarget();

                    events.ScheduleEvent(EVENT_CHANGE_TARGET, urand(9000,15000));
                    break;

                case EVENT_FACE_RAGE:
                    if (Unit *FaceRageTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 500, true))
                    {
                        me->getThreatManager().resetAllAggro();
                        me->AddThreat(FaceRageTarget, 500.0f);

                        if (me->GetDistance(FaceRageTarget) >= 13.0f)
                            me->JumpTo(FaceRageTarget,15);

                        me->GetMotionMaster()->MoveChase(FaceRageTarget);
                        me->AI()->AttackStart(FaceRageTarget);
                        DoCast(FaceRageTarget,SPELL_FACE_RAGE);
                    }
                    events.ScheduleEvent(EVENT_FACE_RAGE, 61000);
                    break;

                case EVENT_PRISON_DOG_ATTACK_RAGEFACE:
                    if (Creature* prison = me->FindNearestCreature(NPC_CRYSTAL_PRISON, 50.0f, true))
                    {
                        int32 dmg = prison->GetMaxHealth() * 0.20;
                        me->DealDamage(prison,dmg);
                        if (prison->IsAlive())
                            events.ScheduleEvent(EVENT_PRISON_DOG_ATTACK_RAGEFACE, 1000);
                    }
                    break;

                default:
                    break;
                }
            }

            if (me->HasAura(CRYSTAL_PRISON_EFFECT) && !prisonStartAttack)
                if (me->FindNearestCreature(NPC_CRYSTAL_PRISON, 50.0f, true))
                {
                    events.ScheduleEvent(EVENT_PRISON_DOG_ATTACK_RAGEFACE, 1000);
                    prisonStartAttack = true;
                }

            if(GetShannox())
            {
                if(GetShannox()->GetHealthPct() <= 30 && frenzy == false && !me->GetMap()->IsHeroic())
                {
                    frenzy = true;
                    DoCast(me, SPELL_FRENZIED_DEVOLUTION);
                }

                if(GetShannox()->GetDistance2d(me) >= maxDistanceBetweenShannoxAndDogs && !me->HasAura(SPELL_SEPERATION_ANXIETY)) //TODO Sniff right Distance
                {
                    DoCast(me, SPELL_SEPERATION_ANXIETY);
                }

            }

            if (!UpdateVictim())
                return;

            if(Unit* victim = me->GetVictim()) // DoMeleeAttackIfReady implementation of Feeding Frenzy.
            if (me->isAttackReady() && me->IsWithinMeleeRange(victim))
            {
                me->AttackerStateUpdate(victim);
//.........这里部分代码省略.........
开发者ID:redlaine,项目名称:InfinityCore-Ark,代码行数:101,代码来源:boss_shannox.cpp


注:本文中的EventMap::Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。