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


C++ GuidVector::size方法代码示例

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


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

示例1: DoSummonDrakkariInvaders

    // Wrapper to handle the drakkari invaders summon
    void DoSummonDrakkariInvaders()
    {
        if (!m_pInstance)
            return;

        // check if there are there are at least 2 triggers in the vector
        if (m_vTriggers.size() < 2)
            return;

        if (roll_chance_i(30))
        {
            // Summon a troll in the corner and 2 trolls in the air
            if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_pInstance->GetTrollgoreCornerTrigger()))
                pTrigger->CastSpell(pTrigger, roll_chance_i(20) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());

            // get two random outside triggers
            uint8 uiMaxTriggers = m_vTriggers.size();
            uint8 uiPos1 = urand(0, uiMaxTriggers  - 1);
            uint8 uiPos2 = (uiPos1 + urand(1, uiMaxTriggers  - 1)) % uiMaxTriggers;

            if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_vTriggers[uiPos1]))
                pTrigger->CastSpell(pTrigger, roll_chance_i(30) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
            if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_vTriggers[uiPos2]))
                pTrigger->CastSpell(pTrigger, roll_chance_i(30) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
        }
        else
        {
            // Summon 3 trolls in the air
            for (auto m_vTrigger : m_vTriggers)
            {
                if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_vTrigger))
                    pTrigger->CastSpell(pTrigger, roll_chance_i(30) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
            }
        }
    }
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:36,代码来源:boss_trollgore.cpp

示例2: CallFallSoldier

 void CallFallSoldier()
 {
     for (uint8 i = 0; i < 4 && m_uiSummonGUID.size(); i++)
     {
         if(Creature* Summon = m_pInstance->instance->GetCreature(m_uiSummonGUID.back()))
         {
            Summon->setFaction(14);
            Summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            Summon->SetInCombatWithZone();
         }
         m_uiSummonGUID.pop_back();
     }
 }
开发者ID:mynew4,项目名称:RustEmu-Core,代码行数:13,代码来源:boss_falric.cpp

示例3: EnterCombat

            void EnterCombat(Unit* /*who*/) override
            {
                for (uint32 i = 0; i < POS_LIVE; ++i)
                    if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i]))
                        LiveTriggerGUID.push_back(trigger->GetGUID());
                for (uint32 i = 0; i < POS_DEAD; ++i)
                    if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i]))
                        DeadTriggerGUID.push_back(trigger->GetGUID());

                if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD)
                {
                    TC_LOG_ERROR("scripts", "Script Gothik: cannot summon triggers!");
                    EnterEvadeMode();
                    return;
                }

                _EnterCombat();
                waveCount = 0;
                events.ScheduleEvent(EVENT_SUMMON, 30000);
                DoTeleportTo(PosPlatform);
                Talk(SAY_SPEECH);
                instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY);
            }
开发者ID:AllThing,项目名称:TrinityCore,代码行数:23,代码来源:boss_gothik.cpp

示例4: DoSetupAdds

    void DoSetupAdds()
    {
        m_uiSetupAddsTimer = 0;

        if (!m_pInstance)
            return;

        GuidList lAddGuids;
        m_pInstance->GetKelidanAddList(lAddGuids);

        // Sort Adds to vector if not already done
        if (!lAddGuids.empty())
        {
            m_vAddGuids.reserve(lAddGuids.size());
            std::list<Creature*> lAdds;
            for (GuidList::const_iterator itr = lAddGuids.begin(); itr != lAddGuids.end(); ++itr)
            {
                if (Creature* pAdd = m_pInstance->instance->GetCreature(*itr))
                    lAdds.push_back(pAdd);
            }
            // Sort them by angle
            lAdds.sort(SortByAngle(m_creature));
            for (std::list<Creature*>::const_iterator itr = lAdds.begin(); itr != lAdds.end(); ++itr)
                m_vAddGuids.push_back((*itr)->GetObjectGuid());
        }

        // Respawn killed adds and reset counter
        m_uiKilledAdds = 0;
        for (GuidVector::const_iterator itr = m_vAddGuids.begin(); itr != m_vAddGuids.end(); ++itr)
        {
            Creature* pAdd = m_pInstance->instance->GetCreature(*itr);
            if (pAdd && !pAdd->isAlive())
                pAdd->Respawn();
        }

        // Cast pentagram
        uint8 s = m_vAddGuids.size();
        for (uint8 i = 0; i < s; ++i)
        {
            Creature* pCaster = m_pInstance->instance->GetCreature(m_vAddGuids[i]);
            Creature* pTarget = m_pInstance->instance->GetCreature(m_vAddGuids[(i + 2) % s]);
            if (pCaster && pTarget)
                pCaster->CastSpell(pTarget, SPELL_CHANNELING, TRIGGERED_NONE);
        }

        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
    }
开发者ID:MantisLord,项目名称:mangos-tbc,代码行数:48,代码来源:boss_kelidan_the_breaker.cpp

示例5: playersInsideCircles

    uint8 playersInsideCircles()
    {
        uint32 tmpAuras[5] = {
            SPELL_VIMGOL_POP_TEST_A, SPELL_VIMGOL_POP_TEST_B, SPELL_VIMGOL_POP_TEST_C,
            SPELL_VIMGOL_POP_TEST_D, SPELL_VIMGOL_POP_TEST_E
        };
        uint8 tmpCounter = 0;

        if (m_uiBunnyGuids.size() < 5 && m_pMap)
        {
            m_uiBunnyGuids.clear();
            m_pMap->GetCreatureGuidVectorFromStorage(NPC_VIMGOL_VISUAL_BUNNY, m_uiBunnyGuids);
        }

        for (int i = 0; i < 5; i++)
            m_uiActiveCircles[i] = false;

        std::list<Player*> playerList;
        GetPlayerListWithEntryInWorld(playerList, m_creature, 30);
        for (auto itr = playerList.begin(); itr != playerList.end(); ++itr)
        {
            if (!(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_A) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_B) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_C) &&
                !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_D) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_E))
                continue;

            for (auto it = m_uiBunnyGuids.begin(); it != m_uiBunnyGuids.end(); ++it)
            {
                for (int i = 0; i < 5; ++i)
                {
                    if (!(*itr)->GetAura(tmpAuras[i], SpellEffectIndex(0)))
                        continue;

                    if ((*it) != (*itr)->GetAura(tmpAuras[i], SpellEffectIndex(0))->GetCasterGuid())
                        continue;

                    m_uiActiveCircles[std::distance(m_uiBunnyGuids.begin(), it)] = true;
                }
            }
        }

        for (int i = 0; i < 5; i++)
            if (m_uiActiveCircles[i])
                ++tmpCounter;

        return tmpCounter;
    }
开发者ID:BThallid,项目名称:mangos,代码行数:46,代码来源:blades_edge_mountains.cpp

示例6: JustSummoned

    void JustSummoned(Creature* pSummoned) override
    {
        if (pSummoned->GetEntry() == NPC_PLANAR_ANOMALY)
        {
            pSummoned->CastSpell(pSummoned, SPELL_PLANAR_ANOMALY_AGGRO, true);

            // If this happens then something is really wrong
            if (m_vAnomalyTargets.empty())
                return;

            if (Unit* pTarget = m_creature->GetMap()->GetUnit(m_vAnomalyTargets[m_uiAnomalyTargetIndex]))
                pSummoned->GetMotionMaster()->MoveFollow(pTarget, 0, 0);

            if (m_uiAnomalyTargetIndex < m_vAnomalyTargets.size() - 1)
                ++m_uiAnomalyTargetIndex;
        }
        else if (pSummoned->GetEntry() == NPC_GREATER_LEY_WHELP)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                pSummoned->AI()->AttackStart(pTarget);
        }
    }
开发者ID:AwkwardDev,项目名称:mangos-d3,代码行数:22,代码来源:boss_eregos.cpp

示例7: DoSummonBrokenAshtongue

    // Wrapper to summon the npcs for the epilogue
    void DoSummonBrokenAshtongue()
    {
        if (!m_pInstance)
            return;

        float fX, fY, fZ;

        // Spawn 4 Broken in the center and behind the column
        for (uint8 i = 0; i < countof(afBrokenSpawnLoc); ++i)
        {
            for (uint8 j = 0; j < 4; ++j)
            {
                fX = afBrokenSpawnLoc[i].m_fX;
                fY = afBrokenSpawnLoc[i].m_fY + (j * 7);
                fZ = afBrokenSpawnLoc[i].m_fZ;

                m_creature->SummonCreature(NPC_ASH_BROKEN, fX, fY, fZ, 0, TEMPSUMMON_TIMED_DESPAWN, 10 * MINUTE * IN_MILLISECONDS);
            }
        }

        GuidVector vGeneratorsVect;
        m_pInstance->GetGeneratorGuidVector(vGeneratorsVect);

        // Spawn 4 Broken at each generator
        for (uint8 i = 0; i < vGeneratorsVect.size(); ++i)
        {
            if (Creature* pGenerator = m_creature->GetMap()->GetCreature(vGeneratorsVect[i]))
            {
                for (uint8 j = 0; j < 4; ++j)
                {
                    pGenerator->GetRandomPoint(pGenerator->GetPositionX(), pGenerator->GetPositionY(), pGenerator->GetPositionZ(), 10.0f, fX, fY, fZ);
                    m_creature->SummonCreature(NPC_ASH_BROKEN, fX, fY, fZ, 0, TEMPSUMMON_TIMED_DESPAWN, 10 * MINUTE * IN_MILLISECONDS);
                }
            }
        }
    }
开发者ID:AwkwardDev,项目名称:mangos-d3,代码行数:37,代码来源:boss_shade_of_akama.cpp

示例8: UpdateAI

    void UpdateAI(const uint32 uiDiff) override
    {
        if (m_uiRobotTimer)
        {
            if (m_uiRobotTimer <= uiDiff)
            {
                // visual effect on XT (script target)
                DoCastSpellIfCan(m_creature, SPELL_LIGHTNING_TETHER, CAST_TRIGGERED);

                // cast the enerby orb on each pile one by one
                if (Creature* pToyPile = m_creature->GetMap()->GetCreature(m_vToyPileGuids[urand(0, m_vToyPileGuids.size() - 1)]))
                    DoCastSpellIfCan(pToyPile, SPELL_ENERGY_ORB, CAST_TRIGGERED);

                // reset timer after the overload aura expires
                if (m_creature->HasAura(SPELL_EXPOSED_HEART))
                    m_uiRobotTimer = urand(1000, 3000);
                else
                    m_uiRobotTimer = 0;
            }
            else
                m_uiRobotTimer -= uiDiff;
        }
    }
开发者ID:AwkwardDev,项目名称:mangos-d3,代码行数:23,代码来源:boss_xt_002.cpp

示例9: MovementInform

    void MovementInform(uint32 uiMotionType, uint32 uiPointId) override
    {
        if (uiMotionType != POINT_MOTION_TYPE || !uiPointId)
            return;

        // move to another random stalker
        if (Creature* pStalker = m_creature->GetMap()->GetCreature(m_vStalkersGuids[urand(0, m_vStalkersGuids.size() - 1)]))
            m_creature->GetMotionMaster()->MovePoint(1, pStalker->GetPositionX(), pStalker->GetPositionY(), pStalker->GetPositionZ());
    }
开发者ID:dvdvideo1234,项目名称:mangos-wotlk,代码行数:9,代码来源:boss_twin_valkyr.cpp

示例10: Reset

    void Reset() override
    {
        // get the list of summoned stalkers and move to a randome one
        if (m_pInstance)
            m_pInstance->GetStalkersGUIDVector(m_vStalkersGuids);

        if (m_vStalkersGuids.empty())
            return;

        m_creature->SetWalk(false);
        if (Creature* pStalker = m_creature->GetMap()->GetCreature(m_vStalkersGuids[urand(0, m_vStalkersGuids.size() - 1)]))
            m_creature->GetMotionMaster()->MovePoint(1, pStalker->GetPositionX(), pStalker->GetPositionY(), pStalker->GetPositionZ());
    }
开发者ID:dvdvideo1234,项目名称:mangos-wotlk,代码行数:13,代码来源:boss_twin_valkyr.cpp


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