本文整理汇总了C++中PlayerbotAI::GetBaseManaPercent方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetBaseManaPercent方法的具体用法?C++ PlayerbotAI::GetBaseManaPercent怎么用?C++ PlayerbotAI::GetBaseManaPercent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetBaseManaPercent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoNonCombatActions
void PlayerbotMageAI::DoNonCombatActions()
{
Player * m_bot = GetPlayerBot();
Player * master = GetMaster();
if (!m_bot || !master)
return;
SpellSequence = SPELL_FROST;
PlayerbotAI* ai = GetAI();
// Buff armor
if (MOLTEN_ARMOR)
{
if (ai->SelfBuff(MOLTEN_ARMOR))
return;
}
else if (MAGE_ARMOR)
{
if (ai->SelfBuff(MAGE_ARMOR))
return;
}
else if (ICE_ARMOR)
{
if (ai->SelfBuff(ICE_ARMOR))
return;
}
else if (FROST_ARMOR)
if (ai->SelfBuff(FROST_ARMOR))
return;
// buff master's group
if (master->GetGroup())
{
// Buff master with group buff...
if (ARCANE_BRILLIANCE && ai->HasSpellReagents(ARCANE_BRILLIANCE))
if (ai->Buff(ARCANE_BRILLIANCE, master))
return;
// ...and check group for new members joined or resurrected, or just buff everyone if no group buff available
Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *tPlayer = sObjectMgr.GetPlayer(itr->guid);
if (!tPlayer || !tPlayer->isAlive() || tPlayer == m_bot)
continue;
// buff
if (BuffPlayer(tPlayer))
return;
}
}
// There is no group, buff master
else if (master->isAlive() && BuffPlayer(master))
return;
// Buff self finally
if (BuffPlayer(m_bot))
return;
// conjure food & water
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
Item* pItem = ai->FindDrink();
Item* fItem = ai->FindBandage();
if (pItem == NULL && CONJURE_WATER && ai->GetBaseManaPercent() >= 48)
{
ai->TellMaster("I'm conjuring some water.");
ai->CastSpell(CONJURE_WATER, *m_bot);
ai->SetIgnoreUpdateTime(3);
return;
}
else if (pItem != NULL && ai->GetManaPercent() < 30)
{
ai->TellMaster("I could use a drink.");
ai->UseItem(pItem);
return;
}
pItem = ai->FindFood();
if (pItem == NULL && CONJURE_FOOD && ai->GetBaseManaPercent() >= 48)
{
ai->TellMaster("I'm conjuring some food.");
ai->CastSpell(CONJURE_FOOD, *m_bot);
ai->SetIgnoreUpdateTime(3);
}
// hp check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
pItem = ai->FindFood();
if (pItem != NULL && ai->GetHealthPercent() < 30)
{
ai->TellMaster("I could use some food.");
ai->UseItem(pItem);
//.........这里部分代码省略.........
示例2: DoNonCombatActions
void PlayerbotMageAI::DoNonCombatActions()
{
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
SpellSequence = SPELL_FROST;
PlayerbotAI* ai = GetAI();
// buff myself
if (DALARAN_INTELLECT > 0)
(!m_bot->HasAura(DALARAN_INTELLECT, 0) && ai->GetManaPercent() >= 31 && ai->CastSpell (DALARAN_INTELLECT, *m_bot));
else if (ARCANE_INTELLECT > 0)
(!m_bot->HasAura(ARCANE_INTELLECT, 0) && !m_bot->HasAura(DALARAN_INTELLECT, 0) && ai->GetManaPercent() >= 37 && ai->CastSpell (ARCANE_INTELLECT, *m_bot));
if (MAGE_ARMOR > 0)
(!m_bot->HasAura(MAGE_ARMOR, 0) && ai->GetManaPercent() >= 31 && ai->CastSpell (MAGE_ARMOR, *m_bot));
else if (ICE_ARMOR > 0)
(!m_bot->HasAura(ICE_ARMOR, 0) && !m_bot->HasAura(MAGE_ARMOR, 0) && ai->GetManaPercent() >= 34 && ai->CastSpell (ICE_ARMOR, *m_bot));
else if (FROST_ARMOR > 0)
(!m_bot->HasAura(FROST_ARMOR, 0) && !m_bot->HasAura(MAGE_ARMOR, 0) && !m_bot->HasAura(ICE_ARMOR, 0) && ai->GetManaPercent() >= 34 && ai->CastSpell (FROST_ARMOR, *m_bot));
// buff master's group
if (GetMaster()->GetGroup())
{
Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *tPlayer = objmgr.GetPlayer(uint64 (itr->guid));
if( !tPlayer || !tPlayer->isAlive() )
continue;
// buff
(!tPlayer->HasAura(ARCANE_INTELLECT,0) && !tPlayer->HasAura(DALARAN_INTELLECT,0) && ai->GetManaPercent() >= 37 && ai->CastSpell (ARCANE_INTELLECT, *tPlayer));
(!tPlayer->HasAura(DALARAN_INTELLECT,0) && ai->GetManaPercent() >= 31 && ai->CastSpell (DALARAN_INTELLECT, *tPlayer));
(!tPlayer->HasAura(DAMPEN_MAGIC,0) && !tPlayer->HasAura(AMPLIFY_MAGIC,0) && ai->GetManaPercent() >= 32 && ai->CastSpell (DAMPEN_MAGIC, *tPlayer));
(!tPlayer->HasAura(AMPLIFY_MAGIC,0) && !tPlayer->HasAura(DAMPEN_MAGIC,0) && ai->GetManaPercent() >= 32 && ai->CastSpell (AMPLIFY_MAGIC, *tPlayer));
}
}
// conjure food & water
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
Item* pItem = ai->FindDrink();
if (pItem == NULL && CONJURE_WATER && ai->GetBaseManaPercent() >= 48)
{
ai->TellMaster("I'm conjuring some water.");
ai->CastSpell(CONJURE_WATER, *m_bot);
ai->SetIgnoreUpdateTime(3);
return;
}
else if (pItem != NULL && ai->GetManaPercent() < 15)
{
ai->TellMaster("I could use a drink.");
ai->UseItem(*pItem);
ai->SetIgnoreUpdateTime(30);
return;
}
pItem = ai->FindFood();
if (pItem == NULL && CONJURE_FOOD && ai->GetBaseManaPercent() >= 48)
{
ai->TellMaster("I'm conjuring some food.");
ai->CastSpell(CONJURE_FOOD, *m_bot);
ai->SetIgnoreUpdateTime(3);
}
// hp check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
pItem = ai->FindFood();
if (pItem != NULL && ai->GetHealthPercent() < 15)
{
ai->TellMaster("I could use some food.");
ai->UseItem(*pItem);
ai->SetIgnoreUpdateTime(30);
return;
}
} // end DoNonCombatActions