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

C++ GetEmbraceTarget函数代码示例

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

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



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

示例1: KilledUnit

            void KilledUnit(Unit* victim) override
            {
                if (victim->GetTypeId() != TYPEID_PLAYER)
                    return;

                Unit* embraceTarget = GetEmbraceTarget();
                if (events.IsInPhase(PHASE_SPECIAL) && embraceTarget && victim == embraceTarget)
                {
                    _embraceTargetGUID = 0;
                    events.SetPhase(PHASE_NORMAL);
                }
                Talk(SAY_SLAY);
            }
开发者ID:Caydan,项目名称:WoWSCore548,代码行数:13,代码来源:boss_prince_taldaram.cpp


示例2: DamageTaken

            void DamageTaken(Unit* /*doneBy*/, uint32& damage) override
            {
                Unit* embraceTarget = GetEmbraceTarget();

                if (embraceTarget && embraceTarget->IsAlive())
                {
                    _embraceTakenDamage += damage;
                    if (_embraceTakenDamage > DUNGEON_MODE<uint32>(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG))
                    {
                        _embraceTargetGUID.Clear();
                        me->CastStop();
                    }
                }
            }
开发者ID:Refuge89,项目名称:TrinityCore,代码行数:14,代码来源:boss_prince_taldaram.cpp


示例3: KilledUnit

        void KilledUnit(Unit* victim)
        {
            if (victim == me)
                return;

            Unit* pEmbraceTarget = GetEmbraceTarget();
            if (Phase == FEEDING && pEmbraceTarget && victim == pEmbraceTarget)
            {
                Phase = NORMAL;
                uiPhaseTimer = 0;
                uiEmbraceTarget = 0;
            }
            Talk(SAY_SLAY);
        }
开发者ID:darkss,项目名称:TrinityCore,代码行数:14,代码来源:boss_prince_taldaram.cpp


示例4: DamageTaken

            void DamageTaken(Unit* /*doneBy*/, uint32& damage) override
            {
                Unit* embraceTarget = GetEmbraceTarget();

                if (events.IsInPhase(PHASE_SPECIAL) && embraceTarget && embraceTarget->IsAlive())
                {
                    _embraceTakenDamage += damage;
                    if (_embraceTakenDamage > DUNGEON_MODE<uint32>(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG))
                    {
                        _embraceTargetGUID = 0;
                        events.SetPhase(PHASE_NORMAL);
                        me->CastStop();
                    }
                }
            }
开发者ID:Caydan,项目名称:WoWSCore548,代码行数:15,代码来源:boss_prince_taldaram.cpp


示例5: DamageTaken

        void DamageTaken(Unit* /*done_by*/, uint32 &damage)
        {
            Unit* pEmbraceTarget = GetEmbraceTarget();

            if (Phase == FEEDING && pEmbraceTarget && pEmbraceTarget->isAlive())
            {
              uiEmbraceTakenDamage += damage;
              if (uiEmbraceTakenDamage > (uint32) DUNGEON_MODE(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG))
              {
                  Phase = NORMAL;
                  uiPhaseTimer = 0;
                  uiEmbraceTarget = 0;
                  me->CastStop();
              }
            }
        }
开发者ID:AwkwardDev,项目名称:Darkcore-Rebase,代码行数:16,代码来源:boss_prince_taldaram.cpp


示例6: UpdateAI

            void UpdateAI(uint32 diff) override
            {
                if (_initialCheckTimer)
                {
                    if (_initialCheckTimer <= diff)
                    {
                        CheckSpheres();
                        _initialCheckTimer = 0;
                    }
                    else
                        _initialCheckTimer -= diff;
                }

                if (me->HasAura(SPELL_VANISH))
                {
                    if (me->GetThreatManager().IsThreatListEmpty(true))
                    {
                        EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
                        return;
                    }
                }
                else
                {
                    if (!UpdateVictim())
                        return;
                }

                events.Update(diff);

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BLOODTHIRST:
                            DoCast(me, SPELL_BLOODTHIRST);
                            events.ScheduleEvent(EVENT_BLOODTHIRST, 10000);
                            break;
                        case EVENT_CONJURE_FLAME_SPHERES:
                            // random target?
                            if (Unit* victim = me->GetVictim())
                            {
                                _flameSphereTargetGUID = victim->GetGUID();
                                DoCast(victim, SPELL_CONJURE_FLAME_SPHERE);
                            }
                            events.ScheduleEvent(EVENT_CONJURE_FLAME_SPHERES, 15000);
                            break;
                        case EVENT_VANISH:
                        {
                            if (me->GetThreatManager().GetThreatListSize() > 1)
                            {
                                if (Unit* embraceTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                                    _embraceTargetGUID = embraceTarget->GetGUID();
                                Talk(SAY_VANISH);
                                DoCast(me, SPELL_VANISH);
                                events.DelayEvents(500);
                                events.ScheduleEvent(EVENT_START_FEEDING, 2000);
                            }
                            events.ScheduleEvent(EVENT_VANISH, urand(25000, 35000));
                            break;
                        }
                        case EVENT_START_FEEDING:
                            me->RemoveAurasDueToSpell(SPELL_VANISH);
                            if (Unit* embraceTarget = GetEmbraceTarget())
                            {
                                DoCast(embraceTarget, SPELL_SHADOWSTEP);
                                DoCast(embraceTarget, SPELL_EMBRACE_OF_THE_VAMPYR);
                                Talk(SAY_FEED);
                                events.ScheduleEvent(EVENT_DONE_FEEDING, 20000);
                            }
                            break;
                        case EVENT_DONE_FEEDING:
                            _embraceTargetGUID.Clear();
                            break;
                        default:
                            break;
                    }

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

                DoMeleeAttackIfReady();
            }
开发者ID:Refuge89,项目名称:TrinityCore,代码行数:86,代码来源:boss_prince_taldaram.cpp


示例7: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
            if (uiPhaseTimer <= diff)
            {
                switch (Phase)
                {
                    case CASTING_FLAME_SPHERES:
                    {
                        Creature* pSpheres[3];

                        //DoCast(me, SPELL_FLAME_SPHERE_SUMMON_1);
                        pSpheres[0] = DoSpawnCreature(CREATURE_FLAME_SPHERE, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS);
                        Unit* pSphereTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                        if (pSphereTarget && pSpheres[0])
                        {
                            float angle, x, y;
                            angle = pSpheres[0]->GetAngle(pSphereTarget);
                            x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * cos(angle);
                            y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * sin(angle);
                            pSpheres[0]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[0]->GetPositionZ());
                        }
                        if (IsHeroic())
                        {
                            //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_1);
                            pSpheres[1] = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_1, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS);
                            //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_2);
                            pSpheres[2] = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_2, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS);
                            if (pSphereTarget && pSpheres[1] && pSpheres[2])
                            {
                                float angle, x, y;
                                angle = pSpheres[1]->GetAngle(pSphereTarget) + DATA_SPHERE_ANGLE_OFFSET;
                                x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle);
                                y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle);
                                pSpheres[1]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[1]->GetPositionZ());
                                angle = pSpheres[2]->GetAngle(pSphereTarget) - DATA_SPHERE_ANGLE_OFFSET;
                                x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle);
                                y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle);
                                pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ());
                            }
                        }

                        Phase = NORMAL;
                        uiPhaseTimer = 0;
                        break;
                    }
                    case JUST_VANISHED:
                        if (Unit* pEmbraceTarget = GetEmbraceTarget())
                        {
                            me->GetMotionMaster()->Clear();
                            me->SetSpeed(MOVE_WALK, 2.0f, true);
                            me->GetMotionMaster()->MoveChase(pEmbraceTarget);
                        }
                        Phase = VANISHED;
                        uiPhaseTimer = 1300;
                        break;
                    case VANISHED:
                        if (Unit* pEmbraceTarget = GetEmbraceTarget())
                            DoCast(pEmbraceTarget, SPELL_EMBRACE_OF_THE_VAMPYR);
                        me->GetMotionMaster()->Clear();
                        me->SetSpeed(MOVE_WALK, 1.0f, true);
                        me->GetMotionMaster()->MoveChase(me->getVictim());
                        Phase = FEEDING;
                        uiPhaseTimer = 20*IN_MILLISECONDS;
                        break;
                    case FEEDING:
                        Phase = NORMAL;
                        uiPhaseTimer = 0;
                        uiEmbraceTarget = 0;
                        break;
                    case NORMAL:
                        if (uiBloodthirstTimer <= diff)
                        {
                            DoCast(me, SPELL_BLOODTHIRST);
                            uiBloodthirstTimer = 10*IN_MILLISECONDS;
                        } else uiBloodthirstTimer -= diff;

                        if (uiFlamesphereTimer <= diff)
                        {
                            DoCast(me, SPELL_CONJURE_FLAME_SPHERE);
                            Phase = CASTING_FLAME_SPHERES;
                            uiPhaseTimer = 3*IN_MILLISECONDS + diff;
                            uiFlamesphereTimer = 15*IN_MILLISECONDS;
                        } else uiFlamesphereTimer -= diff;

                        if (uiVanishTimer <= diff)
                        {
                            //Count alive players
                            Unit* target = NULL;
                            std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
                            std::vector<Unit*> target_list;
                            for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
                            {
                                target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
                                // exclude pets & totems
                                if (target && target->GetTypeId() == TYPEID_PLAYER && target->isAlive())
                                    target_list.push_back(target);
                                target = NULL;
                            }
//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:Darkcore-Rebase,代码行数:101,代码来源:boss_prince_taldaram.cpp


示例8: 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)
                    {
                        if (events.IsInPhase(PHASE_NORMAL))
                        {
                            case EVENT_BLOODTHIRST:
                                DoCast(me, SPELL_BLOODTHIRST);
                                events.ScheduleEvent(EVENT_BLOODTHIRST, 10000);
                                break;
                            case EVENT_FLAME_SPHERE:
                                DoCastVictim(SPELL_CONJURE_FLAME_SPHERE);
                                events.SetPhase(PHASE_SPECIAL);
                                events.ScheduleEvent(EVENT_CASTING_FLAME_SPHERES, 3000);
                                events.ScheduleEvent(EVENT_FLAME_SPHERE, 15000);
                                break;
                            case EVENT_VANISH:
                            {
                                Map::PlayerList const& players = me->GetMap()->GetPlayers();
                                uint32 targets = 0;
                                for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
                                {
                                    Player* player = i->GetSource();
                                    if (player && player->IsAlive())
                                        ++targets;
                                }

                                if (targets > 2)
                                {
                                    Talk(SAY_VANISH);
                                    DoCast(me, SPELL_VANISH);
                                    events.SetPhase(PHASE_SPECIAL);
                                    events.ScheduleEvent(EVENT_JUST_VANISHED, 500);
                                    if (Unit* embraceTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                                        _embraceTargetGUID = embraceTarget->GetGUID();
                                }
                                events.ScheduleEvent(EVENT_VANISH, urand(25000, 35000));
                                break;
                            }
                        }
                        case EVENT_CASTING_FLAME_SPHERES:
                        {
                            events.SetPhase(PHASE_NORMAL);
                            Unit* sphereTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                            if (!sphereTarget)
                                break;

                            float angle, x, y;

                            //DoCast(me, SPELL_FLAME_SPHERE_SUMMON_1);
                            if (Creature* sphere = DoSpawnCreature(CREATURE_FLAME_SPHERE, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10 * IN_MILLISECONDS))
                            {
                                angle = sphere->GetAngle(sphereTarget);
                                x = sphere->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle);
                                y = sphere->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle);
                                sphere->GetMotionMaster()->MovePoint(0, x, y, sphere->GetPositionZ());
                            }

                            if (IsHeroic())
                            {
                                //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_1);
                                if (Creature* sphere = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_1, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10 * IN_MILLISECONDS))
                                {
                                    angle = sphere->GetAngle(sphereTarget) + DATA_SPHERE_ANGLE_OFFSET;
                                    x = sphere->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
                                    y = sphere->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
                                    sphere->GetMotionMaster()->MovePoint(0, x, y, sphere->GetPositionZ());
                                }

                                //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_2);
                                if (Creature* sphere = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_2, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10 * IN_MILLISECONDS))
                                {
                                    angle = sphere->GetAngle(sphereTarget) - DATA_SPHERE_ANGLE_OFFSET;
                                    x = sphere->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
                                    y = sphere->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
                                    sphere->GetMotionMaster()->MovePoint(0, x, y, sphere->GetPositionZ());
                                }
                            }
                            break;
                        }
                        case EVENT_JUST_VANISHED:
                            if (Unit* embraceTarget = GetEmbraceTarget())
                            {
                                me->GetMotionMaster()->Clear();
                                me->SetSpeed(MOVE_WALK, 2.0f, true);
                                me->GetMotionMaster()->MoveChase(embraceTarget);
                            }
                            events.ScheduleEvent(EVENT_VANISHED, 1300);
                            break;
                        case EVENT_VANISHED:
//.........这里部分代码省略.........
开发者ID:Caydan,项目名称:WoWSCore548,代码行数:101,代码来源:boss_prince_taldaram.cpp


示例9: 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_BLOODTHIRST:
                            DoCast(me, SPELL_BLOODTHIRST);
                            events.ScheduleEvent(EVENT_BLOODTHIRST, 10000);
                            break;
                        case EVENT_CONJURE_FLAME_SPHERES:
                            // random target?
                            if (Unit* victim = me->GetVictim())
                            {
                                _flameSphereTargetGUID = victim->GetGUID();
                                DoCast(victim, SPELL_CONJURE_FLAME_SPHERE);
                            }
                            events.ScheduleEvent(EVENT_CONJURE_FLAME_SPHERES, 15000);
                            break;
                        case EVENT_VANISH:
                        {
                            Map::PlayerList const& players = me->GetMap()->GetPlayers();
                            uint32 targets = 0;
                            for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
                            {
                                Player* player = i->GetSource();
                                if (player && player->IsAlive())
                                    ++targets;
                            }

                            if (targets > 2)
                            {
                                Talk(SAY_VANISH);
                                DoCast(me, SPELL_VANISH);
                                me->SetInCombatState(true); // Prevents the boss from resetting
                                events.DelayEvents(500);
                                events.ScheduleEvent(EVENT_JUST_VANISHED, 500);
                                if (Unit* embraceTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                                    _embraceTargetGUID = embraceTarget->GetGUID();
                            }
                            events.ScheduleEvent(EVENT_VANISH, urand(25000, 35000));
                            break;
                        }
                        case EVENT_JUST_VANISHED:
                            if (Unit* embraceTarget = GetEmbraceTarget())
                            {
                                me->GetMotionMaster()->Clear();
                                me->SetSpeed(MOVE_WALK, 2.0f, true);
                                me->GetMotionMaster()->MoveChase(embraceTarget);
                            }
                            events.ScheduleEvent(EVENT_VANISHED, 1300);
                            break;
                        case EVENT_VANISHED:
                            if (Unit* embraceTarget = GetEmbraceTarget())
                                DoCast(embraceTarget, SPELL_EMBRACE_OF_THE_VAMPYR);
                            Talk(SAY_FEED);
                            me->GetMotionMaster()->Clear();
                            me->SetSpeed(MOVE_WALK, 1.0f, true);
                            me->GetMotionMaster()->MoveChase(me->GetVictim());
                            events.ScheduleEvent(EVENT_FEEDING, 20000);
                            break;
                        case EVENT_FEEDING:
                            _embraceTargetGUID.Clear();
                            break;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
开发者ID:AwkwardDev,项目名称:RE,代码行数:79,代码来源:boss_prince_taldaram.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetEnabled函数代码示例发布时间:2022-05-30
下一篇:
C++ GetElementStarShip函数代码示例发布时间: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