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


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

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


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

示例1: UpdateAI

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

            events.Update(diff);

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

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_FELL_FIREBALL:
                        if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            DoCast(target, SPELL_FELL_FIREBALL);
                        events.RescheduleEvent(EVENT_FELL_FIREBALL, 1000);
                        return;
                }
            }

            DoMeleeAttackIfReady();
        }
开发者ID:Facelive,项目名称:ArkCORE2,代码行数:24,代码来源:the_stonecore.cpp

示例2: UpdateAI

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

			events.Update(diff);

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

			switch( events.GetEvent() )
			{
				case 0:
					break;
				case EVENT_YELL_DEAD_1:
					Talk(YELL_DEAD_1);
					events.PopEvent();
					break;
				case EVENT_START_RESURRECTION:
					me->CastSpell(me, SPELL_SUMMON_VALKYR, true);
					events.PopEvent();
					events.RescheduleEvent(EVENT_VALKYR_BEAM, 7000);
					events.RescheduleEvent(EVENT_VALKYR_MOVE, 1);
					events.RescheduleEvent(EVENT_ANNHYLDE_YELL, 3000);
					break;
				case EVENT_VALKYR_MOVE:
					if( Creature* s = ObjectAccessor::GetCreature(*me, ValkyrGUID) )
						s->GetMotionMaster()->MovePoint(1, s->GetPositionX(), s->GetPositionY(), s->GetPositionZ()-15.0f);
					events.PopEvent();
					break;
				case EVENT_ANNHYLDE_YELL:
					if( Creature* s = ObjectAccessor::GetCreature(*me, ValkyrGUID) )
						s->AI()->Talk(YELL_ANHYLDE_2);
					events.PopEvent();
					break;
				case EVENT_VALKYR_BEAM:
					me->RemoveAura(SPELL_SUMMON_VALKYR);
					if( Creature* c = ObjectAccessor::GetCreature(*me, ValkyrGUID) )
						c->CastSpell(me, SPELL_RESURRECTION_BEAM, false);
					events.PopEvent();
					events.RescheduleEvent(EVENT_RESURRECTION_BALL, 4000);
					break;
				case EVENT_RESURRECTION_BALL:
					me->CastSpell(me, SPELL_RESURRECTION_BALL, true);
					events.PopEvent();
					events.RescheduleEvent(EVENT_RESURRECTION_HEAL, 4000);
					break;
				case EVENT_RESURRECTION_HEAL:
					me->RemoveAura(SPELL_RESURRECTION_BALL);
					me->CastSpell(me, SPELL_RESURRECTION_HEAL, true);
					FeignDeath(false);
					events.PopEvent();
					events.RescheduleEvent(EVENT_MORPH_TO_UNDEAD, 3000);
					break;
				case EVENT_MORPH_TO_UNDEAD:
					me->CastSpell(me, SPELL_INGVAR_TRANSFORM, true);
					events.PopEvent();
					events.RescheduleEvent(EVENT_START_PHASE_2, 1000);
					break;
				case EVENT_START_PHASE_2:
					if( Creature* c = ObjectAccessor::GetCreature(*me, ValkyrGUID) )
					{
						c->DespawnOrUnsummon();
						summons.DespawnAll();
					}
					events.PopEvent();
					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
					AttackStart(me->GetVictim());
					me->GetMotionMaster()->MoveChase(me->GetVictim());
					Talk(YELL_AGGRO_2);

					// schedule Phase 2 abilities
					events.RescheduleEvent(EVENT_SPELL_ROAR, 15000);
					events.RescheduleEvent(EVENT_SPELL_CLEAVE_OR_WOE_STRIKE, 2000);
					events.RescheduleEvent(EVENT_SPELL_SMASH, 5000);
					events.RescheduleEvent(EVENT_SPELL_ENRAGE_OR_SHADOW_AXE, 10000);

					break;

				// ABILITIES HERE:
				case EVENT_UNROOT:
					me->SetControlled(false, UNIT_STATE_ROOT);
					me->DisableRotate(false);
					events.PopEvent();
					break;
				case EVENT_SPELL_ROAR:
					Talk(EMOTE_ROAR);

					me->_AddCreatureSpellCooldown(SPELL_STAGGERING_ROAR, 0);
					me->_AddCreatureSpellCooldown(SPELL_DREADFUL_ROAR, 0);

					if (me->GetDisplayId() == DISPLAYID_DEFAULT)
						me->CastSpell((Unit*)NULL, SPELL_STAGGERING_ROAR, false);
					else
						me->CastSpell((Unit*)NULL, SPELL_DREADFUL_ROAR, false);
					events.RepeatEvent(urand(15000,20000));
					break;
				case EVENT_SPELL_CLEAVE_OR_WOE_STRIKE:
					if( me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0 )
					{
//.........这里部分代码省略.........
开发者ID:GlassFace,项目名称:sunwell,代码行数:101,代码来源:boss_ingvar_the_plunderer.cpp

示例3: SpellHit

        void SpellHit(Unit * Hitter, SpellInfo const* spell) override
        {
            m_events.RescheduleEvent(EVENT_COMBAT_TIMER, 1000);
            m_combatTime[Hitter->GetGUID()] = time(NULL);

            if (Player* player = Hitter->ToPlayer())
            {
                switch (player->getClass())
                {
                case CLASS_WARRIOR:
                {
                    if (spell->Id == 100) player->KilledMonsterCredit(44175);
                    break;
                }
                case CLASS_PALADIN:
                {
                    if (player->HasAura(105361) && spell->Id == 20271) // wowhead: this is the correct spell/aura	: Seal of Command	
                    {
                        player->KilledMonsterCredit(44420);
                        player->KilledMonsterCredit(44175);
                    }
                    if (player->HasAura(20154) && spell->Id == 20271)	// wowhead: this is a wrong lv 42 spell/aura, but used now in core.. : Seal of Righteousness				
                    {
                        player->KilledMonsterCredit(44420);
                        player->KilledMonsterCredit(44175);
                    }
                    break;
                }
                case CLASS_HUNTER:
                {
                    if (spell->Id == 56641) player->KilledMonsterCredit(44175);
                    break;
                }
                case CLASS_ROGUE:
                {
                    if (spell->Id == 2098) player->KilledMonsterCredit(44175);
                    break;
                }
                case CLASS_PRIEST:
                {
                    if (spell->Id == 589) player->KilledMonsterCredit(44175);
                    break;
                }
                case CLASS_DEATH_KNIGHT:
                {
                    break;
                }
                case CLASS_SHAMAN:
                {
                    if (spell->Id == 73899) player->KilledMonsterCredit(44175);
                    break;
                }
                case CLASS_MAGE:
                {
                    if (!m_spell_is_on_work)
                    {
                        if (Hitter->getRace() == RACE_TROLL)
                        {
                            if (spell->Id == 122) player->KilledMonsterCredit(44175);
                            if (spell->Id == 133) player->KilledMonsterCredit(44175);
                            if (spell->Id == 2136) player->KilledMonsterCredit(44175);
                        }
                        if (spell->Id == 7268 && !m_spell_is_on_work)
                        {
                            m_spell_is_on_work = true;
                            m_events.ScheduleEvent(EVENT_COOLDOWN, 7000);
                            player->KilledMonsterCredit(44175);
                        }
                    }
                    break;
                }
                case CLASS_WARLOCK:
                {
                    if (spell->Id == 172) player->KilledMonsterCredit(44175);
                    if (spell->Id == 348) player->KilledMonsterCredit(44175);
                    if (spell->Id == 2098) player->KilledMonsterCredit(44175);
                    break;
                }
                case CLASS_DRUID:
                {
                    if (spell->Id == 8921) player->KilledMonsterCredit(44175);
                    break;
                }
                }
            }
        }
开发者ID:Exodius,项目名称:ArkCORE-NG,代码行数:86,代码来源:npc_trainings_dummy.cpp

示例4: UpdateAI

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

			events.Update(diff);

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

			if( !bPhase3 && HealthBelowPct(30) && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && !me->HasAura(SPELL_SUBMERGE) && !me->HasAura(SPELL_EMERGE) )
			{
				bPhase3 = true;
				events.CancelEvent(EVENT_SUBMERGE);
				events.CancelEvent(EVENT_EMERGE);
				events.CancelEvent(EVENT_EMERGE_2);
				if( !IsHeroic() )
					events.CancelEvent(EVENT_SUMMON_NERUBIAN);
				me->CastSpell((Unit*)NULL, SPELL_LEECHING_SWARM, false);
				Talk(EMOTE_LEECHING_SWARM);
				Talk(SAY_LEECHING_SWARM);
				return;
			}

			switch( events.GetEvent() )
			{
				case 0:
					break;
				case EVENT_ENRAGE:
					{
						me->CastSpell(me, SPELL_BERSERK, true);
						events.PopEvent();
					}
					break;
				case EVENT_RESPAWN_SPHERE:
					{
						uint8 StartAt = urand(0,5);
						uint8 i = StartAt;
						do
						{
							if( Creature* c = ObjectAccessor::GetCreature(*me, SphereGUID[i]) )
								if( !c->HasAura(SPELL_FROST_SPHERE) )
								{
									if( Creature* c = me->SummonCreature(NPC_FROST_SPHERE, AnubLocs[i+5]) )
										SphereGUID[i] = c->GetGUID();
									break;
								}
							i = (i+1)%6;
						}
						while( i != StartAt );
						events.RepeatEvent(4000);
					}
					break;
				case EVENT_SPELL_FREEZING_SLASH:
					{
						if( me->GetVictim() )
							me->CastSpell(me->GetVictim(), SPELL_FREEZING_SLASH, false);
						events.RepeatEvent(urand(15000,20000));
					}
					break;
				case EVENT_SPELL_PENETRATING_COLD:
					{
						me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2,5,2,5));
						events.RepeatEvent(18000);
					}
					break;
				case EVENT_SUMMON_NERUBIAN:
					{
						me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1,2,2,4));
						events.RepeatEvent(45000);
					}
					break;
				case EVENT_SUBMERGE:
					{
						me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
						bool berserk = me->HasAura(SPELL_BERSERK);
						me->RemoveAllAuras();
						if (berserk)
							me->CastSpell(me, SPELL_BERSERK, true);
						Talk(EMOTE_SUBMERGE);
						Talk(EMOTE_BURROWER);
						me->CastSpell(me, SPELL_SUBMERGE, false);
						events.CancelEvent(EVENT_SUMMON_NERUBIAN);
						events.CancelEvent(EVENT_SPELL_FREEZING_SLASH);
						events.CancelEvent(EVENT_SPELL_PENETRATING_COLD);
						events.RescheduleEvent(EVENT_EMERGE, EMERGE_INTERVAL);
						events.RescheduleEvent(EVENT_SPELL_SUMMON_SPIKE, 2500);
						events.RescheduleEvent(EVENT_SUMMON_SCARAB, 3000);
						events.PopEvent();
					}
					break;
				case EVENT_SUMMON_SCARAB:
					{
						uint8 i = urand(0,3);
						if( Creature* c = ObjectAccessor::GetCreature(*me, BurrowGUID[i]) )
							me->CastSpell(c, SPELL_SUMMON_SCARAB, true);
						events.RepeatEvent(4000);
					}
					break;
				case EVENT_EMERGE:
//.........这里部分代码省略.........
开发者ID:DSlayerMan,项目名称:Sunwell,代码行数:101,代码来源:boss_anubarak_trial.cpp

示例5: Reset

 void Reset() override
 {
     _drizzleGuid = 0;
     _player_GUID = 0;
     _events.RescheduleEvent(EVENT_START_ANIM, 500);
 }
开发者ID:Arkania,项目名称:ArkCORE-NG,代码行数:6,代码来源:zone_felwood.cpp

示例6: UpdateAI

        void UpdateAI(uint32 diff)
        {
			events.Update(diff);
			uint32 eventId = events.GetEvent();

			if (eventId == EVENT_SPELL_INHIBIT_MAGIC)
            {
                Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
                for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                    if (Player* player = i->GetSource())
					{
						float dist = me->GetDistance(player);
                        if (player->IsAlive() && dist < 45.0f)
                        {
                            Aura* aura = player->GetAura(SPELL_INHIBIT_MAGIC);
							if (!aura)
								aura = me->AddAura(SPELL_INHIBIT_MAGIC, player);
							else
								aura->RefreshDuration();

							if (aura)
								aura->SetStackAmount(getStackCount(dist));
                        }
						else
							player->RemoveAurasDueToSpell(SPELL_INHIBIT_MAGIC);
					}
				events.RepeatEvent(3000);
				return;
			}

            if (!UpdateVictim())
                return;


			switch (eventId)
			{
				case EVENT_SPELL_ATTRACT_MAGIC:
					me->CastSpell(me, SPELL_ATTRACT_MAGIC, false);
					events.RepeatEvent(30000);
					events.RescheduleEvent(EVENT_SPELL_CARNIVOROUS, 1500);
					break;
				case EVENT_SPELL_CARNIVOROUS:
					me->CastSpell(me, DUNGEON_MODE(SPELL_CARNIVOROUS_BITE_N, SPELL_CARNIVOROUS_BITE_H), false);
					events.RepeatEvent(10000);
					break;
				case EVENT_SPELL_FOCUS_FIRE:
					if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true))
					{
						if (Creature* cr = me->SummonCreature(ENTRY_FOCUS_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 7000))
							focusGUID = cr->GetGUID();
						Talk(EMOTE_FOCUSED, target);
					}
					events.RepeatEvent(urand(15000, 20000));
					events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 3000);
					events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 3500);
					events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 4000);
					events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_3, 5000);
					me->SetControlled(true, UNIT_STATE_ROOT);
					break;
				case EVENT_SPELL_FOCUS_FIRE_2:
					if (Unit* flare = ObjectAccessor::GetCreature(*me, focusGUID))
						me->CastSpell(flare, SPELL_FOCUS_CAST, true);
					events.PopEvent();
					break;
				case EVENT_SPELL_FOCUS_FIRE_3:
					me->SetControlled(false, UNIT_STATE_ROOT);
					events.PopEvent();
					break;
			}

            DoMeleeAttackIfReady();
        }
开发者ID:DSlayerMan,项目名称:Sunwell,代码行数:72,代码来源:boss_shirrak_the_dead_watcher.cpp

示例7: UpdateAI

        void UpdateAI(uint32 diff)
        {
            events.Update(diff);
            switch(events.GetEvent())
            {
                case 0:
                    break;
                case 20:
                    if (pInstance)
                    {
                        pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_FINISHED_KRICK_SCENE);

                        if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID)))
                        {
                            c->GetMotionMaster()->Clear();
                            c->UpdatePosition(SBSLeaderStartPos, true);
                            c->StopMovingOnCurrentPos();
                            c->AI()->Reset();
                        }
                    }
                    events.PopEvent();
                    events.RescheduleEvent(1, 3000);
                    break;
                case 1:
                    Talk(SAY_OUTRO_KRICK_1);
                    if (pInstance)
                    {
                        if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID)))
                        {
                            float angle = me->GetAngle(c);
                            me->SetFacingTo(angle);
                            float x = me->GetPositionX()+cos(angle)*7.0f;
                            float y = me->GetPositionY()+sin(angle)*7.0f;
                            c->GetMotionMaster()->MovePoint(0, x, y, me->GetPositionZ());
                        }

                        for (uint8 i=0; i<2; ++i)
                            if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUARD_1_GUID+i)))
                                c->DespawnOrUnsummon();
                    }
                    events.PopEvent();
                    events.RescheduleEvent(2, 7000);
                    break;
                case 2:
                    if (pInstance)
                    {
                        if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID)))
                        {
                            c->setActive(true);
                            c->UpdatePosition(SBSTyrannusStartPos, true);
                            c->SetHomePosition(SBSTyrannusStartPos);
                        }
                        if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID)))
                            c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_1 : SAY_SYLVANAS_KRICK_1);
                    }
                    events.PopEvent();
                    events.RescheduleEvent(3, 6500);
                    break;
                case 3:
                    Talk(SAY_OUTRO_KRICK_2);
                    events.PopEvent();
                    events.RescheduleEvent(4, 17000);
                    break;
                case 4:
                    if (pInstance)
                    {
                        if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID)))
                            c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE+10, false);
                        if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID)))
                            c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_2 : SAY_SYLVANAS_KRICK_2);
                    }
                    events.PopEvent();
                    events.RescheduleEvent(5, 6500);
                    break;
                case 5:
                    Talk(SAY_OUTRO_KRICK_3);
                    events.PopEvent();
                    events.RescheduleEvent(6, 6500);
                    break;
                case 6:
                    if (pInstance)
                        if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID)))
                        {
                            c->SetFacingToObject(me);
                            c->AI()->Talk(SAY_TYRANNUS_KRICK_1);
                        }
                    events.PopEvent();
                    events.RescheduleEvent(7, 4000);
                    break;
                case 7:
                    me->CastSpell(me, 69413, true);
                    me->SendMeleeAttackStop(me->GetVictim());
                    me->SetCanFly(true);
                    me->SetDisableGravity(true);
                    me->SendMovementFlagUpdate();
                    me->GetMotionMaster()->MoveTakeoff(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+9.0f, 0.5f * 7.0f);

                    events.PopEvent();
                    events.RescheduleEvent(8, 2000);
                    break;
//.........这里部分代码省略.........
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:101,代码来源:boss_krickandick.cpp

示例8: UpdateAI

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

			if( me->GetPositionX() < 490.0f || me->GetPositionX() > 690.0f || me->GetPositionY() < 130.0f || me->GetPositionY() > 410.0f )
			{
				EnterEvadeMode();
				return;
			}

			events.Update(diff);

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

			switch (events.GetEvent())
			{
				case 0:
					break;
				case EVENT_ACTIVATE_CONSTRUCT:
					me->CastCustomSpell(SPELL_ACTIVATE_CONSTRUCT, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false);
					if (++counter >= 20)
					{
						me->MonsterYell(TEXT_BERSERK, LANG_UNIVERSAL, 0);
						me->PlayDirectSound(SOUND_BERSERK);
						me->CastSpell(me, SPELL_BERSERK, true);
						events.PopEvent();
						break;
					}
					events.RepeatEvent(RAID_MODE(40000,30000));
					break;
				case EVENT_SPELL_SCORCH:
					if( rand()%2 )
					{
						me->MonsterYell(TEXT_SCORCH_1, LANG_UNIVERSAL, 0);
						me->PlayDirectSound(SOUND_SCORCH_1);
					}
					else
					{
						me->MonsterYell(TEXT_SCORCH_2, LANG_UNIVERSAL, 0);
						me->PlayDirectSound(SOUND_SCORCH_2);
					}
					me->SetControlled(true, UNIT_STATE_ROOT);
					me->DisableRotate(true);
					me->SendMovementFlagUpdate();
					me->CastSpell(me->GetVictim(), S_SCORCH, false);
					events.RepeatEvent(20000);
					events.RescheduleEvent(EVENT_ENABLE_ROTATE, 3001);
					break;
				case EVENT_ENABLE_ROTATE:
					me->SetControlled(false, UNIT_STATE_ROOT);
					me->DisableRotate(false);
					events.PopEvent();
					break;
				case EVENT_SPELL_FLAME_JETS:
					me->MonsterTextEmote(TEXT_FLAME_JETS, 0, true);
					me->CastSpell(me->GetVictim(), S_FLAME_JETS, false);
					events.RepeatEvent(25000);
					break;
				case EVENT_GRAB:
					{
						std::list<Creature*> icl;
						me->GetCreaturesWithEntryInRange(icl, 300.0f, NPC_IRON_CONSTRUCT);

						std::vector<uint64> playerGUIDs;
						Map::PlayerList const& pl = me->GetMap()->GetPlayers();
						Player* temp = NULL;

						for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr )
						{
							temp = itr->GetSource();
							if( !temp->IsAlive() || temp->GetExactDist2d(me) > 90.0f )
								continue;
							if( me->GetVictim() && temp->GetGUID() == me->GetVictim()->GetGUID() )
								continue;
							bool found = false;
							for( std::list<Creature*>::iterator itr = icl.begin(); itr != icl.end(); ++itr )
								if( (*itr)->GetVictim() && (*itr)->GetVictim()->GetGUID() == temp->GetGUID() )
								{
									found = true;
									break;
								}

							if( !found )
								playerGUIDs.push_back(temp->GetGUID());
						}

						if( !playerGUIDs.empty() )
						{
							int8 pos = urand(0, playerGUIDs.size()-1);
							if( Player* pTarget = ObjectAccessor::GetPlayer(*me,playerGUIDs.at(pos)) )
							{
								me->MonsterYell(TEXT_SLAG_POT, LANG_UNIVERSAL, 0);
								me->PlayDirectSound(SOUND_SLAG_POT);
								me->CastSpell(pTarget, SPELL_GRAB, false);
							}
						}

						events.RepeatEvent(24000); // +6000 below
//.........这里部分代码省略.........
开发者ID:AlexHjelm,项目名称:sunwell,代码行数:101,代码来源:boss_ignis.cpp

示例9: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if (startPath)
            {
                me->StopMoving();
                startPath = false;
                if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath()))
                {
                    Movement::PointsArray pathPoints;
                    pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
                    for (uint8 i = 0; i < i_path->size(); ++i)
                    {
                        WaypointData const* node = i_path->at(i);
                        pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z));
                    }
                    me->GetMotionMaster()->MoveSplinePath(&pathPoints);
                }
            }

            if (!UpdateVictim())
                return;

            events.Update(diff);

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

            switch (events.GetEvent())
            {
                case 0:
                    break;
                case EVENT_ENRAGE:
                    me->CastSpell(me, SPELL_BERSERK, true);
                    events.RepeatEvent(600000);
                    break;
                case EVENT_COMMANDER_SAY_AGGRO:
                    if (Creature* commander = ObjectAccessor::GetCreature(*me, CommanderGUID))
                        commander->AI()->Talk(SAY_COMMANDER_AGGRO);
                    events.PopEvent();
                    break;
                case EVENT_EE_SAY_MOVE_OUT:
                    for (uint8 i=0; i<3; ++i)
                        if (Creature* c = ObjectAccessor::GetCreature(*me, ExpeditionEngineerGUIDs[i]))
                        {
                            if (!i)
                                c->MonsterYell(TEXT_EE_MOVE_OUT, LANG_UNIVERSAL, 0);
                            c->AI()->SetData(1, 0); // start repairing
                        }
                    events.PopEvent();
                    break;
                case EVENT_SPELL_FIREBALL:
                    if( Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) )
                        me->CastSpell(pTarget, SPELL_FIREBALL, false);
                    events.RepeatEvent(4000);
                    break;
                case EVENT_SPELL_DEVOURING_FLAME:
                    if( Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) )
                        me->CastSpell(pTarget, SPELL_DEVOURINGFLAME, false);
                    events.RepeatEvent(13000);
                    break;
                case EVENT_SUMMON_MOLE_MACHINES:
                    {
                        memset(cords, '\0', sizeof(cords));
                        uint8 num = RAID_MODE( urand(2,3), urand(2,4) );
                        for( int i=0; i<num; ++i )
                        {
                            // X: (550, 625) Y: (-185, -230)
                            cords[i][0] = urand(550, 625);
                            cords[i][1] = -230 + rand()%45;
                            if( GameObject* drill = me->SummonGameObject(GO_DRILL, cords[i][0], cords[i][1], 391.1f, M_PI/4, 0.0f, 0.0f, 0.0f, 0.0f, 8) )
                            {
                                //drill->SetGoAnimProgress(0);
                                //drill->SetLootState(GO_READY);
                                //drill->UseDoorOrButton(8);
                                //drill->SetGoState(GO_STATE_READY);
                                drill->SetGoState(GO_STATE_ACTIVE);
                                drill->SetGoAnimProgress(0);
                            }
                        }
                        events.RepeatEvent(45000);
                        events.RescheduleEvent(EVENT_SUMMON_ADDS, 4000);
                    }
                    break;
                case EVENT_SUMMON_ADDS:
                    for( int i=0; i<4; ++i )
                    {
                        if( !cords[i][0] )
                            break;

                        uint8 opt;
                        uint8 r = urand(1,100);
                        if( r <= 30 ) opt = 1;
                        else if( r <= 65 ) opt = 2;
                        else opt = 3;

                        for( int j=0; j<4; ++j )
                        {
                            float x = cords[i][0] + 4.0f*cos(j*M_PI/2);
                            float y = cords[i][1] + 4.0f*sin(j*M_PI/2);

//.........这里部分代码省略.........
开发者ID:boom8866,项目名称:azerothcore-wotlk,代码行数:101,代码来源:boss_razorscale.cpp

示例10: UpdateAI

		void UpdateAI(uint32 diff)
		{
			if (!UpdateVictim() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
				return;

			events.Update(diff);

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

			switch(events.GetEvent())
			{
				case 0:
					break;
				case EVENT_EMERGE:
					me->SetVisible(true);
					me->CastSpell(me, SPELL_EMERGE_0, false);
					events.PopEvent();
					events.RescheduleEvent(EVENT_ATTACK, 2000);
					break;
				case EVENT_SUMMON_TOTEMS:
					for (uint8 i=0; i<3; ++i)
						DoSummon(NPC_TOTEM, TotemPos[i], 10*60*1000, TEMPSUMMON_TIMED_DESPAWN);
					events.PopEvent();
					break;
				case EVENT_INVOKER_SAY_1:
					if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID))
					{
						plr->MonsterSay("The Ice Stone has melted!", LANG_UNIVERSAL, 0);
						plr->CastSpell(plr, SPELL_MAKE_BONFIRE, true);
					}
					events.PopEvent();
					events.RescheduleEvent(EVENT_INVOKER_SAY_2, 2000);
					break;
				case EVENT_INVOKER_SAY_2:
					if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID))
						plr->MonsterSay("Ahune, your strength grows no more!", LANG_UNIVERSAL, 0);
					events.PopEvent();
					events.RescheduleEvent(EVENT_INVOKER_SAY_3, 2000);
					break;
				case EVENT_INVOKER_SAY_3:
					if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID))
						plr->MonsterSay("Your frozen reign will not come to pass!", LANG_UNIVERSAL, 0);
					events.PopEvent();
					break;
				case EVENT_ATTACK:
					events.Reset();
					if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID))
						AttackStart(plr);
					me->SetInCombatWithZone();
					if (!me->IsInCombat())
					{
						EnterEvadeMode();
						return;
					}
					else
						me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
					break;
				case EVENT_TOTEMS_ATTACK:
					for (uint8 i=0; i<3; ++i)
						if (Creature* bunny = me->FindNearestCreature(NPC_TOTEM_BUNNY_1+i, 150.0f, true))
							bunny->CastSpell(me, SPELL_TOTEM_BEAM, false);
					events.PopEvent();
					events.RescheduleEvent(EVENT_SUBMERGE, 10000);
					break;
				case EVENT_SUBMERGE:
					me->MonsterTextEmote(TEXT_RETREAT, 0, true);
					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
					me->CastSpell(me, SPELL_SUBMERGE_0, true);
					me->CastSpell(me, SPELL_SELF_STUN, true);
					if (Creature* c = DoSummon(NPC_FROZEN_CORE, *me, 24000, TEMPSUMMON_TIMED_DESPAWN))
					{
						c->SetHealth(me->GetHealth());
					}
					events.Reset();
					events.RescheduleEvent(EVENT_COMBAT_EMERGE, 25000);
					events.RescheduleEvent(EVENT_EMERGE_WARNING, 20000);
					break;
				case EVENT_EMERGE_WARNING:
					me->MonsterTextEmote(TEXT_RESURFACE, 0, true);
					events.PopEvent();
					break;
				case EVENT_COMBAT_EMERGE:
					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
					me->RemoveAura(SPELL_SELF_STUN);
					me->CastSpell(me, SPELL_EMERGE_0, false);
					// me->CastSpell(me, SPELL_AHUNE_RESURFACES, true); // done in SummonedCreatureDespawn
					me->RemoveAura(SPELL_SUBMERGE_0);
					events.PopEvent();
					StartPhase1();
					break;

				case EVENT_SPELL_COLD_SLAP:
					if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 5.0f, true))
						if (target->GetPositionZ() < me->GetPositionZ()+6.0f)
						{
							int32 dmg = urand(5500,6000);
							me->CastCustomSpell(target, SPELL_COLD_SLAP, &dmg, NULL, NULL, false);
							float x, y, z;
							target->GetNearPoint(target, x, y, z, target->GetObjectSize(), 30.0f, target->GetAngle(me->GetPositionX(), me->GetPositionY()) + M_PI);
//.........这里部分代码省略.........
开发者ID:AlexHjelm,项目名称:sunwell,代码行数:101,代码来源:boss_ahune.cpp

示例11: DamageTaken

 void DamageTaken(Unit* /*attacker*/, uint32& damage)
 {
     damage = 0;
     events.RescheduleEvent(EVENT_DUMMY_RESET, 10000);
 }
开发者ID:3kids,项目名称:TrinityCore,代码行数:5,代码来源:icecrown.cpp

示例12: UpdateAI

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

			if (!UpdateVictim())
			{
				while(uint32 eventId = events.ExecuteEvent())
				{
					switch(eventId)
					{
						if (instance)
						{
							case EVENT_ATTACK_START:
								me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
								me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
								me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
								events.ScheduleEvent(EVENT_DISSIPATION, 4*IN_MILLISECONDS);
								me->setActive(true);
								me->setFaction(14);
								me->SetInCombatWithZone();

								events.CancelEvent(EVENT_ATTACK_START);
								break;

							default:
								break;
						}
					}
				}
			}

			if (!me->HasAura(SPELL_INTENSITY) && intensityStacks != 0)
				intensityStacks = 0;

			if (damageDealt >= me->GetMaxHealth() * 0.02f)
			{
				me->RemoveAurasDueToSpell(SPELL_DISSIPATION);
				me->CastSpell(me, SPELL_INTENSITY);
				events.RescheduleEvent(EVENT_DISSIPATION, 4*IN_MILLISECONDS);
				intensityStacks++;
				damageDealt = 0;
			}

			if (intensityStacks == 10)
			{
				me->CastSpell(me, SPELL_ULTIMATE_POWER);
				me->RemoveAurasDueToSpell(SPELL_INTENSITY);
				intensityStacks = 0;
			}

			if (UpdateVictim())
			{
				if (!eventAgony)
				{
					events.ScheduleEvent(EVENT_AGONY, 1*IN_MILLISECONDS);
					eventAgony = true;
				}

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

								events.RescheduleEvent(EVENT_AGONY, 2500);
								break;

							case EVENT_DISSIPATION:
								if (!me->HasAura(SPELL_ULTIMATE_POWER))
									me->CastSpell(me, SPELL_DISSIPATION);

								if (me->HasAura(SPELL_INTENSITY))
									me->RemoveAurasDueToSpell(SPELL_INTENSITY, me->GetGUID());

								intensityStacks = 0;

								events.RescheduleEvent(EVENT_DISSIPATION, 2*IN_MILLISECONDS);
								break;

							default:
								break;
						}
					}
				}
			}

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

示例13: UpdateAI

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

            events.Update(diff);

            switch(events.GetEvent())
            {
                case 0:
                    break;
                case EVENT_SUMMON_KEEPER_OR_GUARDIAN:
                    bKorG = true;
                    spawned = true;
                    if (Creature *c = DoSummon(RAND(NPC_PORTAL_GUARDIAN, NPC_PORTAL_KEEPER), me, 2.0f, 0, TEMPSUMMON_DEAD_DESPAWN))
                        me->CastSpell(c, SPELL_PORTAL_CHANNEL, false);
                    events.PopEvent();
                    events.RescheduleEvent(EVENT_SUMMON_KEEPER_TRASH, 20000);
                    break;
                case EVENT_SUMMON_KEEPER_TRASH:
                    for (uint8 i=0; i<3+addValue; ++i)
                    {
                        uint32 entry = RAND(NPC_AZURE_INVADER_1, NPC_AZURE_INVADER_2, NPC_AZURE_SPELLBREAKER_1, NPC_AZURE_SPELLBREAKER_2, NPC_AZURE_MAGE_SLAYER_1, NPC_AZURE_MAGE_SLAYER_2, NPC_AZURE_BINDER_1, NPC_AZURE_BINDER_2);
                        DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN);
                    }
                    events.RepeatEvent(20000);
                    break;
                case EVENT_SUMMON_ELITES:
                    spawned = true;
                    for (uint8 i=0; i<2+addValue; ++i)
                    {
                        uint32 entry = RAND(NPC_AZURE_CAPTAIN, NPC_AZURE_RAIDER, NPC_AZURE_STALKER, NPC_AZURE_SORCEROR);
                        DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN);
                    }
                    me->SetVisible(false);
                    events.PopEvent();
                    break;
                case EVENT_SUMMON_SABOTEOUR:
                    DoSummon(NPC_SABOTEOUR, me, 2.0f, 0, TEMPSUMMON_CORPSE_DESPAWN);
                    me->DespawnOrUnsummon(3000);
                    events.PopEvent();
                    break;
            }

            if (!spawned)
                return;

            if (bKorG)
            {
                if (!me->IsNonMeleeSpellCast(false)) // keeper/guardian died => channeled spell interrupted
                {
                    // if keeper/guard lost all victims, in enterevademode linking aura is removed, restore it:
                    if (pInstance)
                        for (SummonList::iterator itr = listOfMobs.begin(); itr != listOfMobs.end(); ++itr)
                            if (Creature* c = pInstance->instance->GetCreature(*itr))
                                if (c->IsAlive() && (c->GetEntry() == NPC_PORTAL_GUARDIAN || c->GetEntry() == NPC_PORTAL_KEEPER))
                                {
                                    me->CastSpell(c, SPELL_PORTAL_CHANNEL, false);
                                    return;
                                }
                    Unit::Kill(me, me, false);
                }
            }
            else
            {
                if (listOfMobs.empty())
                    Unit::Kill(me, me, false);
            }
        }
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:69,代码来源:violet_hold.cpp

示例14: EnterEvadeMode

 void EnterEvadeMode() override 
 { 
     StartAttackThyala();
     m_events.RescheduleEvent(EVENT_CHECK_ATTACK, 1000);
 }
开发者ID:DSlayerMan,项目名称:ArkCORE-NG,代码行数:5,代码来源:zone_duskhaven.cpp

示例15: UpdateAI

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

		if(phase == 2 && boss_phase == 1)
		{
			events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000));
			events.RescheduleEvent(EVENT_OVERLOAD, urand(60000,125000));
            events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000));
			boss_phase++;

		}
		if(phase == 3 && boss_phase == 2)
		{
			events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000));
			events.RescheduleEvent(EVENT_OVERLOAD, urand(60000,125000));
            events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000));
			DoCast(me, SPELL_STORMSHIELD);
            events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, urand(40000,80000));
        }

        events.Update(diff);
		if(!me->HasAura(SPELL_OVERLOAD) && overload == true) 
		{
			DoCast(63480);
			overload = false;
		}

        while (uint32 eventId = events.ExecuteEvent())
        {
            switch(eventId)
            {
                case EVENT_ENRAGE:
                    DoScriptText(SAY_BRUNDIR_BERSERK, me);
                    DoCast(SPELL_BERSERK);
                    break;
                case EVENT_CHAIN_LIGHTNING:
                    if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                        DoCast(pTarget, RAID_MODE(SPELL_CHAIN_LIGHTNING_N , SPELL_CHAIN_LIGHTNING_H));
                    events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000));
                    break;
                case EVENT_OVERLOAD:
                    DoCast(SPELL_OVERLOAD);
					overload = true;
					events.ScheduleEvent(EVENT_OVERLOAD, urand(60000,125000));
                    break;
                case EVENT_LIGHTNING_WHIRL:
                    DoCast(RAID_MODE(SPELL_LIGHTNING_WHIRL , SPELL_LIGHTNING_WHIRL_H));
					DoCast(RAID_MODE(61916, 63482));
                    events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000));
                    break;
                case EVENT_LIGHTNING_TENDRILS:
                    DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H));
					DoCast(RAID_MODE(61886, 63485));
                    events.DelayEvents(15000, 5000);
                    DoResetThreat();
                    break;
            }
        }

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


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