本文整理汇总了C++中PlayerbotAI::FindConsumable方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::FindConsumable方法的具体用法?C++ PlayerbotAI::FindConsumable怎么用?C++ PlayerbotAI::FindConsumable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::FindConsumable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
void PlayerbotRogueAI::DoNonCombatActions()
{
PlayerbotAI *ai = GetAI();
if (!ai)
return;
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
// remove stealth
if (m_bot->HasAura(STEALTH))
m_bot->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
// hp check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
Item* pItem = ai->FindFood();
Item* fItem = ai->FindBandage();
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;
}
// Search and apply poisons to weapons
// Mainhand ...
Item * poison, * weapon;
weapon = m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
if (weapon && weapon->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT) == 0)
{
poison = ai->FindConsumable(INSTANT_POISON_DISPLAYID);
if (!poison)
poison = ai->FindConsumable(WOUND_POISON_DISPLAYID);
if (!poison)
poison = ai->FindConsumable(DEADLY_POISON_DISPLAYID);
if (poison)
{
ai->UseItem(poison, EQUIPMENT_SLOT_MAINHAND);
ai->SetIgnoreUpdateTime(5);
}
}
//... and offhand
weapon = m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if (weapon && weapon->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT) == 0)
{
poison = ai->FindConsumable(DEADLY_POISON_DISPLAYID);
if (!poison)
poison = ai->FindConsumable(WOUND_POISON_DISPLAYID);
if (!poison)
poison = ai->FindConsumable(INSTANT_POISON_DISPLAYID);
if (poison)
{
ai->UseItem(poison, EQUIPMENT_SLOT_OFFHAND);
ai->SetIgnoreUpdateTime(5);
}
}
} // end DoNonCombatActions
示例3: DoNonCombatActions
void PlayerbotWarlockAI::DoNonCombatActions()
{
SpellSequence = SPELL_CURSES;
PlayerbotAI *ai = GetAI();
Player * m_bot = GetPlayerBot();
if (!ai || !m_bot)
return;
Pet *pet = m_bot->GetPet();
// Initialize pet spells
if (pet && pet->GetEntry() != m_lastDemon)
{
switch (pet->GetEntry())
{
case DEMON_IMP:
{
BLOOD_PACT = ai->initPetSpell(BLOOD_PACT_ICON);
FIREBOLT = ai->initPetSpell(FIREBOLT_ICON);
FIRE_SHIELD = ai->initPetSpell(FIRE_SHIELD_ICON);
break;
}
case DEMON_VOIDWALKER:
{
CONSUME_SHADOWS = ai->initPetSpell(CONSUME_SHADOWS_ICON);
SACRIFICE = ai->initPetSpell(SACRIFICE_ICON);
SUFFERING = ai->initPetSpell(SUFFERING_ICON);
TORMENT = ai->initPetSpell(TORMENT_ICON);
break;
}
case DEMON_SUCCUBUS:
{
LASH_OF_PAIN = ai->initPetSpell(LASH_OF_PAIN_ICON);
SEDUCTION = ai->initPetSpell(SEDUCTION_ICON);
SOOTHING_KISS = ai->initPetSpell(SOOTHING_KISS_ICON);
break;
}
case DEMON_FELHUNTER:
{
DEVOUR_MAGIC = ai->initPetSpell(DEVOUR_MAGIC_ICON);
FEL_INTELLIGENCE = ai->initPetSpell(FEL_INTELLIGENCE_ICON);
SHADOW_BITE = ai->initPetSpell(SHADOW_BITE_ICON);
SPELL_LOCK = ai->initPetSpell(SPELL_LOCK_ICON);
break;
}
case DEMON_FELGUARD:
{
ANGUISH = ai->initPetSpell(ANGUISH_ICON);
CLEAVE = ai->initPetSpell(CLEAVE_ICON);
INTERCEPT = ai->initPetSpell(INTERCEPT_ICON);
break;
}
}
m_lastDemon = pet->GetEntry();
if (!m_isTempImp)
m_demonOfChoice = pet->GetEntry();
}
// Destroy extra soul shards
uint8 shardCount = m_bot->GetItemCount(SOUL_SHARD, false, NULL);
uint8 freeSpace = ai->GetFreeBagSpace();
if (shardCount > MAX_SHARD_COUNT || (freeSpace == 0 && shardCount > 1))
m_bot->DestroyItemCount(SOUL_SHARD, shardCount > MAX_SHARD_COUNT ? shardCount - MAX_SHARD_COUNT : 1, true, false);
// buff myself DEMON_SKIN, DEMON_ARMOR, FEL_ARMOR
if (FEL_ARMOR)
{
if (ai->SelfBuff(FEL_ARMOR))
return;
}
else if (DEMON_ARMOR)
{
if (ai->SelfBuff(DEMON_ARMOR))
return;
}
else if (DEMON_SKIN)
if (ai->SelfBuff(DEMON_SKIN))
return;
// healthstone creation
if (CREATE_HEALTHSTONE && shardCount > 0)
{
Item* const healthStone = ai->FindConsumable(HEALTHSTONE_DISPLAYID);
if (!healthStone && ai->CastSpell(CREATE_HEALTHSTONE))
return;
}
// soulstone creation and use
if (CREATE_SOULSTONE)
{
Item* soulStone = ai->FindConsumable(SOULSTONE_DISPLAYID);
if (!soulStone)
{
if (shardCount > 0 && !m_bot->HasSpellCooldown(CREATE_SOULSTONE) && ai->CastSpell(CREATE_SOULSTONE))
return;
}
else
//.........这里部分代码省略.........