本文整理汇总了C++中CreatureList::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureList::clear方法的具体用法?C++ CreatureList::clear怎么用?C++ CreatureList::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureList
的用法示例。
在下文中一共展示了CreatureList::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoSortArmyWaves
void instance_ruins_of_ahnqiraj::DoSortArmyWaves()
{
CreatureList lCreatureList;
// Sort the 7 army waves
// We need to use gridsearcher for this, because coords search is too complicated here
for (uint8 i = 0; i < MAX_ARMY_WAVES; ++i)
{
// Clear all the army waves
m_sArmyWavesGuids[i].clear();
lCreatureList.clear();
if (Creature* pTemp = GetSingleCreatureFromStorage(aArmySortingParameters[i].m_uiEntry))
{
GetCreatureListWithEntryInGrid(lCreatureList, pTemp, NPC_QIRAJI_WARRIOR, aArmySortingParameters[i].m_fSearchDist);
GetCreatureListWithEntryInGrid(lCreatureList, pTemp, NPC_SWARMGUARD_NEEDLER, aArmySortingParameters[i].m_fSearchDist);
for (CreatureList::const_iterator itr = lCreatureList.begin(); itr != lCreatureList.end(); ++itr)
{
if ((*itr)->isAlive())
m_sArmyWavesGuids[i].insert((*itr)->GetObjectGuid());
}
if (pTemp->isAlive())
m_sArmyWavesGuids[i].insert(pTemp->GetObjectGuid());
}
}
// send the first wave
m_uiCurrentArmyWave = 0;
DoSendNextArmyWave();
}
示例2: Reset
void Reset() override
{
m_uiGlobalTimer = 5000;
if (HasEscortState(STATE_ESCORT_PAUSED) && m_uiPhase == PHASE_FIGHT)
m_uiPhase = PHASE_COMPLETE;
if (!HasEscortState(STATE_ESCORT_ESCORTING))
{
lCreatureList.clear();
m_uiPhase = 0;
m_uiPhaseCounter = 0;
}
}
示例3: DoPrepareChessEvent
void instance_karazhan::DoPrepareChessEvent()
{
// Allow all the chess pieces to init start position
for (GuidList::const_iterator itr = m_lChessPiecesAlliance.begin(); itr != m_lChessPiecesAlliance.end(); ++itr)
{
if (Creature* pChessPiece = instance->GetCreature(*itr))
{
Creature* pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_BLACK, 2.0f);
if (!pSquare)
pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_WHITE, 2.0f);
if (!pSquare)
{
script_error_log("Instance Karazhan: ERROR Failed to properly load the Chess square for %s.", pChessPiece->GetGuidStr().c_str());
return;
}
// send event which will prepare the current square
pChessPiece->AI()->SendAIEvent(AI_EVENT_CUSTOM_B, pSquare, pChessPiece);
}
}
for (GuidList::const_iterator itr = m_lChessPiecesHorde.begin(); itr != m_lChessPiecesHorde.end(); ++itr)
{
if (Creature* pChessPiece = instance->GetCreature(*itr))
{
Creature* pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_BLACK, 2.0f);
if (!pSquare)
pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_WHITE, 2.0f);
if (!pSquare)
{
script_error_log("Instance Karazhan: ERROR Failed to properly load the Chess square for %s.", pChessPiece->GetGuidStr().c_str());
return;
}
// send event which will prepare the current square
pChessPiece->AI()->SendAIEvent(AI_EVENT_CUSTOM_B, pSquare, pChessPiece);
}
}
// add silence debuff
Map::PlayerList const& players = instance->GetPlayers();
for (const auto& player : players)
{
if (Player* pPlayer = player.getSource())
pPlayer->CastSpell(pPlayer, SPELL_GAME_IN_SESSION, TRIGGERED_OLD_TRIGGERED);
}
m_uiAllianceStalkerCount = 0;
m_uiHordeStalkerCount = 0;
m_vHordeStalkers.clear();
m_vAllianceStalkers.clear();
// sort stalkers depending on side
CreatureList lStalkers;
for (GuidList::const_iterator itr = m_lChessHordeStalkerList.begin(); itr != m_lChessHordeStalkerList.end(); ++itr)
{
if (Creature* pTemp = instance->GetCreature(*itr))
lStalkers.push_back(pTemp);
}
if (lStalkers.empty())
{
script_error_log("Instance Karazhan: ERROR Failed to properly load the horde side stalkers for the Chess Event.");
return;
}
// get the proper statusBar npc
Creature* pStatusBar = instance->GetCreature(m_HordeStatusGuid);
if (!pStatusBar)
return;
lStalkers.sort(ObjectDistanceOrder(pStatusBar));
for (CreatureList::const_iterator itr = lStalkers.begin(); itr != lStalkers.end(); ++itr)
m_vHordeStalkers.push_back((*itr)->GetObjectGuid());
lStalkers.clear();
for (GuidList::const_iterator itr = m_lChessAllianceStalkerList.begin(); itr != m_lChessAllianceStalkerList.end(); ++itr)
{
if (Creature* pTemp = instance->GetCreature(*itr))
lStalkers.push_back(pTemp);
}
if (lStalkers.empty())
{
script_error_log("Instance Karazhan: ERROR Failed to properly load the alliance side stalkers for the Chess Event.");
return;
}
// get the proper statusBar npc
pStatusBar = instance->GetCreature(m_AllianceStatusGuid);
if (!pStatusBar)
return;
lStalkers.sort(ObjectDistanceOrder(pStatusBar));
for (CreatureList::const_iterator itr = lStalkers.begin(); itr != lStalkers.end(); ++itr)
m_vAllianceStalkers.push_back((*itr)->GetObjectGuid());
}
示例4: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
//Return since we have no target
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (m_uiPhase == 1 || m_uiPhase == 2)
{
// tank out of range
if (m_creature->GetDistance2d(m_creature->getVictim()) > m_creature->GetAttackDistance(m_creature->getVictim()))
{
if (m_uiRange_Timer <= uiDiff)
{
DoCast(m_creature, SPELL_FROST_BREATH);
m_uiRange_Timer = 10000;
}m_uiRange_Timer -= uiDiff;
}else m_uiRange_Timer = 10000;
//Pull
if (m_uiPullTimer < uiDiff)
{
PullAll();
m_uiPullTimer = 15000;
}
else m_uiPullTimer -= uiDiff;
//Smash
if (m_uiSmashTimer < uiDiff)
{
DoCast(m_creature, SPELL_SMASH);
m_uiSmashTimer = 17000;
}
else m_uiSmashTimer -= uiDiff;
//Cleave
if (m_uiCleaveTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE);
m_uiCleaveTimer = urand(5000, 8000);
}
else m_uiCleaveTimer -= uiDiff;
if (m_uiPhase == 1 && m_creature->GetHealthPercent() <= 50.0f)
{
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->RemoveAllAuras();
m_creature->CastSpell(m_creature, SPELL_ICE_BLOCK, true);
SpawnAdds();
m_uiPhase = 2;
return;
}
}
else if (m_uiPhase == 2)
{
if (m_uiAddCheck_Timer <= uiDiff)
{
CreatureList adds;
GetCreatureListWithEntryInGrid(adds, m_creature, NPC_ADD, 5.0f);
if (!adds.empty())
{
adds.clear();
GetCreatureListWithEntryInGrid(adds, m_creature, NPC_ADD, 45.0f);
for(CreatureList::iterator iter = adds.begin(); iter != adds.end(); ++iter)
{
if (!(*iter)->isAlive())
continue;
(*iter)->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
m_creature->CastSpell(*iter, SPELL_LINK, true);
m_creature->CastSpell(m_creature, SPELL_DMG, true);
}
m_uiPhase = 3;
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->RemoveAllAuras();
PullAll();
m_uiPullTimer = 15000;
m_uiSmashTimer = 17000;
m_uiCleaveTimer = urand(5000, 8000);
m_uiRange_Timer = 10000;
return;
}
m_uiAddCheck_Timer = 2000;
}else m_uiAddCheck_Timer -= uiDiff;
if (m_uiBlizzard_Timer <= uiDiff)
{
if (Unit* target = m_creature->SelectAttackingPlayer(ATTACKING_TARGET_RANDOM, 0))
DoCast(target,SPELL_BLIZZARD);
m_uiBlizzard_Timer = 10000;
}else m_uiBlizzard_Timer -= uiDiff;
//we dont wanna melee
return;
}
DoMeleeAttackIfReady();
}