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


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

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


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

示例1: UpdateAI

        void UpdateAI(uint32 diff)
        {
            // Call speach
            if (timer)
            {
                timer += diff;
                if (timer >= 4000)
                {
                    Talk(SAY_SHADRON_RESPOND);
                    me->SetCanFly(true);
                    me->SetSpeed(MOVE_FLIGHT, 3.0f);
                    me->GetMotionMaster()->MovePath(me->GetEntry()*10, false);
                    timer = 0;
                }
            }

            if (!UpdateVictim())
                return;

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

            switch (events.GetEvent())
            {
                case EVENT_MINIBOSS_SHADOW_BREATH:
                    if (!urand(0,10))
                        Talk(SAY_SHADRON_BREATH);
                    me->CastSpell(me->GetVictim(), SPELL_SHADOW_BREATH, false);
                    events.RepeatEvent(17500);
                    break;
                case EVENT_MINIBOSS_SHADOW_FISSURE:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
                        me->CastSpell(target, SPELL_SHADOW_FISSURE, false);
                    events.RepeatEvent(22500);
                    break;
                case EVENT_MINIBOSS_OPEN_PORTAL:
                    Talk(WHISPER_OPEN_PORTAL);
                    Talk(SAY_SHADRON_SPECIAL);
                    if (!isSartharion)
                    {
                        if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[BOSS_SHADRON_EVENT].GetPositionX(), portalPos[BOSS_SHADRON_EVENT].GetPositionY(), portalPos[BOSS_SHADRON_EVENT].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
                            portalGUID = Portal->GetGUID();
                    }
                    else if (pInstance)
                        pInstance->SetData(DATA_ADD_PORTAL, 0);
                        
                    events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2000);
                    events.PopEvent();
                    break;
                case EVENT_MINIBOSS_SPAWN_HELPERS:
                    Talk(WHISPER_SUMMON_DICIPLE);
                    me->CastSpell(me, (isSartharion ? SPELL_GIFT_OF_TWILIGHT_FIRE : SPELL_GIFT_OF_TWILIGHT_SHADOW), true);
                    if (Creature* cr = me->SummonCreature((isSartharion ? NPC_ACOLYTE_OF_SHADRON : NPC_DISCIPLE_OF_SHADRON), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()))
                    {
                        summons.Summon(cr);
                        cr->SetPhaseMask(16, true);
                    }

                    events.PopEvent();
                    break;
            }

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

示例2: 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

示例3: 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

示例4: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if (spawnTimer)
            {
                spawnTimer += diff;
                if (spawnTimer >= 21500)
                {
                    me->SetVisible(true);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    me->SetReactState(REACT_AGGRESSIVE);
                    spawnTimer = 0;
                }
                return;
            }

            if (!IsInRoom())
                return;

            if (!UpdateVictim())
                return;

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

            switch (events.GetEvent())
            {
                case EVENT_BERSERK:
                    Talk(EMOTE_ENRAGE);
                    me->CastSpell(me, SPELL_BERSERK, true);
                    events.PopEvent();
                    return;
                case EVENT_SPELL_CLEAVE:
                    me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false);
                    events.RepeatEvent(10000);
                    return;
                case EVENT_SPELL_TAIL_SWEEP:
                    me->CastSpell(me, RAID_MODE(SPELL_TAIL_SWEEP_10, SPELL_TAIL_SWEEP_25), false);
                    events.RepeatEvent(10000);
                    return;
                case EVENT_SPELL_LIFE_DRAIN:
                    me->CastCustomSpell(RAID_MODE(SPELL_LIFE_DRAIN_10, SPELL_LIFE_DRAIN_25), SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5), me, false);
                    events.RepeatEvent(24000);
                    return;
                case EVENT_SPELL_BLIZZARD:
                {
                    Creature* cr;
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true))
                        cr = me->SummonCreature(NPC_BLIZZARD, *target, TEMPSUMMON_TIMED_DESPAWN, 16000);
                    else
                        cr = me->SummonCreature(NPC_BLIZZARD, *me, TEMPSUMMON_TIMED_DESPAWN, 16000);
                        
                    if (cr)
                        cr->GetMotionMaster()->MoveRandom(40);
                    events.RepeatEvent(RAID_MODE(8000, 6500));
                    return;
                }
                case EVENT_FLIGHT_START:
                    if (me->HealthBelowPct(11))
                    {
                        events.PopEvent();
                        return;
                    }
                    events.RepeatEvent(45000);
                    events.DelayEvents(35000);
                    me->SetReactState(REACT_PASSIVE);
                    me->AttackStop();
                    float x, y, z, o;
                    me->GetHomePosition(x, y, z, o);
                    me->GetMotionMaster()->MovePoint(POINT_CENTER, x, y, z);
                    return;
                case EVENT_FLIGHT_LIFTOFF:
                    me->GetMotionMaster()->MoveIdle();
                    me->SendMeleeAttackStop(me->GetVictim());
                    me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
                    me->SetDisableGravity(true);
                    currentTarget = 0;
                    events.PopEvent();
                    events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, 3000);
                    iceboltCount = RAID_MODE(2, 3);
                    return;
                case EVENT_FLIGHT_ICEBOLT:
                {
                    events.PopEvent();
                    if (currentTarget)
                        if (Unit* target = ObjectAccessor::GetUnit(*me, currentTarget))
                            me->SummonGameObject(GO_ICE_BLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0);
            
                    std::vector<Unit*> targets;
                    ThreatContainer::StorageType::const_iterator i = me->getThreatManager().getThreatList().begin();
                    for (; i != me->getThreatManager().getThreatList().end(); ++i)
                        if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER)
                        {
                            bool inList = false;
                            if (!blockList.empty())
                                for (std::list<uint64>::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
                                    if ((*i)->getTarget()->GetGUID() == *itr)
                                    {
                                        inList = true;
                                        break;
//.........这里部分代码省略.........
开发者ID:boom8866,项目名称:azerothcore-wotlk,代码行数:101,代码来源:boss_sapphiron.cpp

示例5: UpdateAI

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

			if (!UpdateVictim())
				return;

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

			switch (events.GetEvent())
			{
				case EVENT_SPELL_WEB_SPRAY:
					me->MonsterTextEmote("%s sprays strands of web everywhere!", 0, true);
					me->CastSpell(me, RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25), true);
					events.RepeatEvent(40000);
					break;
				case EVENT_SPELL_POISON_SHOCK:
					me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_POISON_SHOCK_10, SPELL_POISON_SHOCK_25), false);
					events.RepeatEvent(40000);
					break;
				case EVENT_SPELL_NECROTIC_POISON:
					me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_NECROTIC_POISON_10, SPELL_NECROTIC_POISON_25), false);
					events.RepeatEvent(30000);
					break;
				case EVENT_SUMMON_SPIDERLINGS:
					me->MonsterTextEmote("Spiderlings appear on the web!", 0, true);
					for (uint8 i = 0; i < 8; ++i)
						me->SummonCreature(NPC_MAEXXNA_SPIDERLING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
					events.RepeatEvent(40000);
					break;
				case EVENT_HEALTH_CHECK:
					if (me->GetHealthPct() < 30)
					{
						me->CastSpell(me, RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25), true);
						events.PopEvent();
						break;
					}

					events.RepeatEvent(1000);
					break;
				case EVENT_WEB_WRAP:
					me->MonsterTextEmote("%s spins her web into a cocoon!", 0, true);
					for (uint8 i = 0; i < RAID_MODE(1,2); ++i)
						if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP))
						{
							target->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25));
							uint8 pos = urand(0,2);

							target->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20);
							if (Creature *wrap = me->SummonCreature(NPC_WEB_WRAP, PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000))
								wrap->AI()->SetGUID(target->GetGUID());
						}
					events.RepeatEvent(40000);
					break;
			}

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

示例6: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if (!IsInRoom(me))
                return;

            if (!UpdateVictim())
                return;

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

            switch (events.GetEvent())
            {
                case EVENT_SPELL_SPELL_DISRUPTION:
                    me->CastSpell(me, SPELL_SPELL_DISRUPTION, false);
                    events.RepeatEvent(10000);
                    break;
                case EVENT_SPELL_DECEPIT_FEVER:
                    me->CastSpell(me, RAID_MODE(SPELL_DECREPIT_FEVER_10, SPELL_DECREPIT_FEVER_25), false);
                    events.RepeatEvent(20000);
                    break;
                case EVENT_SWITCH_PHASE:
                    StartFightPhase(currentPhase == PHASE_SLOW_DANCE ? PHASE_FAST_DANCE : PHASE_SLOW_DANCE);
                    // no pop, there is reset in start fight
                    break;
                case EVENT_ERUPT_SECTION:
                    if (pInstance)
                    {
                        pInstance->SetData(DATA_HEIGAN_ERUPTION, currentSection);
                        if (currentSection == 3)
                            moveRight = false;
                        else if (currentSection == 0)
                            moveRight = true;

                        moveRight ? currentSection++ : currentSection--;
                    }

                    if (currentPhase == PHASE_SLOW_DANCE && !urand(0,3))
                        Talk(SAY_TAUNT);

                    events.RepeatEvent(currentPhase == PHASE_SLOW_DANCE ? 10000 : 4000);
                    break;
                case EVENT_SAFETY_DANCE:
                {
                    Map::PlayerList const& pList = me->GetMap()->GetPlayers();
                    for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
                    {
                        if (IsInRoom(itr->GetSource()) && !itr->GetSource()->IsAlive())
                        {
                            events.PopEvent();
                            pInstance->SetData(DATA_DANCE_FAIL, 0);
                            pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
                            return;
                        }

                    }
                    events.RepeatEvent(5000);
                    return;
                }
            }

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

示例7: UpdateAI

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

            events.Update(diff);

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

            switch ( events.GetEvent() )
            {
                case EVENT_CHECK_HEALTH:
                {
                    events.RepeatEvent(1000);
                    if (HealthBelowPct(50))
                    {
                        events.CancelEvent(EVENT_CHECK_HEALTH);
                        events.ScheduleEvent(EVENT_SUMMON_GUARD, 100);
                    }
                    break;
                }
                case EVENT_SUMMON_GUARD:
                {
                    me->MonsterTextEmote(EMOTE_HATCHES, me, true);
                    SummonHelpers(false);
                    events.PopEvent();
                    break;
                }
                case EVENT_BROOD_RAGE:
                {
                    if (Creature *pSwarmer = me->FindNearestCreature(NPC_AHNKAHAR_SWARMER, 40, true))
                        me->CastSpell(pSwarmer, SPELL_BROOD_RAGE_H, true);

                    events.RepeatEvent(10000);
                    break;
                }
                case EVENT_PLAGUE:
                {
                    me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_BROOD_PLAGUE, SPELL_BROOD_PLAGUE_H), false);
                    events.RepeatEvent(12000+rand()%5000);
                    break;
                }
                case EVENT_SWARMER:
                {
                    SummonHelpers(true);
                    events.RepeatEvent(10000);
                    break;
                }
                case EVENT_CHECK_HOME:
                {
                    if (me->HasAura(SPELL_ENRAGE))
                        break;

                    if (me->GetPositionZ() < 24)
                    {
                        me->CastSpell(me, SPELL_ENRAGE, true);
                        events.PopEvent();
                        break;
                    }

                    events.RepeatEvent(2000);
                    break;
                }
            }

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

示例8: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if (!me->isActiveObject())
                return;

            UpdateVictim();

            events.Update(diff);

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

            switch (uint32 evId = events.GetEvent())
            {
                case 0:
                    break;
                case EVENT_CHECK_PLAYER:
                    if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID))
                        if (p->GetExactDist(me) <= 50.0f)
                        {
                            events.RepeatEvent(5000);
                            break;
                        }
                    events.PopEvent();
                    me->setActive(false);
                    EnterEvadeMode();
                    return;
                case EVENT_SUMMON_SOLDIERS:
                    for (uint8 i=0; i<SUNWELL_DEFENDER_NUM; ++i)
                        me->SummonCreature(NPC_SUNWELL_DEFENDER, SunwellDefenderPos[i], TEMPSUMMON_TIMED_DESPAWN, 33000+(i/5)*5000);
                    events.PopEvent();
                    break;
                case EVENT_TALK_INTRO_0:
                case EVENT_TALK_INTRO_1:
                case EVENT_TALK_INTRO_2:
                case EVENT_TALK_INTRO_3:
                    Talk(SAY_INTRO_0 + (evId-EVENT_TALK_INTRO_0));
                    events.PopEvent();
                    break;
                case EVENT_SALUTE:
                    me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
                    for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
                        if (Creature* c = ObjectAccessor::GetCreature(*me, *itr))
                            c->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
                    events.PopEvent();
                    break;
                case EVENT_SOLDIERS_RUN_AWAY:
                    {
                        uint8 count = 0;
                        for (SummonList::iterator itr = summons.begin(); itr != summons.end();)
                        {
                            ++count;
                            if (Creature* c = ObjectAccessor::GetCreature(*me, *itr))
                            {
                                c->SetWalk(false);
                                c->GetMotionMaster()->MovePoint(0, 11863.35f, -7073.44f, 27.40f);
                            }
                            SummonList::iterator itr2 = itr++;
                            summons.erase(itr2);
                            if (count >= 5)
                            {
                                if (!summons.empty())
                                {
                                    events.RepeatEvent(5000);
                                    return;
                                }
                                else
                                {
                                    events.PopEvent();
                                    return;
                                }
                            }
                        }
                    }
                    events.PopEvent();
                    break;
                case EVENT_GO_FIGHTPOINT:
                    me->SetWalk(true);
                    me->GetMotionMaster()->MovePoint(0, 11779.30f, -7065.43f, 24.92f);
                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
                    events.PopEvent();
                    break;
                case EVENT_TALK_SPAWN_0:
                case EVENT_TALK_SPAWN_1:
                    Talk(SAY_SPAWN_0 + (evId-EVENT_TALK_SPAWN_0));
                    events.PopEvent();
                    break;
                case EVENT_SUMMON_MORLEN:
                    if (Creature* c = me->SummonCreature(NPC_MORLEN_COLDGRIP, 11766.70f, -7050.57f, 25.17f, 5.56f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
                        morlenGUID = c->GetGUID();
                    events.PopEvent();
                    break;
                case EVENT_TALK_MORLEN_0:
                case EVENT_TALK_MORLEN_1:
                    if (Creature* c = ObjectAccessor::GetCreature(*me, morlenGUID))
                        c->AI()->Talk(SAY_MORLEN_0 + (evId-EVENT_TALK_MORLEN_0));
                    events.PopEvent();
                    break;
                case EVENT_SPAWN_WAVE_1:
                case EVENT_SPAWN_WAVE_2:
//.........这里部分代码省略.........
开发者ID:Keader,项目名称:Sunwell,代码行数:101,代码来源:zone_isle_of_queldanas.cpp

示例9: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if (!_isActive && !_attackGUID)
                return;

            events.Update(diff);
            uint32 eventId = events.GetEvent();

            if (eventId == EVENT_UNFREEZE)
            {
                events.PopEvent();
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                me->CastSpell(me, SPELL_AWAKEN, true);
                me->RemoveAllAuras();
                _isActive = true;
                if (Unit* target = ObjectAccessor::GetUnit(*me, _attackGUID))
                    AttackStart(target);
                return;
            }

            //Return since we have no target or if we are disabled from fight
            if (!UpdateVictim())
                return;

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

            switch (eventId)
            {
                case EVENT_PIERCING_HOWL:
                    me->CastSpell(me->GetVictim(), SPELL_PIERCING_HOWL, false);
                    events.RepeatEvent(10000+rand()%1500);
                    break;
                case EVENT_PENETRATING_STRIKE:
                    me->CastSpell(me->GetVictim(), SPELL_PENETRATING_STRIKE, false);
                    events.RepeatEvent(5000+rand()%5000);
                    break;
                case EVENT_FRIGHTENING_SHOUT:
                    me->CastSpell(me->GetVictim(), SPELL_FRIGHTENING_SHOUT, false);
                    events.RepeatEvent(20000+rand()%8000);
                    break;
                case EVENT_BLADE_TURNING:
                    me->CastSpell(me->GetVictim(), me->GetMap()->IsHeroic() ? SPELL_BLADE_TURNING_H : SPELL_BLADE_TURNING_N, false);
                    events.RepeatEvent(12000);
                    break;
                case EVENT_THROW:
                    me->CastSpell(SelectTarget(SELECT_TARGET_RANDOM,0,50.0f, true,0), me->GetMap()->IsHeroic() ? SPELL_THROW_H : SPELL_THROW_N, true);
                    events.RepeatEvent(10000+rand()%15000);
                    break;
                case EVENT_DEADLY_THROW:
                    me->CastSpell(SelectTarget(SELECT_TARGET_RANDOM,0,50.0f, true,0), me->GetMap()->IsHeroic() ? SPELL_DEADLY_THROW_H : SPELL_DEADLY_THROW_N, true);
                    events.RepeatEvent(15000+rand()%15000);
                    break;
                case EVENT_DEFLECTION:
                    me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_DEFLECTION_H : SPELL_DEFLECTION_N, false);
                    events.RepeatEvent(15000);
                    break;
            }

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

示例10: 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

示例11: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if( releaseLockTimer )
            {
                if( releaseLockTimer >= 5000 )
                {
                    lock = false;
                    if (me->IsInCombat())
                    {
                        LeaveCombat();
                        me->CastSpell(me, SPELL_EVOCATION, true);
                    }
                    releaseLockTimer = 0;
                }
                else
                    releaseLockTimer += diff;
            }

            if( !UpdateVictim() )
                return;

            events.Update(diff);

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

            DoMeleeAttackIfReady();

            switch( events.GetEvent() )
            {
                case 0:
                    break;
                case EVENT_FROSTBOMB:
                    if( Unit* v = me->GetVictim() )
                        me->CastSpell(v, SPELL_FROSTBOMB, false);
                    events.RepeatEvent(urand(7000,11000));
                    break;
                case EVENT_TIME_BOMB:
                    if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true) )
                        me->CastSpell(target, SPELL_TIME_BOMB, false);
                    events.RepeatEvent(urand(20000, 25000));
                    break;
                case EVENT_TELEPORT_TO_CENTER:
                    x = me->GetPositionX();
                    y = me->GetPositionY();
                    z = me->GetPositionZ();
                    me->CastSpell(me, SPELL_TELEPORT, false);
                    events.RepeatEvent(urand(25000,30000));
                    events.DelayEvents(10000);
                    break;
                case EVENT_TELE_BACK:
                    me->GetMotionMaster()->MoveIdle();
                    me->DisableSpline();
                    me->SetCanFly(false);
                    me->SetDisableGravity(false);
                    me->NearTeleportTo(x, y, z, 0.0f);
                    me->SetControlled(false, UNIT_STATE_ROOT);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    me->GetMotionMaster()->MoveChase(me->GetVictim());
                    events.PopEvent();
                    break;
            }
        }
开发者ID:Keader,项目名称:Sunwell,代码行数:63,代码来源:boss_urom.cpp

示例12: 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_SPELL_BLOODLUST:
                    me->CastSpell((Unit*)NULL, SPELL_BLOODLUST, false);
                    events.RepeatEvent(urand(35000,45000));
                    break;
                case EVENT_SPELL_BREAK_BONDS:
                    me->CastSpell((Unit*)NULL, SPELL_BREAK_BONDS, false);
                    events.RepeatEvent(urand(16000,22000));
                    break;
                case EVENT_SPELL_CHAIN_HEAL:
                    if (uint64 TargetGUID = GetChainHealTargetGUID())
                        if (pInstance)
                        {
                            if (Creature* target = pInstance->instance->GetCreature(TargetGUID))
                                me->CastSpell(target, SPELL_CHAIN_HEAL, false);

                            Creature *pGuard1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID));
                            Creature *pGuard2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID));
                            if ((pGuard1 && !pGuard1->IsAlive()) || (pGuard2 && !pGuard2->IsAlive()))
                            {
                                events.RepeatEvent(urand(3000,6000));
                                break;
                            }
                        }
                    events.RepeatEvent(urand(8000,11000));
                    break;
                case EVENT_SPELL_EARTH_SHIELD:
                    me->CastSpell(me, SPELL_EARTH_SHIELD, false);
                    events.RepeatEvent(20000);
                    break;
                case EVENT_SPELL_EARTH_SHOCK:
                    me->CastSpell(me->GetVictim(), SPELL_EARTH_SHOCK, false);
                    events.RepeatEvent(urand(8000,13000));
                    break;
                case EVENT_SPELL_LIGHTNING_BOLT:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true))
                        me->CastSpell(target, SPELL_LIGHTNING_BOLT, false);
                    events.RepeatEvent(urand(15000,25000));
                    break;
                case EVENT_SPELL_STORMSTRIKE:
                    {
                        Creature *pGuard1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID));
                        Creature *pGuard2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID));
                        if (pGuard1 && !pGuard1->IsAlive() && pGuard2 && !pGuard2->IsAlive()) // both dead
                            me->CastSpell(me->GetVictim(), SPELL_STORMSTRIKE, false);
                        events.RepeatEvent(3000);
                    }
                    break;
            }

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

示例13: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if (!isActive)
            {
                IntroTimer += diff;
                if (IntroTimer > 5000 && IntroTimer < 10000)
                {
                    if (SelectTargetFromPlayerList(60))
                    {
                        Talk(SAY_INTRO_1);
                        IntroTimer = 10000;
                    }
                    else
                        IntroTimer = 0;
                }

                if (IntroTimer >= 30000 && IntroTimer < 40000)
                {
                    Talk(SAY_INTRO_2);
                    IntroTimer = 40000;
                }
                if (IntroTimer >= 60000)
                {
                    isActive = true;
                    if (m_pInstance)
                        m_pInstance->SetData(TYPE_LOKEN_INTRO, 1);

                    me->SetControlled(false, UNIT_STATE_STUNNED);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                    if (Player* target = SelectTargetFromPlayerList(80))
                        AttackStart(target);
                }

                return;
            }

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

            events.Update(diff);

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

            switch (events.GetEvent())
            {
                case EVENT_CHECK_HEALTH:
                    if (HealthBelowPct(HealthCheck))
                    {
                        LokenSpeach(true);
                        HealthCheck -= 25;
                    }

                    events.RepeatEvent(1000);
                    break;
                case EVENT_LIGHTNING_NOVA:
                    events.RepeatEvent(15000);
                    me->CastSpell(me, SPELL_LIGHTNING_NOVA_VISUAL, true);
                    me->CastSpell(me, SPELL_LIGHTNING_NOVA_THUNDERS, true);

                    events.DelayEvents(5001);
                    events.ScheduleEvent(EVENT_AURA_REMOVE, me->GetMap()->IsHeroic() ? 4000 : 5000);

                    me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_LIGHTNING_NOVA_H : SPELL_LIGHTNING_NOVA_N, false);
                    break;
                case EVENT_SHOCKWAVE:
                    me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_PULSING_SHOCKWAVE_H : SPELL_PULSING_SHOCKWAVE_N, false);
                    events.PopEvent();
                    break;
                case EVENT_ARC_LIGHTNING:
                    if (Unit* target = SelectTargetFromPlayerList(100, SPELL_ARC_LIGHTNING))
                        me->CastSpell(target, SPELL_ARC_LIGHTNING, false);

                    events.RepeatEvent(12000);
                    break;
                case EVENT_AURA_REMOVE:
                    me->RemoveAura(SPELL_LIGHTNING_NOVA_THUNDERS);
                    events.PopEvent();
                    break;
            }

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

示例14: UpdateAI

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

            events.Update(diff);
            switch (events.GetEvent())
            {
                case EVENT_SPELL_SONIC_BOOM:
                    Talk(EMOTE_SONIC_BOOM);
                    me->CastSpell(me, DUNGEON_MODE(SPELL_SONIC_BOOM_CAST_N, SPELL_SONIC_BOOM_CAST_H), false);
                    events.RepeatEvent(28500);
                    events.DelayEvents(1500);
                    events.ScheduleEvent(EVENT_SPELL_SONIC_BOOM_EFFECT, 0);
                    return;
                case EVENT_SPELL_SONIC_BOOM_EFFECT:
                    me->CastSpell(me, DUNGEON_MODE(SPELL_SONIC_BOOM_EFFECT_N, SPELL_SONIC_BOOM_EFFECT_H), true);
                    events.PopEvent();
                    break;
                case EVENT_SPELL_MURMURS_TOUCH:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true))
                        me->CastSpell(target, DUNGEON_MODE(SPELL_MURMURS_TOUCH_N, SPELL_MURMURS_TOUCH_H), false);
                    events.RepeatEvent(urand(25000, 35000));
                    break;
                case EVENT_SPELL_RESONANCE:
                    if (!me->IsWithinMeleeRange(me->GetVictim()))
                        me->CastSpell(me, SPELL_RESONANCE, false);
                    events.RepeatEvent(5000);
                    break;
                case EVENT_SPELL_MAGNETIC:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true))
                    {
                        me->CastSpell(target, SPELL_MAGNETIC_PULL, false);
                        events.RepeatEvent(urand(15000, 30000));
                        return;
                    }
                    events.RepeatEvent(500);
                    break;
                case EVENT_SPELL_THUNDERING:
                    me->CastSpell(me, SPELL_THUNDERING_STORM, true);
                    events.RepeatEvent(15000);
                    break;
                case EVENT_SPELL_SONIC_SHOCK:
                    me->CastSpell(me->GetVictim(), SPELL_SONIC_SHOCK, false);
                    events.RepeatEvent(urand(10000, 20000));
                    break;
            }

            if (!me->isAttackReady())
                return;

            if (!me->IsWithinMeleeRange(me->GetVictim()))
            {
                ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
                for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
                    if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
                        if (target->IsAlive() && me->IsWithinMeleeRange(target))
                        {
                            me->TauntApply(target);
                            break;
                        }
            }

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

示例15: UpdateAI

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

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

			switch (events.GetEvent())
			{
				case EVENT_YMIRON_HEALTH_CHECK:
				{
					if (me->GetHealth() < std::max(0.0f, float(me->GetMaxHealth()*(1.0f-(IsHeroic() ? 0.2f : 0.334f)*float(BoatNum+1)))))
					{
						events.DelayEvents(12000);
						me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
						me->InterruptNonMeleeSpells(true);
						me->CastSpell(me, SPELL_SCREAMS_OF_THE_DEAD, true);
						me->GetMotionMaster()->Clear();
						me->GetMotionMaster()->MovePoint(0, BoatStructure[BoatOrder[BoatNum]].MoveX, BoatStructure[BoatOrder[BoatNum]].MoveY, BoatStructure[BoatOrder[BoatNum]].MoveZ);
						me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
						summons.DespawnAll();

						// Spawn flames in previous boat if any
						if (BoatNum) // different than 0
							if (Creature *cr = me->SummonTrigger(BoatStructure[BoatOrder[BoatNum-1]].SpawnX, BoatStructure[BoatOrder[BoatNum-1]].SpawnY, BoatStructure[BoatOrder[BoatNum-1]].SpawnZ, 0, 1800000))
							{
								cr->AddAura(SPELL_FLAMES, cr);
								summons2.Summon(cr);
							}

						BoatNum++;
					}

					events.RepeatEvent(1000);
					break;
				}
				case EVENT_YMIRON_BANE:
				{
					me->CastSpell(me, IsHeroic() ? SPELL_BANE_H : SPELL_BANE_N, false);
					events.RepeatEvent(20000+rand()%5000);
					break;
				}
				case EVENT_YMIRON_FETID_ROT:
				{
					me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_FETID_ROT_H : SPELL_FETID_ROT_N, false);
					events.RepeatEvent(10000+rand()%3000);
					break;
				}
				case EVENT_YMIRON_DARK_SLASH:
				{
					int32 dmg = me->GetVictim()->GetHealth() / 2;
					me->CastCustomSpell(me->GetVictim(), SPELL_DARK_SLASH, &dmg, 0, 0, false);
					events.RepeatEvent(30000+rand()%5000);
					break;
				}
				case EVENT_YMIRON_ACTIVATE_BOAT:
				{
					// Spawn it!
					if (Creature* king = me->SummonCreature(BoatStructure[BoatOrder[BoatNum-1]].npc, BoatStructure[BoatOrder[BoatNum-1]].SpawnX, BoatStructure[BoatOrder[BoatNum-1]].SpawnY, BoatStructure[BoatOrder[BoatNum-1]].SpawnZ, BoatStructure[BoatOrder[BoatNum-1]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0))
					{
						me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
						king->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true);
						summons.Summon(king);
						king->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
						king->SetDisableGravity(true);
						me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
						me->GetMotionMaster()->MoveChase(me->GetVictim());
						switch(BoatOrder[BoatNum-1])
						{
							case 0: events.ScheduleEvent(EVENT_YMIRON_RANULF_ABILITY, 3000, 1); break;
							case 1: events.ScheduleEvent(EVENT_YMIRON_TORGYN_ABILITY, 3000, 1); break;
							case 2: events.ScheduleEvent(EVENT_YMIRON_BJORN_ABILITY, 3000, 1); break;
							case 3: events.ScheduleEvent(EVENT_YMIRON_HALDOR_ABILITY, 3000, 1); break;
						}
					}

					events.PopEvent();
					break;
				}
				case EVENT_YMIRON_BJORN_ABILITY:
				{
					if (Creature* sf = me->SummonCreature(NPC_SPIRIT_FOUNT, 385+rand()%10, -330+rand()%10, 104.756f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000))
					{
						summons.Summon(sf);
						sf->SetSpeed(MOVE_RUN, 0.4f);
						sf->AddAura(IsHeroic() ? SPELL_SPIRIT_FOUNT_H : SPELL_SPIRIT_FOUNT_N, sf);
						sf->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
						sf->GetMotionMaster()->MoveFollow(me->GetVictim(), 0, rand_norm()*M_PI*2);
					}
					events.PopEvent();
					break;
				}
				case EVENT_YMIRON_HALDOR_ABILITY:
				{
					me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SPIRIT_STRIKE_H : SPELL_SPIRIT_STRIKE_N, false);
					events.RepeatEvent(5000);
					break;
				}
//.........这里部分代码省略.........
开发者ID:DSlayerMan,项目名称:Sunwell,代码行数:101,代码来源:boss_ymiron.cpp


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