本文整理汇总了C++中Group::GetTargetWithIconByGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::GetTargetWithIconByGroup方法的具体用法?C++ Group::GetTargetWithIconByGroup怎么用?C++ Group::GetTargetWithIconByGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::GetTargetWithIconByGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResetOrGetNextTarget
void bot_ai::ResetOrGetNextTarget()
{
if (master->GetBotMustDie()) return;
uint64 targetGUID = 0;
// check if anyone has raid target
//targetGUID = getTargetWithIcon();
Group *group = master->GetGroup();
targetGUID = group->GetTargetWithIconByGroup (m_creature->GetGUID());
if (targetGUID && targetGUID!=master->GetGUID())
{
Unit * target = m_creature->GetCreature(*master, targetGUID);
if (target && target->isAlive() && target->IsHostileTo(master) && target->isInCombat() /*&& m_creature->IsWithinDist(target, 30)*/)
{
BotAttackStart(target);
return;
}
}
AttackerSet m_attackers = master->getAttackers();
//check if anyone is attacking master
if(gettingAttacked(m_attackers)) return;
//check if anyone is attacking me
m_attackers = m_creature->getAttackers();
if(gettingAttacked(m_attackers)) return;
//check if master has a victim
if(master->getVictim() && master->getVictim()->IsHostileTo(master))
{
if(m_creature->IsWithinDist(m_creature->getVictim(), 50))
{
BotAttackStart(master->getVictim());
return;
}
}
//lastly check a random victim, including bots, pets, etc
Unit *target = DoSelectLowestHpFriendly(30);
if(target != NULL && target->isAlive() && !target->IsHostileToPlayers())
{
m_attackers = target->getAttackers();
if(gettingAttacked(m_attackers)) {
return;
}
}
//if there is no one to attack, make sure we are following master
if(m_creature->getVictim() == NULL &&
m_creature->GetCharmInfo()->GetCommandState() != COMMAND_STAY &&
master->GetDistance(m_creature) > 20 &&
!master->IsBeingTeleported())
{
if (!master->isAlive())
master->SetBotCommandState(COMMAND_STAY);
else if (master->GetBotCommandState()==COMMAND_ATTACK)
master->SetBotCommandState(prevCommandState);
return;
}
}