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


C++ Player::AI方法代码示例

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


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

示例1: OnApply

            void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
            {
                if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
                    return;

                Player* pTarget = GetTarget()->ToPlayer();
                oldAI = pTarget->AI();
                oldAIState = pTarget->IsAIEnabled;
                GetTarget()->SetAI(new player_overlord_brandAI(pTarget, GetCasterGUID()));
                GetTarget()->IsAIEnabled = true;
            }
开发者ID:Cyph3r,项目名称:LordPsyanBots,代码行数:11,代码来源:boss_scourgelord_tyrannus.cpp

示例2: UpdateAI

    void UpdateAI(const uint32 diff)
    {
        if(InciteChaos)
        {
            if(InciteChaosWait_Timer < diff)
            {
                InciteChaos = false;
                DoZoneInCombat();
                DoResetThreat();

                Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true);
                if(target)
                    AttackStart(target);
            }
            else
                InciteChaosWait_Timer -= diff;

            return;
        }

        if (!UpdateVictim())
            return;
        else
            TrashAggro();

        if(InciteChaos_Timer < diff)
        {
            DoCast(me, SPELL_INCITE_CHAOS);

            Map *map = me->GetMap();
            Map::PlayerList const &PlayerList = map->GetPlayers();

            if(PlayerList.isEmpty())
                return;

            for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
            {
                Player *plr = i->getSource();
                Player *target = (Player*)SelectUnit(SELECT_TARGET_RANDOM, 0, 100, true, plr->GetGUID());

                if(plr && plr->IsAIEnabled && target)
                    plr->AI()->AttackStart(target);
            }

            //DoResetThreat();
            InciteChaos = true;
            InciteChaos_Timer = 40000;
            InciteChaosWait_Timer = 16000;
            return;
        }
        else
            InciteChaos_Timer -= diff;

        //Charge_Timer
        if (Charge_Timer < diff)
        {
            if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true))
                DoCast(target, SPELL_CHARGE);
            Charge_Timer = 25000;
        }
        else
            Charge_Timer -= diff;

        //Knockback_Timer
        if (Knockback_Timer < diff)
        {
            DoCast(me, SPELL_WAR_STOMP);
            Knockback_Timer = 20000;
        }
        else
            Knockback_Timer -= diff;

        DoMeleeAttackIfReady();
    }
开发者ID:Xadras,项目名称:looking4group-core,代码行数:74,代码来源:boss_blackheart_the_inciter.cpp


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