本文整理汇总了C++中Pet::GetAIInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::GetAIInterface方法的具体用法?C++ Pet::GetAIInterface怎么用?C++ Pet::GetAIInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pet
的用法示例。
在下文中一共展示了Pet::GetAIInterface方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLoad
void OnLoad()
{
if (_unit->IsPet())
{
Pet* s = TO< Pet* >(_unit);
Player* owner = s->GetPetOwner();
float owner_bonus = static_cast<float>(owner->GetDamageDoneMod(SCHOOL_SHADOW) * 0.375f); // 37.5%
s->BaseAttackType = SCHOOL_SHADOW; // Melee hits are supposed to do damage with the shadow school
s->SetBaseAttackTime(MELEE, 1500); // Shadowfiend is supposed to do 10 attacks, sometimes it can be 11
s->SetMinDamage(s->GetMinDamage() + owner_bonus);
s->SetMaxDamage(s->GetMaxDamage() + owner_bonus);
s->BaseDamage[0] += owner_bonus;
s->BaseDamage[1] += owner_bonus;
Unit* uTarget = s->GetMapMgr()->GetUnit(owner->GetTargetGUID());
if ((uTarget != NULL) && isAttackable(owner, uTarget))
{
s->GetAIInterface()->AttackReaction(uTarget, 1);
s->GetAIInterface()->setNextTarget(uTarget);
}
}
}
示例2: HandlePetCreateCommand
//.pet create
bool ChatHandler::HandlePetCreateCommand(const char* args, WorldSession* m_session)
{
Player* selected_player = GetSelectedPlayer(m_session, true, true);
if (selected_player == nullptr)
return true;
if (!*args)
return false;
uint32 entry = atol(args);
CreatureProperties const* creature_proto = sMySQLStore.GetCreatureProperties(entry);
if (creature_proto == nullptr)
{
RedSystemMessage(m_session, "Creature Entry: %u is not a valid endtry!", entry);
return true;
}
selected_player->DismissActivePets();
selected_player->RemoveFieldSummon();
float followangle = -M_PI_FLOAT * 2;
LocationVector vector(selected_player->GetPosition());
vector.x += (3 * (cosf(followangle + selected_player->GetOrientation())));
vector.y += (3 * (sinf(followangle + selected_player->GetOrientation())));
Pet* pet = objmgr.CreatePet(entry);
if (!pet->CreateAsSummon(entry, creature_proto, nullptr, selected_player, nullptr, 1, 0, &vector, true))
{
pet->DeleteMe();
return true;
}
pet->GetAIInterface()->SetUnitToFollowAngle(followangle);
if (selected_player != m_session->GetPlayer())
{
sGMLog.writefromsession(m_session, "used created pet with entry %u for player %s", entry, selected_player->GetName());
BlueSystemMessage(m_session, "Pet with entry %u created for player %s.", entry, selected_player->GetName());
BlueSystemMessage(selected_player->GetSession(), "%s created a pet with entry %u for you.", m_session->GetPlayer()->GetName(), entry);
}
else
{
BlueSystemMessage(m_session, "Pet with entry %u created.", entry);
}
return true;
}