本文整理汇总了C++中PlayerbotAI::CastPetSpell方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::CastPetSpell方法的具体用法?C++ PlayerbotAI::CastPetSpell怎么用?C++ PlayerbotAI::CastPetSpell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::CastPetSpell方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoNextCombatManeuver
void PlayerbotWarlockAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
{
if (SHADOW_BOLT > 0)
ai->CastSpell(SHADOW_BOLT);
return;
}
default:
break;
}
// ------- Non Duel combat ----------
//ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob
ai->SetInFront(pTarget);
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
Pet *pet = m_bot->GetPet();
// Empower demon
if (pet && DEMONIC_EMPOWERMENT && !m_bot->HasSpellCooldown(DEMONIC_EMPOWERMENT))
ai->CastSpell(DEMONIC_EMPOWERMENT);
// Use voidwalker sacrifice on low health if possible
if (ai->GetHealthPercent() < 50)
if (pet && pet->GetEntry() == DEMON_VOIDWALKER && SACRIFICE && !m_bot->HasAura(SACRIFICE))
ai->CastPetSpell(SACRIFICE);
// Use healthstone
if (ai->GetHealthPercent() < 30)
{
Item* healthStone = ai->FindConsumable(HEALTHSTONE_DISPLAYID);
if (healthStone)
ai->UseItem(healthStone);
}
// Damage Spells
switch (SpellSequence)
{
case SPELL_CURSES:
if (CURSE_OF_AGONY && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(SHADOWFLAME) && LastSpellCurse < 1)
{
ai->CastSpell(CURSE_OF_AGONY, *pTarget);
SpellSequence = SPELL_AFFLICTION;
++LastSpellCurse;
break;
}
else if (CURSE_OF_THE_ELEMENTS && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(CURSE_OF_WEAKNESS) && LastSpellCurse < 2)
{
ai->CastSpell(CURSE_OF_THE_ELEMENTS, *pTarget);
SpellSequence = SPELL_AFFLICTION;
++LastSpellCurse;
break;
}
else if (CURSE_OF_WEAKNESS && !pTarget->HasAura(CURSE_OF_WEAKNESS) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS) && LastSpellCurse < 3)
{
ai->CastSpell(CURSE_OF_WEAKNESS, *pTarget);
SpellSequence = SPELL_AFFLICTION;
++LastSpellCurse;
break;
}
else if (CURSE_OF_TONGUES && !pTarget->HasAura(CURSE_OF_TONGUES) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(CURSE_OF_WEAKNESS) && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS) && LastSpellCurse < 4)
{
ai->CastSpell(CURSE_OF_TONGUES, *pTarget);
SpellSequence = SPELL_AFFLICTION;
++LastSpellCurse;
break;
}
LastSpellCurse = 0;
//SpellSequence = SPELL_AFFLICTION;
//break;
case SPELL_AFFLICTION:
if (LIFE_TAP && LastSpellAffliction < 1 && ai->GetManaPercent() <= 50 && ai->GetHealthPercent() > 50)
{
ai->CastSpell(LIFE_TAP, *m_bot);
SpellSequence = SPELL_DESTRUCTION;
++LastSpellAffliction;
break;
}
else if (CORRUPTION && !pTarget->HasAura(CORRUPTION) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(SEED_OF_CORRUPTION) && LastSpellAffliction < 2)
{
ai->CastSpell(CORRUPTION, *pTarget);
SpellSequence = SPELL_DESTRUCTION;
++LastSpellAffliction;
break;
}
else if (DRAIN_SOUL && pTarget->GetHealth() < pTarget->GetMaxHealth() * 0.40 && !pTarget->HasAura(DRAIN_SOUL) && LastSpellAffliction < 3)
{
ai->CastSpell(DRAIN_SOUL, *pTarget);
//ai->SetIgnoreUpdateTime(15);
SpellSequence = SPELL_DESTRUCTION;
//.........这里部分代码省略.........
示例2: DoNonCombatActions
//.........这里部分代码省略.........
// mana check
if (pet && DARK_PACT && pet->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() <= 50)
if (ai->CastSpell(DARK_PACT, *m_bot))
return;
if (LIFE_TAP && ai->GetManaPercent() <= 50 && ai->GetHealthPercent() > 50)
if (ai->CastSpell(LIFE_TAP, *m_bot))
return;
if (ai->GetManaPercent() < 25)
{
Item* pItem = ai->FindDrink();
if (pItem)
{
ai->TellMaster("I could use a drink.");
ai->UseItem(pItem);
return;
}
}
// hp check
if (ai->GetHealthPercent() < 30)
{
Item* pItem = ai->FindFood();
if (pItem)
{
ai->TellMaster("I could use some food.");
ai->UseItem(pItem);
return;
}
}
if (ai->GetHealthPercent() < 50 && !m_bot->HasAura(RECENTLY_BANDAGED))
{
Item* fItem = ai->FindBandage();
if (fItem)
{
ai->TellMaster("I could use first aid.");
ai->UseItem(fItem);
return;
}
}
//Heal Voidwalker
if (pet && pet->GetEntry() == DEMON_VOIDWALKER && CONSUME_SHADOWS && pet->GetHealthPercent() < 75 && !pet->HasAura(CONSUME_SHADOWS))
ai->CastPetSpell(CONSUME_SHADOWS);
// Summon demon
if (!pet || m_isTempImp)
{
uint32 summonSpellId;
if (m_demonOfChoice != DEMON_IMP && shardCount > 0)
{
switch (m_demonOfChoice)
{
case DEMON_VOIDWALKER:
summonSpellId = SUMMON_VOIDWALKER;
break;
case DEMON_FELGUARD:
summonSpellId = SUMMON_FELGUARD;
break;
case DEMON_FELHUNTER:
summonSpellId = SUMMON_FELHUNTER;
break;
case DEMON_SUCCUBUS:
summonSpellId = SUMMON_SUCCUBUS;
break;
default:
summonSpellId = 0;
}
if (ai->CastSpell(summonSpellId))
{
ai->TellMaster("Summoning favorite demon...");
m_isTempImp = false;
return;
}
}
else if (!pet && SUMMON_IMP && ai->CastSpell(SUMMON_IMP))
{
if (m_demonOfChoice != DEMON_IMP)
m_isTempImp = true;
ai->TellMaster("Summoning Imp...");
return;
}
}
// Soul link demon
if (pet && SOUL_LINK && !m_bot->HasAura(SOUL_LINK_AURA) && ai->CastSpell(SOUL_LINK, *m_bot))
return;
// Check demon buffs
if (pet && pet->GetEntry() == DEMON_IMP && BLOOD_PACT && !m_bot->HasAura(BLOOD_PACT) && ai->CastPetSpell(BLOOD_PACT))
return;
if (pet && pet->GetEntry() == DEMON_FELHUNTER && FEL_INTELLIGENCE && !m_bot->HasAura(FEL_INTELLIGENCE) && ai->CastPetSpell(FEL_INTELLIGENCE))
return;
} // end DoNonCombatActions