本文整理汇总了C++中PlayerbotAI::HasSpellReagents方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::HasSpellReagents方法的具体用法?C++ PlayerbotAI::HasSpellReagents怎么用?C++ PlayerbotAI::HasSpellReagents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::HasSpellReagents方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Bless
bool PlayerbotPaladinAI::Bless(uint32 spellId, Unit *target)
{
if (spellId == 0)
return false;
PlayerbotAI * ai = GetAI();
if (spellId == BLESSING_OF_MIGHT)
{
if (GREATER_BLESSING_OF_MIGHT && ai->HasSpellReagents(GREATER_BLESSING_OF_MIGHT) && ai->Buff(GREATER_BLESSING_OF_MIGHT, target))
return true;
else
return ai->Buff(spellId, target);
}
else if (spellId == BLESSING_OF_WISDOM)
{
if (GREATER_BLESSING_OF_WISDOM && ai->HasSpellReagents(GREATER_BLESSING_OF_WISDOM) && ai->Buff(GREATER_BLESSING_OF_WISDOM, target))
return true;
else
return ai->Buff(spellId, target);
}
else if (spellId == BLESSING_OF_KINGS)
{
if (GREATER_BLESSING_OF_KINGS && ai->HasSpellReagents(GREATER_BLESSING_OF_KINGS) && ai->Buff(GREATER_BLESSING_OF_KINGS, target))
return true;
else
return ai->Buff(spellId, target);
}
else if (spellId == BLESSING_OF_SANCTUARY)
{
if (GREATER_BLESSING_OF_SANCTUARY && ai->HasSpellReagents(GREATER_BLESSING_OF_SANCTUARY) && ai->Buff(GREATER_BLESSING_OF_SANCTUARY, target))
return true;
else
return ai->Buff(spellId, target);
}
// Should not happen, but let it be here
return false;
}
示例2: 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);
//.........这里部分代码省略.........
示例3: DoNonCombatActions
void PlayerbotDruidAI::DoNonCombatActions()
{
Player* m_bot = GetPlayerBot();
Player* master = GetMaster();
if (!m_bot || !master)
return;
PlayerbotAI* ai = GetAI();
// mana check
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 && ai->GetManaPercent() < 30)
{
ai->TellMaster("I could use a drink.");
ai->UseItem(pItem);
return;
}
else if (!pItem && INNERVATE > 0 && !m_bot->HasAura(INNERVATE) && ai->GetManaPercent() <= 20 && ai->CastSpell(INNERVATE, *m_bot))
return;
// 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);
return;
}
else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
{
ai->TellMaster("I could use first aid.");
ai->UseItem(fItem);
return;
}
// buff and heal master's group
if (master->GetGroup())
{
// Buff master with group buff
if (!master->IsInDuel(master))
if (master->isAlive() && GIFT_OF_THE_WILD && ai->HasSpellReagents(GIFT_OF_THE_WILD) && ai->Buff(GIFT_OF_THE_WILD, master))
return;
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 == m_bot)
continue;
if (tPlayer->IsInDuelWith(master))
continue;
// Resurrect member if needed
if (!tPlayer->isAlive())
{
if (ai->CastSpell(REVIVE, *tPlayer))
{
std::string msg = "Resurrecting ";
msg += tPlayer->GetName();
m_bot->Say(msg, LANG_UNIVERSAL);
return;
}
else
continue;
}
else
{
// buff and heal
if (BuffPlayer(tPlayer))
return;
if (HealTarget(tPlayer))
return;
}
}
}
else
{
if (master->IsInDuel(master))
return;
if (master->isAlive())
{
if (BuffPlayer(master))
return;
if (HealTarget(master))
return;
}
else
if (ai->CastSpell(REVIVE, *master))
//.........这里部分代码省略.........
示例4: DoNonCombatActions
void PlayerbotPriestAI::DoNonCombatActions()
{
PlayerbotAI* ai = GetAI();
Player * m_bot = GetPlayerBot();
Player * master = GetMaster();
if (!m_bot || !master)
return;
SpellSequence = SPELL_HOLY;
// selfbuff goes first
if (ai->SelfBuff(INNER_FIRE))
return;
// mana check
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 != nullptr && ai->GetManaPercent() < 30)
{
ai->TellMaster("I could use a drink.");
ai->UseItem(pItem);
return;
}
// hp check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
pItem = ai->FindFood();
if (pItem != nullptr && ai->GetHealthPercent() < 30)
{
ai->TellMaster("I could use some food.");
ai->UseItem(pItem);
return;
}
else if (pItem == nullptr && fItem != nullptr && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
{
ai->TellMaster("I could use first aid.");
ai->UseItem(fItem);
return;
}
// buff and heal master's group
if (master->GetGroup())
{
// Buff master with group buffs
if (master->isAlive())
{
if (PRAYER_OF_FORTITUDE && ai->HasSpellReagents(PRAYER_OF_FORTITUDE) && ai->Buff(PRAYER_OF_FORTITUDE, master))
return;
if (PRAYER_OF_SPIRIT && ai->HasSpellReagents(PRAYER_OF_SPIRIT) && ai->Buff(PRAYER_OF_SPIRIT, master))
return;
if (PRAYER_OF_SHADOW_PROTECTION && ai->HasSpellReagents(PRAYER_OF_SHADOW_PROTECTION) && ai->Buff(PRAYER_OF_SHADOW_PROTECTION, master))
return;
}
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 == m_bot)
continue;
// first rezz em
if (!tPlayer->isAlive())
{
if (ai->CastSpell(RESURRECTION, *tPlayer))
{
std::string msg = "Resurrecting ";
msg += tPlayer->GetName();
m_bot->Say(msg, LANG_UNIVERSAL);
return;
}
else
continue;
}
else
{
// buff and heal
if (BuffPlayer(tPlayer))
return;
if (HealTarget(tPlayer))
return;
}
}
}
else
{
if (master->isAlive())
{
if (BuffPlayer(master))
return;
//.........这里部分代码省略.........
示例5: DoNonCombatActions
void PlayerbotDruidAI::DoNonCombatActions()
{
PlayerbotAI *ai = GetAI();
if (!ai)
return;
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
Player* m_master = ai->GetLeader();
if (!m_master)
return;
// mana check
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 && ai->GetManaPercent() < 30)
{
ai->UseItem(pItem);
return;
}
else if (!pItem && INNERVATE > 0 && !m_bot->HasAura(INNERVATE) && ai->GetManaPercent() <= 20 && ai->CastSpell(INNERVATE, m_bot))
return;
// 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->UseItem(pItem);
return;
}
else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
{
ai->UseItem(fItem);
return;
}
// buff and heal master's group
if (m_master->GetGroup())
{
// Buff master with group buff
if (m_master->isAlive() && GIFT_OF_THE_WILD && ai->HasSpellReagents(GIFT_OF_THE_WILD) && ai->Buff(GIFT_OF_THE_WILD, m_master))
return;
Group::MemberSlotList const& groupSlot = m_master->GetGroup()->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *tPlayer = sObjectMgr.GetPlayer(itr->guid);
if (!tPlayer || tPlayer == m_bot)
continue;
// Resurrect member if needed
if (!tPlayer->isAlive())
{
if (ai->CastSpell(REVIVE, tPlayer))
return;
else
continue;
}
else
{
// buff and heal
if (BuffPlayer(tPlayer))
return;
if (HealTarget(tPlayer))
return;
}
}
}
else
{
if (m_master->isAlive())
{
if (BuffPlayer(m_master))
return;
if (HealTarget(m_master))
return;
}
else
ai->CastSpell(REVIVE, m_master);
}
BuffPlayer(m_bot);
} // end DoNonCombatActions