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


C++ instance_gundrak::SelectRandomSladranTargetGuid方法代码示例

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


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

示例1: UpdateAI

    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiPoisonNovaTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_POISON_NOVA : SPELL_POISON_NOVA_H) == CAST_OK)
            {
                DoScriptText(EMOTE_NOVA, m_creature);
                m_uiPoisonNovaTimer = 22000;
            }
        }
        else
            m_uiPoisonNovaTimer -= uiDiff;

        if (m_uiSummonTimer < uiDiff)
        {
            if (!m_pInstance)
                return;

            if (Creature* pSummonTarget = m_creature->GetMap()->GetCreature(m_pInstance->SelectRandomSladranTargetGuid()))
            {
                if (urand(0, 3))
                {
                    // we don't want to get spammed
                    if (!urand(0, 4))
                        DoScriptText(SAY_SUMMON_CONSTRICTOR, m_creature);

                    pSummonTarget->CastSpell(pSummonTarget, SPELL_SUMMON_CONSTRICTOR, false, NULL, NULL, m_creature->GetObjectGuid());
                }
                else
                {
                    // we don't want to get spammed
                    if (!urand(0, 4))
                        DoScriptText(SAY_SUMMON_SNAKE, m_creature);

                    pSummonTarget->CastSpell(pSummonTarget, SPELL_SUMMON_VIPER, false, NULL, NULL, m_creature->GetObjectGuid());
                }
            }

            m_uiSummonTimer = m_bIsRegularMode ? 5000 : 3000;
        }
        else
            m_uiSummonTimer -= uiDiff;

        if (m_uiPowerfulBiteTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_POWERFUL_BITE : SPELL_POWERFUL_BITE_H) == CAST_OK)
                m_uiPowerfulBiteTimer = 10000;
        }
        else
            m_uiPowerfulBiteTimer -= uiDiff;

        if (m_uiVenomBoltTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
            {
                if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_VENOM_BOLT : SPELL_VENOM_BOLT_H) == CAST_OK)
                    m_uiVenomBoltTimer = 15000;
            }
        }
        else
            m_uiVenomBoltTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
开发者ID:jviljoen82,项目名称:ScriptDev3,代码行数:67,代码来源:boss_sladran.cpp


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