• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ randtime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中randtime函数的典型用法代码示例。如果您正苦于以下问题:C++ randtime函数的具体用法?C++ randtime怎么用?C++ randtime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: UpdateAI

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

                _events.Update(diff);

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

                while (uint32 eventId = _events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_CLEAVE:
                            DoCastVictim(SPELL_CLEAVE);
                            _events.Repeat(randtime(Seconds(10), Seconds(16)));
                            break;
                        case EVENT_STRIKE:
                            DoCastVictim(SPELL_STRIKE);
                            _events.Repeat(randtime(Seconds(15), Seconds(19)));
                            break;
                        default:
                            break;
                    }

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

                DoMeleeAttackIfReady();
            }
开发者ID:Declipe,项目名称:ElunaTrinityWotlk,代码行数:32,代码来源:boss_krikthir_the_gatewatcher.cpp


示例2: EnterCombat

        void EnterCombat(Unit* who) override
        {
            BossAI::EnterCombat(who);

            if (GameObject* door = instance->GetGameObject(DATA_ANUBARAK_WALL))
                door->SetGoState(GO_STATE_ACTIVE); // open door for now

            Talk(SAY_AGGRO);
            instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOTTA_GO_START_EVENT);

            events.SetPhase(PHASE_EMERGE);
            events.ScheduleEvent(EVENT_CLOSE_DOOR, Seconds(5));
            events.ScheduleEvent(EVENT_POUND, randtime(Seconds(2), Seconds(4)), 0, PHASE_EMERGE);
            events.ScheduleEvent(EVENT_LEECHING_SWARM, randtime(Seconds(5), Seconds(7)), 0, PHASE_EMERGE);
            events.ScheduleEvent(EVENT_CARRION_BEETLES, randtime(Seconds(14), Seconds(17)), 0, PHASE_EMERGE);

            // set up world triggers
            std::list<TempSummon*> summoned;
            me->SummonCreatureGroup(SUMMON_GROUP_WORLD_TRIGGER_GUARDIAN, &summoned);
            if (summoned.empty()) // something went wrong
            {
                EnterEvadeMode(EVADE_REASON_OTHER);
                return;
            }
            _guardianTrigger = (*summoned.begin())->GetGUID();
            
            if (Creature* trigger = DoSummon(NPC_WORLD_TRIGGER, me->GetPosition(), 0u, TEMPSUMMON_MANUAL_DESPAWN))
                _assassinTrigger = trigger->GetGUID();
            else
            {
                EnterEvadeMode(EVADE_REASON_OTHER);
                return;
            }
        }
开发者ID:Declipe,项目名称:ElunaTrinityWotlk,代码行数:34,代码来源:boss_anubarak.cpp


示例3: DoAction

 void DoAction(int32 action) override
 {
     switch (action)
     {
         case ACTION_PET_DIED:
             if (!_petCount) // underflow check - something has gone horribly wrong
             {
                 EnterEvadeMode(EVADE_REASON_OTHER);
                 return;
             }
             if (!--_petCount) // last pet died, emerge
             {
                 me->RemoveAurasDueToSpell(SPELL_SUBMERGE);
                 me->RemoveAurasDueToSpell(SPELL_IMPALE_AURA);
                 me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
                 DoCastSelf(SPELL_EMERGE);
                 events.SetPhase(PHASE_EMERGE);
                 events.ScheduleEvent(EVENT_POUND, randtime(Seconds(13), Seconds(18)), 0, PHASE_EMERGE);
                 events.ScheduleEvent(EVENT_LEECHING_SWARM, randtime(Seconds(3), Seconds(7)), 0, PHASE_EMERGE);
                 events.ScheduleEvent(EVENT_CARRION_BEETLES, randtime(Seconds(10), Seconds(15)), 0, PHASE_EMERGE);
             }
             break;
         case ACTION_PET_EVADE:
             EnterEvadeMode(EVADE_REASON_OTHER);
             break;
     }
 }
开发者ID:Declipe,项目名称:ElunaTrinityWotlk,代码行数:27,代码来源:boss_anubarak.cpp


示例4: UpdateAI

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

            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_IMPALE:
                        if (events.GetTimeUntilEvent(EVENT_LOCUST) < 5 * IN_MILLISECONDS) break; // don't chain impale tank -> locust swarm
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            DoCast(target, SPELL_IMPALE);
                        else
                            EnterEvadeMode();

                        events.Repeat(randtime(Seconds(10), Seconds(20)));
                        break;
                    case EVENT_SCARABS:
                        if (!guardCorpses.empty())
                        {
                            if (ObjectGuid target = Trinity::Containers::SelectRandomContainerElement(guardCorpses))
                                if (Creature* creatureTarget = ObjectAccessor::GetCreature(*me, target))
                                {
                                    creatureTarget->CastSpell(creatureTarget, SPELL_SUMMON_CORPSE_SCARABS_MOB, me->GetGUID());
                                    creatureTarget->AI()->Talk(EMOTE_SCARAB);
                                    creatureTarget->DespawnOrUnsummon();
                                }
                        }
                        events.Repeat(randtime(Seconds(40), Seconds(60)));
                        break;
                    case EVENT_LOCUST:
                        Talk(EMOTE_LOCUST);
                        events.SetPhase(PHASE_SWARM);
                        DoCast(me, SPELL_LOCUST_SWARM);

                        events.ScheduleEvent(EVENT_SPAWN_GUARD, 3s);
                        events.ScheduleEvent(EVENT_LOCUST_ENDS, RAID_MODE(Seconds(19), Seconds(23)));
                        events.Repeat(Minutes(1)+Seconds(30));
                        break;
                    case EVENT_LOCUST_ENDS:
                        events.SetPhase(PHASE_NORMAL);
                        events.ScheduleEvent(EVENT_IMPALE, randtime(Seconds(10), Seconds(20)), 0, PHASE_NORMAL);
                        events.ScheduleEvent(EVENT_SCARABS, randtime(Seconds(20), Seconds(30)), 0, PHASE_NORMAL);
                        break;
                    case EVENT_SPAWN_GUARD:
                        me->SummonCreatureGroup(GROUP_SINGLE_SPAWN);
                        break;
                    case EVENT_BERSERK:
                        DoCast(me, SPELL_BERSERK, true);
                        events.ScheduleEvent(EVENT_BERSERK, 10min);
                        break;
                }
            }

            if (events.IsInPhase(PHASE_NORMAL))
                DoMeleeAttackIfReady();
        }
开发者ID:ElunaLuaEngine,项目名称:ElunaTrinityWotlk,代码行数:60,代码来源:boss_anubrekhan.cpp


示例5: EnterCombat

        void EnterCombat(Unit* /*who*/) override
        {
            _EnterCombat();
            Talk(SAY_AGGRO);

            _safeSection = 0;
            events.ScheduleEvent(EVENT_DISRUPT, randtime(Seconds(15), Seconds(20)), 0, PHASE_FIGHT);
            events.ScheduleEvent(EVENT_FEVER, randtime(Seconds(10), Seconds(20)), 0, PHASE_FIGHT);
            events.ScheduleEvent(EVENT_DANCE, Minutes(1) + Seconds(30), 0, PHASE_FIGHT);
            events.ScheduleEvent(EVENT_ERUPT, Seconds(15));

            _safetyDance = true;

            // figure out the current GUIDs of our eruption tiles and which segment they belong in
            std::unordered_multimap<uint32, GameObject*> const& mapGOs = me->GetMap()->GetGameObjectBySpawnIdStore();
            uint32 spawnId = firstEruptionDBGUID;
            for (uint8 section = 0; section < numSections; ++section)
            {
                _eruptTiles[section].clear();
                for (uint8 i = 0; i < numEruptions[section]; ++i)
                {
                    auto tileIt = mapGOs.equal_range(spawnId++);
                    for (auto it = tileIt.first; it != tileIt.second; ++it)
                        _eruptTiles[section].push_back(it->second->GetGUID());
                }
            }
        }
开发者ID:kemlg,项目名称:trinitycore-conciens,代码行数:27,代码来源:boss_heigan.cpp


示例6: EnterCombat

 void EnterCombat(Unit* /*who*/) override
 {
     _EnterCombat();
     Talk(SAY_AGGRO);
     summons.DoZoneInCombat();
     events.ScheduleEvent(EVENT_POISON, randtime(Seconds(10), Seconds(15)));
     events.ScheduleEvent(EVENT_FIRE, randtime(Seconds(6), Seconds(18)));
     events.ScheduleEvent(EVENT_FRENZY, Minutes(1)+randtime(Seconds(0), Seconds(20)));
 }
开发者ID:DanielBallaSZTE,项目名称:TrinityCorePreWOTLK,代码行数:9,代码来源:boss_faerlina.cpp


示例7: JustEngagedWith

 void JustEngagedWith(Unit* /*who*/) override
 {
     _JustEngagedWith();
     events.ScheduleEvent(EVENT_WRAP, Seconds(20));
     events.ScheduleEvent(EVENT_SPRAY, Seconds(40));
     events.ScheduleEvent(EVENT_SHOCK, randtime(Seconds(5), Seconds(10)));
     events.ScheduleEvent(EVENT_POISON, randtime(Seconds(10), Seconds(15)));
     events.ScheduleEvent(EVENT_SUMMON, Seconds(30));
 }
开发者ID:Refuge89,项目名称:TrinityCore,代码行数:9,代码来源:boss_maexxna.cpp


示例8: EnterCombat

 void EnterCombat(Unit* /*who*/) override
 {
     _EnterCombat();
     events.ScheduleEvent(EVENT_WRAP, Seconds(20));
     events.ScheduleEvent(EVENT_SPRAY, Seconds(40));
     events.ScheduleEvent(EVENT_SHOCK, randtime(Seconds(5), Seconds(10)));
     events.ScheduleEvent(EVENT_POISON, randtime(Seconds(10), Seconds(15)));
     events.ScheduleEvent(EVENT_SUMMON, Seconds(30));
 }
开发者ID:090809,项目名称:TrinityCore,代码行数:9,代码来源:boss_maexxna.cpp


示例9: EnterPhaseGround

 void EnterPhaseGround(bool initial)
 {
     me->SetReactState(REACT_AGGRESSIVE);
     events.ScheduleEvent(EVENT_CLEAVE, randtime(Seconds(5), Seconds(15)), 0, PHASE_GROUND);
     events.ScheduleEvent(EVENT_TAIL, randtime(Seconds(7), Seconds(10)), 0, PHASE_GROUND);
     events.ScheduleEvent(EVENT_BLIZZARD, randtime(Seconds(5), Seconds(10)), 0, PHASE_GROUND);
     if (initial)
     {
         events.ScheduleEvent(EVENT_DRAIN, randtime(Seconds(22), Seconds(28)));
         events.ScheduleEvent(EVENT_FLIGHT, Seconds(48) + Milliseconds(500), 0, PHASE_GROUND);
     }
     else
         events.ScheduleEvent(EVENT_FLIGHT, Minutes(1), 0, PHASE_GROUND);
 }
开发者ID:Declipe,项目名称:ElunaTrinityWotlk,代码行数:14,代码来源:boss_sapphiron.cpp


示例10: _UpdateAI

            void _UpdateAI(uint32 diff) override
            {
                if (!_ourMovementFinished || !UpdateVictim())
                    return;
                events.Update(diff);

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BERSERK:
                            DoCastAOE(SPELL_BERSERK, true);
                            break;
                        case EVENT_MARK:
                            DoCastAOE(SPELL_THANE_MARK, true);
                            events.Repeat(Seconds(12));
                            break;
                        case EVENT_METEOR:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true))
                            {
                                DoCast(target, SPELL_METEOR);
                                _shouldSay = true;
                            }
                            events.Repeat(randtime(Seconds(13), Seconds(17)));
                            break;
                    }
                }

                if (me->HasUnitState(UNIT_STATE_CASTING))
                    return;
                DoMeleeAttackIfReady();
            }
开发者ID:DanielBallaSZTE,项目名称:TrinityCorePreWOTLK,代码行数:32,代码来源:boss_four_horsemen.cpp


示例11: EnterCombat

        void EnterCombat(Unit* /*who*/) override
        {
            _EnterCombat();
            Talk(SAY_AGGRO);

            summons.DoZoneInCombat();

            events.SetPhase(PHASE_NORMAL);
            events.ScheduleEvent(EVENT_IMPALE, randtime(Seconds(10), Seconds(20)), 0, PHASE_NORMAL);
            events.ScheduleEvent(EVENT_SCARABS, randtime(Seconds(20), Seconds(30)), 0, PHASE_NORMAL);
            events.ScheduleEvent(EVENT_LOCUST, Minutes(1)+randtime(Seconds(40), Seconds(60)), 0, PHASE_NORMAL);
            events.ScheduleEvent(EVENT_BERSERK, Minutes(10));

            if (!Is25ManRaid())
                events.ScheduleEvent(EVENT_SPAWN_GUARD, randtime(Seconds(15), Seconds(20)));
        }
开发者ID:090809,项目名称:TrinityCore,代码行数:16,代码来源:boss_anubrekhan.cpp


示例12: UpdateAI

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

            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_ATTACK:
                        SetCombatMovement(true);
                        if (Unit* victim = me->GetVictim())
                            me->GetMotionMaster()->MoveChase(victim);
                        break;
                    case EVENT_STRIKE:
                        DoCastVictim(SPELL_UNBALANCING_STRIKE);
                        events.Repeat(Seconds(6));
                        return;
                    case EVENT_SHOUT:
                        DoCastAOE(SPELL_DISRUPTING_SHOUT);
                        events.Repeat(Seconds(16));
                        return;
                    case EVENT_KNIFE:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f))
                            DoCast(target, SPELL_JAGGED_KNIFE);
                        events.Repeat(randtime(Seconds(10), Seconds(15)));
                        return;
                }
            }

            DoMeleeAttackIfReady();
        }
开发者ID:AvariusProject,项目名称:AvariusCore,代码行数:34,代码来源:boss_razuvious.cpp


示例13: EnterCombat

            void EnterCombat(Unit* who) override
            {
                _petsInCombat = false;
                me->SetReactState(REACT_AGGRESSIVE);
                summons.DoZoneInCombat();

                events.CancelEvent(EVENT_SEND_GROUP);
                events.ScheduleEvent(EVENT_SWARM, Seconds(5));
                events.ScheduleEvent(EVENT_MIND_FLAY, randtime(Seconds(1), Seconds(3)));

                BossAI::EnterCombat(who);
            }
开发者ID:Declipe,项目名称:ElunaTrinityWotlk,代码行数:12,代码来源:boss_krikthir_the_gatewatcher.cpp


示例14: UpdateAI

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

                events.Update(diff);

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_POISON:
                            if (!me->HasAura(SPELL_WIDOWS_EMBRACE_HELPER))
                                DoCastAOE(SPELL_POISON_BOLT_VOLLEY);
                            events.Repeat(randtime(Seconds(8), Seconds(15)));
                            break;
                        case EVENT_FIRE:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                                DoCast(target, SPELL_RAIN_OF_FIRE);
                            events.Repeat(randtime(Seconds(6), Seconds(18)));
                            break;
                        case EVENT_FRENZY:
                            if (Aura* widowsEmbrace = me->GetAura(SPELL_WIDOWS_EMBRACE_HELPER))
                                events.ScheduleEvent(EVENT_FRENZY, Milliseconds(widowsEmbrace->GetDuration()+1));
                            else
                            {
                                DoCast(SPELL_FRENZY);
                                Talk(EMOTE_FRENZY);
                                events.Repeat(Minutes(1) + randtime(Seconds(0), Seconds(20)));
                            }
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
开发者ID:DanielBallaSZTE,项目名称:TrinityCorePreWOTLK,代码行数:39,代码来源:boss_faerlina.cpp


示例15: BeginFighting

            void BeginFighting() override
            {
                SetCombatMovement(true);
                me->SetReactState(REACT_AGGRESSIVE);
                ThreatManager& threat = me->getThreatManager();
                if (threat.isThreatListEmpty())
                {
                    if (Unit* nearest = me->SelectNearestPlayer(5000.0f))
                    {
                        me->AddThreat(nearest, 1.0f);
                        AttackStart(nearest);
                    }
                    else
                        ResetEncounter();
                }
                else
                    AttackStart(threat.getHostilTarget());

                events.ScheduleEvent(EVENT_BERSERK, Minutes(10));
                events.ScheduleEvent(EVENT_MARK, Seconds(24));
                events.ScheduleEvent(EVENT_METEOR, randtime(Seconds(10), Seconds(25)));
            }
开发者ID:DanielBallaSZTE,项目名称:TrinityCorePreWOTLK,代码行数:22,代码来源:boss_four_horsemen.cpp


示例16: _EnterCombat

 void _EnterCombat() override
 {
     _events.ScheduleEvent(EVENT_SHADOW_BOLT, Seconds(4));
     _events.ScheduleEvent(EVENT_SHADOW_NOVA, randtime(Seconds(10), Seconds(14)));
 }
开发者ID:Declipe,项目名称:ElunaTrinityWotlk,代码行数:5,代码来源:boss_krikthir_the_gatewatcher.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rangeChanged函数代码示例发布时间:2022-05-30
下一篇:
C++ randomize函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap