本文整理汇总了C++中CreatureList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureList::size方法的具体用法?C++ CreatureList::size怎么用?C++ CreatureList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureList
的用法示例。
在下文中一共展示了CreatureList::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectRandomCreatureOfEntryInRange
Creature* SelectRandomCreatureOfEntryInRange(uint32 uiEntry, float fRange)
{
CreatureList lCreatureList;
GetCreatureListWithEntryInGrid(lCreatureList, m_creature, uiEntry, fRange);
if (lCreatureList.empty())
return NULL;
CreatureList::iterator iter = lCreatureList.begin();
advance(iter, urand(0, lCreatureList.size()-1));
return *iter;
}
示例2: JustSummoned
void JustSummoned(Creature* pSummoned) override
{
lCreatureList.push_back(pSummoned);
pSummoned->setFaction(FACTION_GENERIC_FRIENDLY);
if (pSummoned->GetEntry() == NPC_CALDWELL)
pSummoned->GetMotionMaster()->MovePoint(0, m_afMoveTo[0], m_afMoveTo[1], m_afMoveTo[2]);
else
{
if (Creature* pCaldwell = GetCreature(NPC_CALDWELL))
{
// will this conversion work without compile warning/error?
size_t iSize = lCreatureList.size();
pSummoned->GetMotionMaster()->MoveFollow(pCaldwell, 0.5f, (M_PI / 2) * (int)iSize);
}
}
}
示例3: UpdateAI
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
// Demoralizing Shout Timer
if (m_uiDemoralizingShoutTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_DEMORALIZING_SHOUT) == CAST_OK)
m_uiDemoralizingShoutTimer = urand(15000, 20000);
}
else
m_uiDemoralizingShoutTimer -= uiDiff;
// Inspire Timer
if (m_uiInspireTimer < uiDiff)
{
Creature* pTarget = nullptr;
CreatureList pList = DoFindFriendlyMissingBuff(45.0f, SPELL_INSPIRE);
if (!pList.empty())
{
CreatureList::iterator i = pList.begin();
advance(i, (rand() % pList.size()));
pTarget = (*i);
}
if (!pTarget)
pTarget = m_creature;
if (DoCastSpellIfCan(pTarget, SPELL_INSPIRE) == CAST_OK)
m_uiInspireTimer = 10000;
}
else
m_uiInspireTimer -= uiDiff;
// Hand of Ragnaros Timer
if (m_uiKnockdownTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_HAND_OF_RAGNAROS) == CAST_OK)
m_uiKnockdownTimer = urand(12000, 15000);
}
else
m_uiKnockdownTimer -= uiDiff;
// Flamespear Timer
if (m_uiFlamespearTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
if (DoCastSpellIfCan(pTarget, SPELL_FLAMESPEAR) == CAST_OK)
m_uiFlamespearTimer = urand(12000, 16000);
}
}
else
m_uiFlamespearTimer -= uiDiff;
// Dark Strike Timer
if (m_uiDarkstrikeTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DARK_STRIKE) == CAST_OK)
m_uiDarkstrikeTimer = urand(15000, 18000);
}
else
m_uiDarkstrikeTimer -= uiDiff;
DoMeleeAttackIfReady();
}
示例4: EffectDummyCreature_spell_anchor
bool EffectDummyCreature_spell_anchor(Unit* /*pCaster*/, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/)
{
if (uiEffIndex != EFFECT_INDEX_0 || pCreatureTarget->GetEntry() != NPC_SUB_BOSS_TRIGGER)
return true;
instance_naxxramas* pInstance = (instance_naxxramas*)pCreatureTarget->GetInstanceData();
if (!pInstance)
return true;
switch (uiSpellId)
{
case SPELL_A_TO_ANCHOR_1: // trigger mobs at high right side
case SPELL_B_TO_ANCHOR_1:
case SPELL_C_TO_ANCHOR_1:
{
if (Creature* pAnchor2 = pInstance->GetClosestAnchorForGoth(pCreatureTarget, false))
{
uint32 uiTriggered = SPELL_A_TO_ANCHOR_2;
if (uiSpellId == SPELL_B_TO_ANCHOR_1)
uiTriggered = SPELL_B_TO_ANCHOR_2;
else if (uiSpellId == SPELL_C_TO_ANCHOR_1)
uiTriggered = SPELL_C_TO_ANCHOR_2;
pCreatureTarget->CastSpell(pAnchor2, uiTriggered, TRIGGERED_OLD_TRIGGERED);
}
return true;
}
case SPELL_A_TO_ANCHOR_2: // trigger mobs at high left side
case SPELL_B_TO_ANCHOR_2:
case SPELL_C_TO_ANCHOR_2:
{
CreatureList lTargets;
pInstance->GetGothSummonPointCreatures(lTargets, false);
if (!lTargets.empty())
{
CreatureList::iterator itr = lTargets.begin();
uint32 uiPosition = urand(0, lTargets.size() - 1);
advance(itr, uiPosition);
if (Creature* pTarget = (*itr))
{
uint32 uiTriggered = SPELL_A_TO_SKULL;
if (uiSpellId == SPELL_B_TO_ANCHOR_2)
uiTriggered = SPELL_B_TO_SKULL;
else if (uiSpellId == SPELL_C_TO_ANCHOR_2)
uiTriggered = SPELL_C_TO_SKULL;
pCreatureTarget->CastSpell(pTarget, uiTriggered, TRIGGERED_OLD_TRIGGERED);
}
}
return true;
}
case SPELL_A_TO_SKULL: // final destination trigger mob
case SPELL_B_TO_SKULL:
case SPELL_C_TO_SKULL:
{
if (Creature* pGoth = pInstance->GetSingleCreatureFromStorage(NPC_GOTHIK))
{
uint32 uiNpcEntry = NPC_SPECT_TRAINEE;
if (uiSpellId == SPELL_B_TO_SKULL)
uiNpcEntry = NPC_SPECT_DEATH_KNIGHT;
else if (uiSpellId == SPELL_C_TO_SKULL)
uiNpcEntry = NPC_SPECT_RIDER;
pGoth->SummonCreature(uiNpcEntry, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), pCreatureTarget->GetOrientation(), TEMPSPAWN_DEAD_DESPAWN, 0);
if (uiNpcEntry == NPC_SPECT_RIDER)
pGoth->SummonCreature(NPC_SPECT_HORSE, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), pCreatureTarget->GetOrientation(), TEMPSPAWN_DEAD_DESPAWN, 0);
}
return true;
}
}
return true;
};