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


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

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


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

示例1: UpdateAI

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

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

        events.Update(diff);

        switch (events.ExecuteEvent())
        {
            case EVENT_BERSERK:
                if (!me->HasAura(SPELL_BERSERK))
                {
                    DoScriptText(YELL_BERSERK, me);
                    DoCast(me, SPELL_BERSERK, true);
                }
                events.ScheduleEvent(EVENT_BERSERK, 10000);
                break;
            case EVENT_CLEAVE:
                DoCastVictim( SPELL_CLEAVE, false);
                events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000), 0, PHASE_GROUND);
                break;
            case EVENT_CORROSION:
                DoCastVictim( SPELL_CORROSION, false);
                events.ScheduleEvent(EVENT_CORROSION, urand(20000, 30000), 0, PHASE_GROUND);
                break;
            case EVENT_GAS_NOVA:
                DoCast(me, SPELL_GAS_NOVA, false);
                events.ScheduleEvent(EVENT_GAS_NOVA, urand(21000, 26000), 0, PHASE_GROUND);
                break;
            case EVENT_ENCAPSULATE:
                if (Unit* encapsTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150.0f, true))
                    DoCast(encapsTarget, SPELL_ENCAPSULATE_CHANNEL, false);

                if (Unit* tank = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 150.0f, true))
                    me->SetTarget(tank->GetGUID());

                events.ScheduleEvent(EVENT_ENCAPSULATE, 33000, 0, PHASE_GROUND);
                break;
            case EVENT_DEMONIC_VAPOR:
                DoCast(me, SPELL_VAPOR_SELECT, true);

                demonicCount++;

                if (demonicCount < 2)
                    events.ScheduleEvent(EVENT_DEMONIC_VAPOR, 11000, 0, PHASE_FLIGHT);
                else
                    events.CancelEvent(EVENT_DEMONIC_VAPOR);

                break;
            case EVENT_FLIGHT:
                EnterPhase(PHASE_FLIGHT);
                break;
            case EVENT_FOG_CORRUPTION:
                if (!fogactivated)
                {
                    events.CancelEvent(EVENT_FOG_CORRUPTION);
                    break;
                }

                if (pInstance)
                {
                    switch (chosenLane)
                    {
                        case 0:
                            pInstance->SetData((direction ? DATA_ACTIVATE_SOUTH_TO_LEFT : DATA_ACTIVATE_SOUTH_TO_RIGHT), (uint32) me->GetPositionY());
                            break;
                        case 1:
                            pInstance->SetData((direction ? DATA_ACTIVATE_CENTER_TO_LEFT : DATA_ACTIVATE_CENTER_TO_RIGHT), (uint32) me->GetPositionY());
                            break;
                        case 2:
                            pInstance->SetData((direction ? DATA_ACTIVATE_NORTH_TO_LEFT : DATA_ACTIVATE_NORTH_TO_RIGHT), (uint32) me->GetPositionY());
                            break;
                    }
                }
                events.ScheduleEvent(EVENT_FOG_CORRUPTION, 50, 0, PHASE_FLIGHT);
                break;
            default:
                if (events.IsInPhase(PHASE_GROUND))
                    DoMeleeAttackIfReady();
                else if (events.IsInPhase(PHASE_FLIGHT))
                {
                    if (uiFlightTimer)
                    {
                        if (uiFlightTimer <= diff)
                        {
                            uiFlightTimer = 0;
                            HandleFlightSequence();
                        }
                        else
                            uiFlightTimer -= diff;
                    }
                }
                break;
//.........这里部分代码省略.........
开发者ID:Adeer,项目名称:OregonCore,代码行数:101,代码来源:boss_felmyst.cpp

示例2: MoveInLineOfSight

 void MoveInLineOfSight(Unit* who)
 {
     if (events.IsInPhase(PHASE_GROUND))
         ScriptedAI::MoveInLineOfSight(who);
 }
开发者ID:Adeer,项目名称:OregonCore,代码行数:5,代码来源:boss_felmyst.cpp

示例3: DamageTaken

 void DamageTaken(Unit* /*pDone_by*/, uint32& damage)
 {
     if (!events.IsInPhase(PHASE_GROUND) && damage >= me->GetHealth())
         damage = 0;
 }
开发者ID:Adeer,项目名称:OregonCore,代码行数:5,代码来源:boss_felmyst.cpp

示例4: AttackStart

 void AttackStart(Unit* who)
 {
     if (events.IsInPhase(PHASE_GROUND))
         ScriptedAI::AttackStart(who);
 }
开发者ID:Adeer,项目名称:OregonCore,代码行数:5,代码来源:boss_felmyst.cpp

示例5: UpdateAI

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

			events.Update(diff);

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

			while(uint32 eventId = events.ExecuteEvent())
			{
				switch(eventId)
				{
					if (instance)
					{
						case EVENT_STATIC_FIELD:
							if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
								if(target->GetTypeId() == TYPEID_PLAYER)
								{
									DoCast(target, SPELL_STATIC_FIELD);
								}
								
							events.ScheduleEvent(EVENT_STATIC_FIELD, 8*IN_MILLISECONDS, 0, PHASE_1);
							break;
							
						case EVENT_LIGHTNING_BREATH:
							DoCast(me, SPELL_LIGHTNING_BREATH);
							
							events.ScheduleEvent(EVENT_LIGHTNING_BREATH, 8*IN_MILLISECONDS, 0, PHASE_2);
							break;
							
						case EVENT_MAGNETIC_SHROUD:
							DoCast(me, SPELL_MAGNETIC_SHROUD);
							
							events.ScheduleEvent(EVENT_MAGNETIC_SHROUD, 12*IN_MILLISECONDS, 0, PHASE_2);
							break;

						case EVENT_MOVE:
							me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
							events.CancelEvent(EVENT_MOVE);
							break;

						default:
							break;
					}
				}
			}
			
			if (Creature* gu = me->GetCreature(*me, instance->GetData64(DATA_BOSS_GU_CLOUDSTRIKE)))
				if(gu->HealthBelowPct(50) && !events.IsInPhase(PHASE_2))
				{
					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
					events.ScheduleEvent(EVENT_MOVE, 3*IN_MILLISECONDS, 0, PHASE_2);
					events.ScheduleEvent(EVENT_LIGHTNING_BREATH, 5*IN_MILLISECONDS, 0, PHASE_2);
					events.ScheduleEvent(EVENT_MAGNETIC_SHROUD, 9*IN_MILLISECONDS, 0, PHASE_2);
					events.SetPhase(PHASE_2);
				}

			DoMeleeAttackIfReady();
		}
开发者ID:AlucardVoss,项目名称:Patchs,代码行数:63,代码来源:boss_gu_cloudstrike.cpp

示例6: UpdateAI

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

			if (me->HasUnitState(UNIT_STATE_CASTING) && !events.IsInPhase(PHASE_WASH_AWAY))
				return;

			events.Update(diff);

			/*Map* map = me->GetMap();
			if (map && map->IsDungeon())
			{
				Map::PlayerList const &PlayerList = map->GetPlayers();

				if (!PlayerList.isEmpty())
					for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
					{
						if (i->getSource()->isAlive() && i->getSource()->IsInWater() && !i->getSource()->HasAura(SPELL_CORRUPTED_WATERS))
							i->getSource()->CastSpell(i->getSource(), SPELL_CORRUPTED_WATERS);

						if (i->getSource()->isAlive() && !i->getSource()->IsInWater() && i->getSource()->HasAura(SPELL_CORRUPTED_WATERS))
							i->getSource()->RemoveAurasDueToSpell(SPELL_CORRUPTED_WATERS);
					}
			}*/

			if (instance)
			{
				if (washAway)
					if (Creature* washAwayTrigger = me->FindNearestCreature(NPC_WASH_AWAY_TRIGGER, 500, true))
					{
						me->CastSpell(washAwayTrigger, SPELL_TRACK_ROTATE);
						me->SetFacingToObject(washAwayTrigger);
					}

				if (hydrolanceWaterCount == 5 && corruptWaterCount == 0) // First corrupt living water
				{
					events.ScheduleEvent(EVENT_CALL_SECOND_WATER, 2*IN_MILLISECONDS, 0, PHASE_CORRUPT_LIVING_WATERS);
					hydrolanceWaterCount = 0;
				}
						
				if (hydrolanceWaterCount == 5 && corruptWaterCount == 1) // Second corrupt living water
				{
					events.ScheduleEvent(EVENT_CALL_THIRD_WATER, 2*IN_MILLISECONDS, 0, PHASE_CORRUPT_LIVING_WATERS);
					hydrolanceWaterCount = 0;
				}

				if (hydrolanceWaterCount == 5 && corruptWaterCount == 2) // Third corrupt living water
				{
					events.ScheduleEvent(EVENT_CALL_FOURTH_WATER, 2*IN_MILLISECONDS, 0, PHASE_CORRUPT_LIVING_WATERS);
					hydrolanceWaterCount = 0;
				}

				if (hydrolanceWaterCount == 5 && corruptWaterCount == 3) // Fourth corrupt living water
				{
					events.SetPhase(PHASE_WASH_AWAY);
					events.ScheduleEvent(EVENT_BUBBLE_BURST, 3*IN_MILLISECONDS, 0, PHASE_WASH_AWAY);
					hydrolanceWaterCount = 0;
				}

				while (uint32 eventId = events.ExecuteEvent())
				{
					switch (eventId)
					{
						if (instance)
						{
							case EVENT_CALL_FIRST_WATER:
								me->InterruptSpell(CURRENT_GENERIC_SPELL);
								if (Creature* firstTrigger = me->FindNearestCreature(NPC_FIRST_TRIGGER_WATER, 500, true))
									me->CastSpell(firstTrigger, SPELL_CALL_WATER);

								Talk(SAY_CALL_FIRST_WATER);

								events.ScheduleEvent(EVENT_FIRST_TRIGGER_WATER_AURA, 0);
								events.CancelEvent(EVENT_CALL_FIRST_WATER);
								break;
									
							case EVENT_FIRST_TRIGGER_WATER_AURA:
								if (Creature* firstTrigger = me->FindNearestCreature(NPC_FIRST_TRIGGER_WATER, 500, true))
									firstTrigger->CastSpell(firstTrigger, SPELL_HYDROLANCE_PRECAST);
									
								events.ScheduleEvent(EVENT_FIRST_TRIGGER_WATER_AURA, 1*IN_MILLISECONDS);
								break;

							case EVENT_CALL_SECOND_WATER:
								me->InterruptSpell(CURRENT_GENERIC_SPELL);
								if (Creature* secondTrigger = me->FindNearestCreature(NPC_SECOND_TRIGGER_WATER, 500, true))
									me->CastSpell(secondTrigger, SPELL_CALL_WATER);

								Talk(SAY_CALL_SECOND_WATER);
								corruptWaterCount = 1;

								events.ScheduleEvent(EVENT_SECOND_TRIGGER_WATER_AURA, 0);
								events.CancelEvent(EVENT_CALL_SECOND_WATER);
								break;

							case EVENT_SECOND_TRIGGER_WATER_AURA:
								if (Creature* secondTrigger = me->FindNearestCreature(NPC_SECOND_TRIGGER_WATER, 500, true))
									secondTrigger->CastSpell(secondTrigger, SPELL_HYDROLANCE_PRECAST);

//.........这里部分代码省略.........
开发者ID:GlassFace,项目名称:Mist-Eria-Core510,代码行数:101,代码来源:boss_wise_mari.cpp

示例7: UpdateAI

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

			if (!emote)
			{
				me->HandleEmoteCommand(EMOTE_STATE_READY_UNARMED);
				emote = true;
			}

			if (Creature* trigger = me->FindNearestCreature(NPC_LOREWALKER_TRIGGER, 0.1f, true))
				if (!events.IsInPhase(PHASE_BOSSES))
				{
					me->Relocate(824.674438f, -2453.281738f, 176.302979f, 5.957958f);
					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
					me->HandleEmoteCommand(EMOTE_ONESHOT_NONE);
					me->SetFacingTo(5.957958f);
					events.CancelEvent(EVENT_SPINNING_CRANE_KICK);
					events.CancelEvent(EVENT_SAY_INTRO_2_3_4_5);
					events.SetPhase(PHASE_BOSSES);
				}

			if (me->FindNearestCreature(NPC_STRIFE, 99999.0f, false) && me->FindNearestCreature(NPC_PERIL, 99999.0f, false) && !end)
			{
				events.ScheduleEvent(EVENT_SAY_END_1, 0, 0, PHASE_BOSSES);
				end = true;
			}

			if (me->FindNearestCreature(NPC_LOREWALKER_TRIGGER, 99999.0f, false) && events.IsInPhase(PHASE_ATTACK_SCROLL))
				events.SetPhase(PHASE_NULL);

			while(uint32 eventId = events.ExecuteEvent())
			{
				switch(eventId)
				{
					if (instance)
					{
						case EVENT_SPINNING_CRANE_KICK:
							me->CastSpell(me, SPELL_SPINNING_CRANE_KICK);

							events.ScheduleEvent(EVENT_SPINNING_CRANE_KICK, 16*IN_MILLISECONDS, 0, PHASE_ATTACK_SCROLL);
							break;

						case EVENT_SAY_INTRO_2_3_4_5:
							Talk(irand(SAY_INTRO_2, SAY_INTRO_5));

							events.ScheduleEvent(EVENT_SAY_INTRO_2_3_4_5, 20*IN_MILLISECONDS, 0, PHASE_ATTACK_SCROLL);
							break;

						case EVENT_SAY_END_1:
							if (Creature* trigger = me->FindNearestCreature(NPC_LOREWALKER_TRIGGER, 99999.0f, true))
								trigger->Kill(trigger);

							if (Creature* wiseMari = me->FindNearestCreature(BOSS_WISE_MARI, 99999.0f, false))
							{
								if (GameObject* lorewalkerDoor = me->FindNearestGameObject(GO_MARI_LOREWALKER_GATE, 99999.0f))
									lorewalkerDoor->UseDoorOrButton();

								if (GameObject* wiseMariDoor = wiseMari->FindNearestGameObject(GO_MARI_LOREWALKER_GATE, 99999.0f))
									wiseMariDoor->UseDoorOrButton();

								if (GameObject* go = me->FindNearestGameObject(GO_LIU_GATE, 99999.0f))
									go->UseDoorOrButton();
							}

							Talk(SAY_END_1);

							me->SetWalk(true);
							me->GetMotionMaster()->MovePoint(0, me->GetHomePosition());
							
							events.ScheduleEvent(EVENT_SAY_END_2, 9*IN_MILLISECONDS, 0, PHASE_BOSSES);
							events.CancelEvent(EVENT_SAY_END_1);
							break;

						case EVENT_SAY_END_2:
							Talk(SAY_END_2);
							me->SetFacingTo(1.261891f);
							me->CastSpell(me, SPELL_MEDITATE);

							events.CancelEvent(EVENT_SAY_END_2); // End of the script
							break;

						default:
							break;
					}
				}
			}
		}
开发者ID:AlucardVoss,项目名称:Patchs,代码行数:89,代码来源:boss_lorewalker_stonestep.cpp


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