本文整理汇总了C++中Pet::AttackStop方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::AttackStop方法的具体用法?C++ Pet::AttackStop怎么用?C++ Pet::AttackStop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pet
的用法示例。
在下文中一共展示了Pet::AttackStop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandlePetAction
//.........这里部分代码省略.........
petUnit->Attack(targetUnit, true);
}
break;
}
case COMMAND_ABANDON:
_player->Uncharm();
break;
default:
sLog.outError("PetHandler: Not allowed action %i and spellid %i. Pet %s owner is %s", uint32(flag), spellid, petUnit->GetGuidStr().c_str(), _player->GetGuidStr().c_str());
break;
}
return;
}
// only real pet should go there
if (!pet)
{
sLog.outError("PetHandler: A not pet trying to do unknown Action %i and spellid %i. Pet %s owner is %s", uint32(flag), spellid, petUnit->GetGuidStr().c_str(), _player->GetGuidStr().c_str());
return;
}
switch (flag)
{
case ACT_COMMAND: // 0x07
switch (spellid)
{
case COMMAND_STAY: // flat=1792 // STAY
{
if (!petUnit->hasUnitState(UNIT_STAT_CONTROLLED))
{
petUnit->StopMoving();
petUnit->GetMotionMaster()->Clear();
}
petUnit->AttackStop(true, true);
pet->SetIsRetreating();
pet->SetStayPosition(true);
pet->SetSpellOpener();
charmInfo->SetCommandState(COMMAND_STAY);
break;
}
case COMMAND_FOLLOW: // spellid=1792 // FOLLOW
{
if (!petUnit->hasUnitState(UNIT_STAT_CONTROLLED))
{
petUnit->StopMoving();
petUnit->GetMotionMaster()->Clear();
pet->SetIsRetreating(true);
}
petUnit->AttackStop(true, true);
pet->SetStayPosition();
pet->SetSpellOpener();
charmInfo->SetCommandState(COMMAND_FOLLOW);
break;
}
case COMMAND_ATTACK: // spellid=1792 // ATTACK
{
pet->SetIsRetreating();
pet->SetSpellOpener();
Unit* targetUnit = targetGuid ? _player->GetMap()->GetUnit(targetGuid) : nullptr;
if (targetUnit && targetUnit != petUnit && targetUnit->isTargetableForAttack() && targetUnit->isInAccessablePlaceFor((Creature*)petUnit))
{
_player->SetInCombatState(true, targetUnit);
// This is true if pet has no target or has target but targets differs.