本文整理汇总了C++中PlayerbotAI::GetPlayerBot方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetPlayerBot方法的具体用法?C++ PlayerbotAI::GetPlayerBot怎么用?C++ PlayerbotAI::GetPlayerBot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetPlayerBot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoNextCombatManeuver
void PlayerbotPriestAI::DoNextCombatManeuver(Unit *pTarget)
{
Unit* pVictim = pTarget->getVictim();
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
(ai->HasAura(SCREAM,*pTarget) && ai->GetHealthPercent() < 60 && ai->CastSpell(HEAL)) ||
ai->CastSpell(PAIN) ||
(ai->GetHealthPercent() < 80 && ai->CastSpell(RENEW)) ||
(ai->GetPlayerBot()->GetDistance(pTarget) <= 5 && ai->CastSpell(SCREAM)) ||
ai->CastSpell(MIND_BLAST) ||
(ai->GetHealthPercent() < 20 && ai->CastSpell(GREAT_HEAL)) ||
ai->CastSpell(SMITE);
return;
}
// ------- Non Duel combat ----------
ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob
Player *m_bot = GetPlayerBot();
Group *m_group = m_bot->GetGroup();
// Heal myself
if (ai->GetHealthPercent() < 15 && FADE > 0 && !m_bot->HasAura(FADE, EFFECT_INDEX_0))
{
ai->TellMaster("I'm casting fade.");
ai->CastSpell(FADE, *m_bot);
}
else if (ai->GetHealthPercent() < 25 && PWS > 0 && !m_bot->HasAura(PWS, EFFECT_INDEX_0))
{
ai->TellMaster("I'm casting pws on myself.");
ai->CastSpell(PWS);
}
else if (ai->GetHealthPercent() < 35 && DESPERATE_PRAYER > 0)
{
ai->TellMaster("I'm casting desperate prayer.");
ai->CastSpell(DESPERATE_PRAYER, *m_bot);
}
else if (ai->GetHealthPercent() < 80)
HealTarget (*m_bot, ai->GetHealthPercent());
// Heal master
uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
if (GetMaster()->isAlive())
{
if (masterHP < 25 && PWS > 0 && !GetMaster()->HasAura(PWS, EFFECT_INDEX_0))
ai->CastSpell(PWS, *(GetMaster()));
else if (masterHP < 80)
HealTarget (*GetMaster(), masterHP);
}
// Heal group
if( m_group )
{
Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *m_groupMember = sObjectMgr.GetPlayer( itr->guid );
if( !m_groupMember || !m_groupMember->isAlive() )
continue;
uint32 memberHP = m_groupMember->GetHealth()*100 / m_groupMember->GetMaxHealth();
if( memberHP < 25 )
HealTarget( *m_groupMember, memberHP );
}
}
// Damage Spells
ai->SetInFront( pTarget );
float dist = m_bot->GetDistance( pTarget );
switch (SpellSequence)
{
case SPELL_HOLY:
if (SMITE > 0 && LastSpellHoly <1 && !pTarget->HasAura(SMITE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 17)
{
ai->CastSpell(SMITE, *pTarget);
SpellSequence = SPELL_SHADOWMAGIC;
LastSpellHoly = LastSpellHoly +1;
break;
}
else if (MANA_BURN > 0 && LastSpellHoly <2 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 14)
{
//ai->TellMaster("I'm casting mana burn.");
ai->CastSpell(MANA_BURN, *pTarget);
ai->SetIgnoreUpdateTime(3);
SpellSequence = SPELL_SHADOWMAGIC;
LastSpellHoly = LastSpellHoly +1;
break;
}
else if (HOLY_NOVA > 0 && LastSpellHoly <3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 22)
{
//ai->TellMaster("I'm casting holy nova.");
ai->CastSpell(HOLY_NOVA);
SpellSequence = SPELL_SHADOWMAGIC;
//.........这里部分代码省略.........
示例2: DoNextCombatManeuver
void PlayerbotPriestAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
(ai->HasAura(SCREAM,*pTarget) && ai->GetHealthPercent() < 60 && ai->CastSpell(HEAL)) ||
ai->CastSpell(PAIN) ||
(ai->GetHealthPercent() < 80 && ai->CastSpell(RENEW)) ||
(ai->GetPlayerBot()->GetDistance(pTarget) <= 5 && ai->CastSpell(SCREAM)) ||
ai->CastSpell(MIND_BLAST) ||
(ai->GetHealthPercent() < 20 && ai->CastSpell(FLASH_HEAL)) ||
ai->CastSpell(SMITE);
return;
}
// ------- Non Duel combat ----------
ai->Follow(*GetMaster()); // dont want to melee mob
Player *m_bot = GetPlayerBot();
Group *m_group = m_bot->GetGroup();
// Heal myself
if (ai->GetHealthPercent() < 15 && FADE > 0 && !m_bot->HasAura(FADE, 0))
{
GetAI()->TellMaster("I'm casting fade");
ai->CastSpell(FADE);
}
else if (ai->GetHealthPercent() < 25 && PWS > 0 && !m_bot->HasAura(PWS, 0))
{
GetAI()->TellMaster("I'm casting pws on myself.");
ai->CastSpell(PWS);
}
else if (ai->GetHealthPercent() < 80)
HealTarget (*m_bot, ai->GetHealthPercent());
// Heal master
uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
if (GetMaster()->isAlive())
{
if (masterHP < 25 && PWS > 0 && !GetMaster()->HasAura(PWS, 0))
ai->CastSpell(PWS, *(GetMaster()));
else if (masterHP < 80)
HealTarget (*GetMaster(), masterHP);
}
// Heal group
if( m_group )
{
Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *m_groupMember = objmgr.GetPlayer( itr->guid );
if( !m_groupMember || !m_groupMember->isAlive() )
continue;
uint32 memberHP = m_groupMember->GetHealth()*100 / m_groupMember->GetMaxHealth();
if( memberHP < 25 )
HealTarget( *m_groupMember, memberHP );
}
}
// Damage Spells
ai->SetInFront( pTarget );
switch (SpellSequence)
{
case SPELL_HOLY:
if (SMITE > 0 && LastSpellHoly <= 1 && ai->GetManaPercent() >= 60)
{
ai->CastSpell(SMITE);
SpellSequence = SPELL_SHADOWMAGIC;
LastSpellHoly = LastSpellHoly +1;
break;
}
else if (CLEARCASTING > 0 && LastSpellHoly <2 && ai->GetManaPercent() >= 60)
{
GetAI()->TellMaster("I'm casting clearcasting");
ai->CastSpell(CLEARCASTING, *pTarget);
SpellSequence = SPELL_SHADOWMAGIC;
LastSpellHoly = LastSpellHoly +1;
break;
}
else if (HOLY_NOVA > 0 && LastSpellHoly <3 && ai->GetManaPercent() >= 60)
{
GetAI()->TellMaster("I'm casting holy nova");
ai->CastSpell(HOLY_NOVA);
SpellSequence = SPELL_SHADOWMAGIC;
LastSpellHoly = LastSpellHoly +1;
break;
}
else if (HOLY_FIRE > 0 && LastSpellHoly <4 && ai->GetManaPercent() >= 60)
{
GetAI()->TellMaster("I'm casting holy fire");
ai->CastSpell(HOLY_FIRE, *pTarget);
SpellSequence = SPELL_SHADOWMAGIC;
//.........这里部分代码省略.........
示例3: DoNextCombatManeuver
void PlayerbotPriestAI::DoNextCombatManeuver(Unit *pTarget)
{
Unit* pVictim = pTarget->getVictim();
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_PVP_DUEL:
(ai->HasAura(SCREAM, *pTarget) && ai->GetHealthPercent() < 60 && ai->CastSpell(HEAL)) ||
ai->CastSpell(SHADOW_WORD_PAIN) ||
(ai->GetHealthPercent() < 80 && ai->CastSpell(RENEW)) ||
(ai->GetPlayerBot()->GetDistance(pTarget) <= 5 && ai->CastSpell(SCREAM)) ||
ai->CastSpell(MIND_BLAST) ||
(ai->GetHealthPercent() < 50 && ai->CastSpell(GREATER_HEAL)) ||
ai->CastSpell(SMITE);
return;
default:
break;
}
// ------- Non Duel combat ----------
Player *m_bot = GetPlayerBot();
Group *m_group = m_bot->GetGroup();
bool meleeReach = m_bot->CanReachWithMeleeAttack(pTarget);
if (ai->GetCombatStyle() != PlayerbotAI::COMBAT_RANGED && !meleeReach)
ai->SetCombatStyle(PlayerbotAI::COMBAT_RANGED);
// if in melee range OR can't shoot OR have no ranged (wand) equipped
else if (ai->GetCombatStyle() != PlayerbotAI::COMBAT_MELEE
&& (meleeReach || SHOOT == 0 || !m_bot->GetWeaponForAttack(RANGED_ATTACK, true, true))
&& !ai->IsHealer())
ai->SetCombatStyle(PlayerbotAI::COMBAT_MELEE);
if (SHOOT > 0 && ai->GetCombatStyle() == PlayerbotAI::COMBAT_RANGED && !m_bot->FindCurrentSpellBySpellId(SHOOT))
ai->CastSpell(SHOOT, *pTarget);
//ai->TellMaster( "started auto shot." );
else if (SHOOT > 0 && m_bot->FindCurrentSpellBySpellId(SHOOT))
m_bot->InterruptNonMeleeSpells(true, SHOOT);
// Heal myself
if (ai->GetHealthPercent() < 15 && FADE > 0 && !m_bot->HasAura(FADE, EFFECT_INDEX_0))
{
ai->TellMaster("I'm casting fade.");
ai->CastSpell(FADE, *m_bot);
}
else if (ai->GetHealthPercent() < 25 && POWER_WORD_SHIELD > 0 && !m_bot->HasAura(POWER_WORD_SHIELD, EFFECT_INDEX_0))
{
ai->TellMaster("I'm casting pws on myself.");
ai->CastSpell(POWER_WORD_SHIELD);
}
else if (ai->GetHealthPercent() < 35 && DESPERATE_PRAYER > 0)
{
ai->TellMaster("I'm casting desperate prayer.");
ai->CastSpell(DESPERATE_PRAYER, *m_bot);
}
else if (ai->GetHealthPercent() < 80)
HealTarget (m_bot);
// Heal master
uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
if (GetMaster()->isAlive())
{
if (masterHP < 25 && POWER_WORD_SHIELD > 0 && !GetMaster()->HasAura(POWER_WORD_SHIELD, EFFECT_INDEX_0))
ai->CastSpell(POWER_WORD_SHIELD, *(GetMaster()));
else if (masterHP < 80)
HealTarget (GetMaster());
}
// Heal group
if (m_group)
{
Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *m_groupMember = sObjectMgr.GetPlayer(itr->guid);
if (!m_groupMember || !m_groupMember->isAlive())
continue;
uint32 memberHP = m_groupMember->GetHealth() * 100 / m_groupMember->GetMaxHealth();
if (memberHP < 25)
HealTarget(m_groupMember);
}
}
// Damage Spells
switch (SpellSequence)
{
case SPELL_HOLY:
if (SMITE > 0 && ai->In_Reach(pTarget,SMITE) && LastSpellHoly < 1 && !pTarget->HasAura(SMITE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 17)
{
ai->CastSpell(SMITE, *pTarget);
SpellSequence = SPELL_SHADOWMAGIC;
LastSpellHoly = LastSpellHoly + 1;
break;
}
else if (MANA_BURN > 0 && ai->In_Reach(pTarget,MANA_BURN) && LastSpellHoly < 2 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 14)
{
//ai->TellMaster("I'm casting mana burn.");
//.........这里部分代码省略.........