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


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

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


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

示例1: UpdateAI

        void UpdateAI(uint32 diff)
        {
			if (talkTimer)
			{
				talkTimer += diff;
				if (talkTimer >= 1000 && talkTimer < 10000)
				{
					Talk(SAY_ANZU_INTRO1);
					talkTimer = 10000;
				}
				else if (talkTimer >= 16000)
				{
					me->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
					me->RemoveAurasDueToSpell(SPELL_SHADOWFORM);
					Talk(SAY_ANZU_INTRO2);
					talkTimer = 0;
				}
			}

            if (!UpdateVictim())
                return;

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

			switch (events.GetEvent())
			{
				case EVENT_SPELL_SCREECH:
					me->CastSpell(me, SPELL_PARALYZING_SCREECH, false);
					events.RepeatEvent(23000);
					events.DelayEvents(3000);
					break;
				case EVENT_SPELL_BOMB:
					if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
						me->CastSpell(target, SPELL_SPELL_BOMB, false);
					events.RepeatEvent(urand(16000, 24500));
					events.DelayEvents(3000);
					break;
				case EVENT_SPELL_CYCLONE:
					if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 45.0f, true))
						me->CastSpell(target, SPELL_CYCLONE, false);
					events.RepeatEvent(urand(22000, 27000));
					events.DelayEvents(3000);
					break;
				case EVENT_ANZU_HEALTH1:
					if (me->HealthBelowPct(66))
					{
						SummonBroods();
						events.PopEvent();
						events.DelayEvents(10000);
						return;
					}
					events.RepeatEvent(1000);
					break;
				case EVENT_ANZU_HEALTH2:
					if (me->HealthBelowPct(33))
					{
						SummonBroods();
						events.PopEvent();
						events.DelayEvents(10000);
						return;
					}
					events.RepeatEvent(1000);
					break;
            }

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

示例2: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
            
            events.Update(diff);
        
            if (me->hasUnitState(UNIT_STAT_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_MOVE_POS:
                        MovePos();
                        events.RescheduleEvent(EVENT_MOVE_POS, 10000);
                    break;        
                    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, SPELL_CHAIN_LIGHTNING);
                        events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(4000, 6000));
                    break;
                    case EVENT_OVERLOAD:
                        me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true);
                        DoScriptText(SAY_BRUNDIR_SPECIAL, me);
                        me->GetMotionMaster()->Clear(true);
                        DoCast(SPELL_OVERLOAD);
                        events.ScheduleEvent(EVENT_OVERLOAD, urand(60000, 120000));
                    break;
                    case EVENT_LIGHTNING_WHIRL:
                        me->GetMotionMaster()->Clear(true);
                        DoCast(SPELL_LIGHTNING_WHIRL);
                        events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(15000, 20000));
                    break;
                    case EVENT_LIGHTNING_TENDRILS:
                        DoScriptText(SAY_BRUNDIR_FLIGHT, me);
                        DoCast(SPELL_LIGHTNING_TENDRILS);
                        me->AttackStop();
                        me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
                        DoCast(SPELL_LIGHTNING_TENDRILS_SELF_VISUAL);
                        me->GetMotionMaster()->Clear(true);
                        me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), 440);
                        events.DelayEvents(35000);
                        events.ScheduleEvent(EVENT_FLIGHT, 2500);
                        events.ScheduleEvent(EVENT_ENDFLIGHT, 28000);
                        events.ScheduleEvent(EVENT_LIGHTNING_TENDRILS, 90000);
                    break;
                    case EVENT_FLIGHT:
                        if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                            me->GetMotionMaster()->MovePoint(0, pTarget->GetPositionX(), pTarget->GetPositionY(), 440);
                        events.ScheduleEvent(EVENT_FLIGHT, 6000);
                    break;
                    case EVENT_ENDFLIGHT:
                        me->GetMotionMaster()->Clear(true);
                        me->GetMotionMaster()->MovePoint(0, 1586.920166, 119.848984, 440);
                        events.CancelEvent(EVENT_FLIGHT);
                        events.CancelEvent(EVENT_ENDFLIGHT);
                        events.ScheduleEvent(EVENT_LAND, 4000);
                    break;
                    case EVENT_LAND:
                        me->GetMotionMaster()->Clear(true);
                        me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), 427.28);
                        events.CancelEvent(EVENT_LAND);
                        events.ScheduleEvent(EVENT_GROUND, 2500);
                    break;
                    case EVENT_GROUND:
                        me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
                        me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS);
                        me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_SELF_VISUAL);
                        events.CancelEvent(EVENT_GROUND);
                    break;
                }
            }
        }
开发者ID:InkVisible,项目名称:wow,代码行数:79,代码来源:boss_assembly_of_iron.cpp

示例3: KilledUnit

 void KilledUnit(Unit* /*victim*/)
 {
     Talk(SAY_SLAY);
     events.DelayEvents(5000, GCD_YELL);
 }
开发者ID:AwkwardDev,项目名称:WoWSource434,代码行数:5,代码来源:boss_warlord_najentus.cpp

示例4: UpdateAI

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

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

            events.Update(diff);

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

            switch(events.GetEvent())
            {
                case 0:
                    break;
                case EVENT_SPELL_TOXIC_WASTE:
                    if (Creature* k = GetKrick())
                        if (!k->HasUnitState(UNIT_STATE_CASTING))
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true))
                            {
                                k->CastSpell(target, SPELL_TOXIC_WASTE);
                                events.RepeatEvent(urand(7000,10000));
                                break;
                            }
                    events.RepeatEvent(2500);
                    break;
                case EVENT_SPELL_MIGHTY_KICK:
                    me->CastSpell(me->GetVictim(), SPELL_MIGHTY_KICK, false);
                    events.RepeatEvent(urand(20000,25000));
                    break;
                case EVENT_SPELL_SHADOW_BOLT:
                    if (Creature* k = GetKrick())
                        if (!k->HasUnitState(UNIT_STATE_CASTING))
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true))
                            {
                                k->CastSpell(target, SPELL_SHADOW_BOLT);
                                events.RepeatEvent(14000);
                                break;
                            }
                    events.RepeatEvent(2500);
                    break;
                case EVENT_SET_REACT_AGGRESSIVE:
                    me->SetReactState(REACT_AGGRESSIVE);
                    if (!UpdateVictim())
                        return;
                    events.PopEvent();
                    break;
                case EVENT_SPECIAL:
                    switch(urand(0,2))
                    {
                        case 0: // Pursuit
                            if (Creature* k = GetKrick())
                                k->AI()->Talk(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3));
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 70.0f, true))
                                me->CastSpell(target, SPELL_PURSUIT, false);
                            break;
                        case 1: // Poison Nova
                            if (Creature* k = GetKrick())
                            {
                                k->AI()->Talk(SAY_ORDER_BLOW);
                                Talk(EMOTE_ICK_POISON);
                            }
                            me->CastSpell(me, SPELL_POISON_NOVA, false);
                            break;
                        case 2: // Explosive Barrage
                            if (Creature* k = GetKrick())
                            {
                                k->AI()->Talk(SAY_ORDER_STOP);
                                k->AI()->Talk(EMOTE_KRICK_MINES);
                                k->InterruptNonMeleeSpells(false);
                                me->InterruptNonMeleeSpells(false);
                                k->CastSpell(k, SPELL_EXPLOSIVE_BARRAGE_KRICK, false);
                                me->CastSpell(me, SPELL_EXPLOSIVE_BARRAGE_ICK, false);
                            }
                            events.DelayEvents(20000);
                            break;
                    }
                    events.RepeatEvent(urand(25000,30000));
                    break;
            }

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

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

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

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

示例8: KilledUnit

 void KilledUnit(Unit* /*victim*/)
 {
     DoScriptText(urand(0, 1) ? SAY_SLAY1 : SAY_SLAY2, me);
     events.DelayEvents(5000, GCD_YELL);
 }
开发者ID:4m1g0,项目名称:TrinityCore,代码行数:5,代码来源:boss_warlord_najentus.cpp

示例9: UpdateAI

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

        events.Update(diff);

        if (me->hasUnitState(UNIT_STAT_CASTING))
            return;

        while (uint32 eventId = events.ExecuteEvent())
        {
            switch(eventId)
            {
                case EVENT_PHANTOM_BLAST:
                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0))
                        DoCast(pTarget, SPELL_PHANTOM_BLAST);
                    events.ScheduleEvent(EVENT_PHANTOM_BLAST, 5000);
                    break;
                case EVENT_MIRRORED_SOUL:
                    if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
                    {
                        uiMirroredSoulTarget = pTarget->GetGUID();
                        DoCast(pTarget, SPELL_MIRRORED_SOUL);
                        DoScriptText(EMOTE_MIRRORED_SOUL, me);
                    }
                    events.ScheduleEvent(EVENT_MIRRORED_SOUL, urand(15000,30000));
                    break;
                case EVENT_WELL_OF_SOULS:
                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                        DoCast(pTarget, SPELL_WELL_OF_SOULS);
                    events.ScheduleEvent(EVENT_WELL_OF_SOULS, 20000);
                    break;
                case EVENT_UNLEASHED_SOULS:
                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                        DoCast(pTarget, SPELL_UNLEASHED_SOULS);
                    me->SetDisplayId(DISPLAY_SORROW);
                    DoScriptText(RAND(SAY_FACE_ANGER_UNLEASH_SOUL,SAY_FACE_SORROW_UNLEASH_SOUL,SAY_FACE_DESIRE_UNLEASH_SOUL), me);
                    DoScriptText(EMOTE_UNLEASH_SOUL, me);
                    events.ScheduleEvent(EVENT_UNLEASHED_SOULS, 30000);
                    events.ScheduleEvent(EVENT_FACE_ANGER, 5000);
                    break;
                case EVENT_FACE_ANGER:
                    me->SetDisplayId(DISPLAY_ANGER);
                    break;

                case EVENT_WAILING_SOULS:
                    me->SetDisplayId(DISPLAY_DESIRE);
                    DoScriptText(RAND(SAY_FACE_ANGER_WAILING_SOUL,SAY_FACE_DESIRE_WAILING_SOUL), me);
                    DoScriptText(EMOTE_WAILING_SOUL, me);
                    DoCast(me, SPELL_WAILING_SOULS_STARTING);

                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                    {
                        me->SetOrientation(me->GetAngle(pTarget));
                        DoCast(me, SPELL_WAILING_SOULS_BEAM);
                    }

                    beamAngle = me->GetOrientation();

                    beamAngleDiff = PI/30.0f; // PI/2 in 15 sec = PI/30 per tick
                    if (RAND(true,false))
                        beamAngleDiff = -beamAngleDiff;

                    me->InterruptNonMeleeSpells(false);
                    me->SetReactState(REACT_PASSIVE);

                    //Remove any target
                    me->SetUInt64Value(UNIT_FIELD_TARGET, 0);

                    me->GetMotionMaster()->Clear();
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);

                    wailingSoulTick = 15;
                    events.DelayEvents(18000); // no other events during wailing souls
                    events.ScheduleEvent(EVENT_WAILING_SOULS_TICK, 3000); // first one after 3 secs.
                    break;

                case EVENT_WAILING_SOULS_TICK:
                    beamAngle += beamAngleDiff;
                    me->SetOrientation(beamAngle);
                    me->StopMoving();

                    DoCast(me, SPELL_WAILING_SOULS);

                    if (--wailingSoulTick)
                        events.ScheduleEvent(EVENT_WAILING_SOULS_TICK, 1000);
                    else
                    {
                        me->SetReactState(REACT_AGGRESSIVE);
                        me->SetDisplayId(DISPLAY_ANGER);
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
                        me->GetMotionMaster()->MoveChase(me->getVictim());
                        events.ScheduleEvent(EVENT_WAILING_SOULS, urand(60000,70000));
                    }
                    break;
            }
        }

//.........这里部分代码省略.........
开发者ID:GameOn,项目名称:gameon,代码行数:101,代码来源:boss_devourer_of_souls.cpp

示例10: UpdateAI


//.........这里部分代码省略.........
					break;
				}
				case EVENT_SVALA_TALK5:
					Talk(TALK_INTRO_S2);
					events2.ScheduleEvent(EVENT_SVALA_TALK6, 12000);
					break;
				case EVENT_SVALA_TALK6:
					if (Creature *Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID))
						Arthas->AI()->Talk(TALK_INTRO_A2);
					events2.ScheduleEvent(EVENT_SVALA_TALK7, 9000);
					break;
				case EVENT_SVALA_TALK7:
					me->SetFacingTo(M_PI/2.0f);
					Talk(TALK_INTRO_S3);
					if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_SVALA_MIRROR)))
						mirror->SetGoState(GO_STATE_ACTIVE);
					events2.ScheduleEvent(EVENT_SVALA_TALK8, 13000);
					break;
				case EVENT_SVALA_TALK8:
					me->GetMotionMaster()->MoveFall(0, true);
					events2.ScheduleEvent(EVENT_SVALA_TALK9, 2000);
					break;
				case EVENT_SVALA_TALK9:
					me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 3.0f);
					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
					me->LoadEquipment(1, true);
					me->setActive(false);
					if (Player* target = SelectTargetFromPlayerList(100.0f))
						AttackStart(target);
					return;
			}

			if (!UpdateVictim())
				return;

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

			switch (events.ExecuteEvent())
			{
				case EVENT_SORROWGRAVE_SS:
					me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SINSTER_STRIKE_H : SPELL_SINSTER_STRIKE_N, false);
					events.ScheduleEvent(EVENT_SORROWGRAVE_SS, urand(3000, 5000));
					break;
				case EVENT_SORROWGRAVE_FLAMES:
					summons.DespawnAll();
					me->CastSpell(me, SPELL_CALL_FLAMES, false);
					events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES2, 500);
					events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES2, 1000);
					events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES, urand(8000, 12000));
					break;
				case EVENT_SORROWGRAVE_FLAMES2:
				{
					std::list<Creature*> braziers;
					me->GetCreaturesWithEntryInRange(braziers, 100.0f, NPC_FLAME_BRAZIER);
					if (!braziers.empty())
					{
						for (std::list<Creature*>::const_iterator itr = braziers.begin(); itr != braziers.end(); ++itr)
							(*itr)->CastCustomSpell(SPELL_BALL_OF_FLAME, SPELLVALUE_MAX_TARGETS, 1, (*itr), true);
					}
					break;
				}
				case EVENT_SORROWGRAVE_RITUAL:
					if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
            		{
						Talk(SAY_SACRIFICE_PLAYER);

						for (uint8 i = 0; i < 3; ++i)
							if (Creature* cr = me->SummonCreature(NPC_RITUAL_CHANNELER, RitualChannelerLoc[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000))
								cr->AI()->AttackStart(target);

						me->GetMotionMaster()->MoveIdle();
						DoTeleportPlayer(target, 296.632f, -346.075f, 90.63f, 4.6f);
						me->NearTeleportTo(296.632f, -346.075f, 110.0f, 4.6f, false);
						me->SetControlled(true, UNIT_STATE_ROOT);
						me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
						me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
						me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
					}

					events.DelayEvents(25001); // +1 just to be sure
					events.ScheduleEvent(EVENT_SORROWGRAVE_RITUAL_SPELLS, 0);
					events.ScheduleEvent(EVENT_SORROWGRAVE_FINISH_RITUAL, 25000);
					return;
				case EVENT_SORROWGRAVE_RITUAL_SPELLS:
					//me->CastSpell(me, SPELL_RITUAL_OF_THE_SWORD, false);
					me->CastSpell(me, SPELL_RITUAL_STRIKE, true);
					return;
				case EVENT_SORROWGRAVE_FINISH_RITUAL:
					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
					me->SetControlled(false, UNIT_STATE_ROOT);
					AttackStart(me->GetVictim());
					me->GetMotionMaster()->MoveFall(0, true);
					summons.DespawnAll();
					break;
			}

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

示例11: KilledUnit

 void KilledUnit(Unit *victim)
 {
     DoScriptText(rand()%2 ? SAY_SLAY1 : SAY_SLAY2, m_creature);
     events.DelayEvents(5000, GCD_YELL);
 }
开发者ID:Elevim,项目名称:RG-332,代码行数:5,代码来源:boss_warlord_najentus.cpp

示例12: UpdateAI

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

            events.Update(diff);
            switch (events.GetEvent())
            {
                case EVENT_CHECK:
                    float x, y, z, o;
                    me->GetHomePosition(x, y, z, o);
                    if (!me->IsWithinDist3d(x, y, z, 60))
                    {
                        EnterEvadeMode();
                        return;
                    }
                    events.RepeatEvent(5000);
                    break;
                case EVENT_SPELL_SPORES:
                    me->CastSpell(me, SPELL_SUMMON_SPORE_STRIDER, false);
                    events.RepeatEvent(urand(10000, 15000));
                    break;
                case EVENT_SPELL_CHAIN:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false);
                    events.DelayEvents(3000);
                    events.RepeatEvent(9000);
                    break;
                case EVENT_SPELL_STATIC:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true))
                        me->CastSpell(target, SPELL_STATIC_CHARGE, false);
                    events.RepeatEvent(10000);
                    break;
                case EVENT_LEVITATE:
                    events.RepeatEvent(15000);
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                    {
                        me->CastSpell(target, SPELL_LEVITATE, false);
                        lTarget = target->GetGUID();
                        events.DelayEvents(5000);
                        events.ScheduleEvent(EVENT_LEVITATE_TARGET_1, 2000);
                    }
                    break;
                case EVENT_LEVITATE_TARGET_1:
                    if (Unit* target = ObjectAccessor::GetUnit(*me, lTarget))
                    {
                        if (!target->HasAura(SPELL_LEVITATE))
                            lTarget = 0;
                        else
                        {
                            target->CastSpell(target, SPELL_MAGNETIC_PULL, true);
                            events.ScheduleEvent(EVENT_LEVITATE_TARGET_2, 1500);
                        }
                    }
                    events.PopEvent();
                    break;
                case EVENT_LEVITATE_TARGET_2:
                    if (Unit* target = ObjectAccessor::GetUnit(*me, lTarget))
                    {
                        if (!target->HasAura(SPELL_LEVITATE))
                            lTarget = 0;
                        else
                        {
                            target->AddAura(SPELL_SUSPENSION, target);
                            lTarget = 0;
                        }
                    }
                    events.PopEvent();
                    break;
            }

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

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

示例14: UpdateAI

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

            if (!me->getVictim() && me->getThreatManager().isThreatListEmpty())
            {
                EnterEvadeMode();
                return;
            }

            events.Update(diff);

            if (me->hasUnitState(UNIT_STAT_CASTING))
                return;

            switch(events.ExecuteEvent())
            {
                case EVENT_PURSUE:
                    if (Creature* pKrick = GetKrick())
                        DoScriptText(RAND(SAY_KRICK_CHASE_1,SAY_KRICK_CHASE_2,SAY_KRICK_CHASE_3), pKrick);

                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                    {
                        me->Attack(pTarget,false);
                        DoScriptText(SAY_ICK_CHASE_1, me, pTarget);
                        DoCast(pTarget, SPELL_PURSUED);
                    }

                    DoCast(SPELL_CONFUSION);
                    events.ScheduleEvent(EVENT_PURSUE, 30000, GCD_1);
                    return;

                case EVENT_MIGHTY_KICK:
                    DoCast(me->getVictim(), SPELL_MIGHTY_KICK);
                    events.ScheduleEvent(EVENT_MIGHTY_KICK, 25000, GCD_1);
                    return;

                case EVENT_POISON_NOVA:
                    if (Creature* pKrick = GetKrick())
                        DoScriptText(SAY_KRICK_POISON_NOVA, pKrick);

                    DoScriptText(SAY_ICK_POISON_NOVA, me);
                    DoCastAOE(SPELL_POISON_NOVA);
                    events.ScheduleEvent(EVENT_POISON_NOVA, 30000, GCD_1);
                    return;

                case EVENT_TOXIC_WASTE:
                    DoCast(me->getVictim(), SPELL_TOXIC_WASTE);
                    events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000);
                    return;

                case EVENT_SHADOW_BOLT:
                    DoCast(me->getVictim(), SPELL_SHADOW_BOLT);
                    events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000);
                    return;

                case EVENT_EXPLOSIVE_BARRAGE:
                    if (Creature *pKrick = GetKrick())
                    {
                        DoScriptText(SAY_KRICK_BARRAGE_1, pKrick);
                        DoScriptText(SAY_KRICK_BARRAGE_2, pKrick);
                    }

                    DoCastAOE(SPELL_EXPLOSIVE_BARRAGE);
                    me->GetMotionMaster()->MoveIdle();
                    events.DelayEvents(20000, GCD_1); // 2 sec cast + 18 sec
                    events.ScheduleEvent(EVENT_END_EXPLOSIVE_BARRAGE, 20000);
                    return;

                case EVENT_END_EXPLOSIVE_BARRAGE:
                    me->GetMotionMaster()->Clear();
                    me->GetMotionMaster()->MoveChase(me->getVictim());
                    events.ScheduleEvent(EVENT_EXPLOSIVE_BARRAGE, 25000);
                    break;
            }

            DoMeleeAttackIfReady();
        }
开发者ID:Bootz,项目名称:S6.RO.WoW,代码行数:79,代码来源:boss_krickandick.cpp

示例15: UpdateAI

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

				events.Update(diff);
				switch (events.ExecuteEvent())
				{
					case EVENT_SMITE_SLAM:
						me->CastSpell(me->GetVictim(), SPELL_SMITE_SLAM, false);
						events.ScheduleEvent(EVENT_SMITE_SLAM, 15000);
						break;
					case EVENT_CHECK_HEALTH1:
						if (me->HealthBelowPct(67))
						{
							me->CastSpell(me, SPELL_SMITE_STOMP, false);
							events.DelayEvents(10000);
							me->GetMotionMaster()->Clear();
							me->GetMotionMaster()->MovePoint(EQUIP_TWO_SWORDS, 1.859f, -780.72f, 9.831f);
							Talk(SAY_SWAP1);
							me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
							me->SetReactState(REACT_PASSIVE);
							break;
						}
						events.ScheduleEvent(EVENT_CHECK_HEALTH1, 500);
						break;
					case EVENT_CHECK_HEALTH2:
						if (me->HealthBelowPct(34))
						{
							me->CastSpell(me, SPELL_SMITE_STOMP, false);
							events.DelayEvents(10000);
							me->GetMotionMaster()->Clear();
							me->GetMotionMaster()->MovePoint(EQUIP_MACE, 1.859f, -780.72f, 9.831f);
							Talk(SAY_SWAP2);
							me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
							me->SetReactState(REACT_PASSIVE);
							break;
						}
						events.ScheduleEvent(EVENT_CHECK_HEALTH2, 500);
						break;
					case EVENT_SWAP_WEAPON1:
						me->LoadEquipment(EQUIP_TWO_SWORDS);
						me->SetCanDualWield(true);
						break;
					case EVENT_SWAP_WEAPON2:
						me->LoadEquipment(EQUIP_MACE);
						me->SetCanDualWield(false);
						break;
					case EVENT_RESTORE_COMBAT:
						me->SetReactState(REACT_AGGRESSIVE);
						me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
						me->SetStandState(UNIT_STAND_STATE_STAND);
						if (me->GetVictim())
						{
							me->GetMotionMaster()->MoveChase(me->GetVictim());
							me->SetTarget(me->GetVictim()->GetGUID());
						}
						break;
					case EVENT_KNEEL:
						me->SendMeleeAttackStop(me->GetVictim());
						me->SetStandState(UNIT_STAND_STATE_KNEEL);
						break;
				}

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


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