本文整理汇总了C++中Player::AI方法的典型用法代码示例。如果您正苦于以下问题:C++ Player::AI方法的具体用法?C++ Player::AI怎么用?C++ Player::AI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::AI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnApply
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
return;
Player* pTarget = GetTarget()->ToPlayer();
oldAI = pTarget->AI();
oldAIState = pTarget->IsAIEnabled;
GetTarget()->SetAI(new player_overlord_brandAI(pTarget, GetCasterGUID()));
GetTarget()->IsAIEnabled = true;
}
示例2: UpdateAI
void UpdateAI(const uint32 diff)
{
if(InciteChaos)
{
if(InciteChaosWait_Timer < diff)
{
InciteChaos = false;
DoZoneInCombat();
DoResetThreat();
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true);
if(target)
AttackStart(target);
}
else
InciteChaosWait_Timer -= diff;
return;
}
if (!UpdateVictim())
return;
else
TrashAggro();
if(InciteChaos_Timer < diff)
{
DoCast(me, SPELL_INCITE_CHAOS);
Map *map = me->GetMap();
Map::PlayerList const &PlayerList = map->GetPlayers();
if(PlayerList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
Player *plr = i->getSource();
Player *target = (Player*)SelectUnit(SELECT_TARGET_RANDOM, 0, 100, true, plr->GetGUID());
if(plr && plr->IsAIEnabled && target)
plr->AI()->AttackStart(target);
}
//DoResetThreat();
InciteChaos = true;
InciteChaos_Timer = 40000;
InciteChaosWait_Timer = 16000;
return;
}
else
InciteChaos_Timer -= diff;
//Charge_Timer
if (Charge_Timer < diff)
{
if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true))
DoCast(target, SPELL_CHARGE);
Charge_Timer = 25000;
}
else
Charge_Timer -= diff;
//Knockback_Timer
if (Knockback_Timer < diff)
{
DoCast(me, SPELL_WAR_STOMP);
Knockback_Timer = 20000;
}
else
Knockback_Timer -= diff;
DoMeleeAttackIfReady();
}