本文整理汇总了C++中PlayerbotAI::UseItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::UseItem方法的具体用法?C++ PlayerbotAI::UseItem怎么用?C++ PlayerbotAI::UseItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::UseItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoNonCombatActions
void PlayerbotDeathKnightAI::DoNonCombatActions()
{
PlayerbotAI* ai = GetAI();
Player *m_bot = GetPlayerBot();
if (!m_bot)
return;
SpellSequence = SPELL_DK_UNHOLY;
// buff master with HORN_OF_WINTER
if (HORN_OF_WINTER> 0)
(!GetMaster()->HasAura(HORN_OF_WINTER,0) && ai->CastSpell (HORN_OF_WINTER, *GetMaster()));
// 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);
ai->SetIgnoreUpdateTime(30);
return;
}
else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, 0) && ai->GetHealthPercent() < 70)
{
ai->TellMaster("I could use first aid.");
ai->UseItem(*fItem);
ai->SetIgnoreUpdateTime(8);
return;
}
} // end DoNonCombatActions
示例2: DoNonCombatActions
void PlayerbotWarriorAI::DoNonCombatActions()
{
PlayerbotAI *ai = GetAI();
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
// TODO (by Runsttren): check if shout aura bot has is casted by this bot,
// otherwise cast other useful shout
// If the bot is protect talented, she/he needs stamina not attack power.
// With stance change can the shout change to.
// Inserted line to battle shout m_bot->HasAura( COMMANDING_SHOUT, EFFECT_INDEX_0)
// Natsukawa
if (((COMMANDING_SHOUT > 0 && !m_bot->HasAura(COMMANDING_SHOUT, EFFECT_INDEX_0)) ||
(BATTLE_SHOUT > 0 && !m_bot->HasAura(BATTLE_SHOUT, EFFECT_INDEX_0))) &&
ai->GetRageAmount() < 10 && BLOODRAGE > 0 && !m_bot->HasAura(BLOODRAGE, EFFECT_INDEX_0))
// we do have a useful shout, no rage coming but can cast bloodrage... do it
ai->CastSpell(BLOODRAGE, *m_bot);
else if (COMMANDING_SHOUT > 0 && !m_bot->HasAura(COMMANDING_SHOUT, EFFECT_INDEX_0))
// use commanding shout now
ai->CastSpell(COMMANDING_SHOUT, *m_bot);
else if (BATTLE_SHOUT > 0 && !m_bot->HasAura(BATTLE_SHOUT, EFFECT_INDEX_0) && !m_bot->HasAura(COMMANDING_SHOUT, EFFECT_INDEX_0))
// use battle shout
ai->CastSpell(BATTLE_SHOUT, *m_bot);
// buff master with VIGILANCE
if (VIGILANCE > 0)
(!GetMaster()->HasAura(VIGILANCE, EFFECT_INDEX_0) && ai->CastSpell(VIGILANCE, *GetMaster()));
// 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;
}
else if (pItem == NULL && fItem == NULL && m_bot->getRace() == RACE_DRAENEI && !m_bot->HasAura(GIFT_OF_THE_NAARU, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
{
ai->TellMaster("I'm casting gift of the naaru.");
ai->CastSpell(GIFT_OF_THE_NAARU, *m_bot);
return;
}
} // end DoNonCombatActions
示例3: DoNonCombatActions
//.........这里部分代码省略.........
}
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
{
uint32 soulStoneSpell = soulStone->GetProto()->Spells[0].SpellId;
Player * master = GetMaster();
if (!master->HasAura(soulStoneSpell) && !m_bot->HasSpellCooldown(soulStoneSpell))
{
ai->UseItem(soulStone, master);
return;
}
}
}
// firestone creation and use
Item* const weapon = m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
if (weapon && weapon->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT) == 0)
{
Item* const stone = ai->FindConsumable(FIRESTONE_DISPLAYID);
if (!stone)
{
if (CREATE_FIRESTONE && shardCount > 0 && ai->CastSpell(CREATE_FIRESTONE))
return;
}
else
{
ai->UseItem(stone, EQUIPMENT_SLOT_MAINHAND);
return;
}
}
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
// 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))
示例4: DoNonCombatActions
void PlayerbotShamanAI::DoNonCombatActions()
{
PlayerbotAI* ai = GetAI();
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
SpellSequence = SPELL_ENHANCEMENT;
// buff master with EARTH_SHIELD
if (EARTH_SHIELD > 0)
(!GetMaster()->HasAura(EARTH_SHIELD, EFFECT_INDEX_0) && ai->CastSpell(EARTH_SHIELD, *(GetMaster())));
// buff myself with WATER_SHIELD, LIGHTNING_SHIELD
if (WATER_SHIELD > 0)
(!m_bot->HasAura(WATER_SHIELD, EFFECT_INDEX_0) && !m_bot->HasAura(LIGHTNING_SHIELD, EFFECT_INDEX_0) && ai->CastSpell(WATER_SHIELD, *m_bot));
else if (LIGHTNING_SHIELD > 0)
(!m_bot->HasAura(LIGHTNING_SHIELD, EFFECT_INDEX_0) && !m_bot->HasAura(WATER_SHIELD, EFFECT_INDEX_0) && ai->CastSpell(LIGHTNING_SHIELD, *m_bot));
/*
// buff myself weapon
if (ROCKBITER_WEAPON > 0)
(!m_bot->HasAura(ROCKBITER_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(EARTHLIVING_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(WINDFURY_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(FROSTBRAND_WEAPON, EFFECT_INDEX_0) && ai->CastSpell(ROCKBITER_WEAPON,*m_bot) );
else if (EARTHLIVING_WEAPON > 0)
(!m_bot->HasAura(EARTHLIVING_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(EARTHLIVING_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(FROSTBRAND_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(ROCKBITER_WEAPON, EFFECT_INDEX_0) && ai->CastSpell(WINDFURY_WEAPON,*m_bot) );
else if (WINDFURY_WEAPON > 0)
(!m_bot->HasAura(WINDFURY_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(EARTHLIVING_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(FROSTBRAND_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(ROCKBITER_WEAPON, EFFECT_INDEX_0) && ai->CastSpell(WINDFURY_WEAPON,*m_bot) );
else if (FLAMETONGUE_WEAPON > 0)
(!m_bot->HasAura(FLAMETONGUE_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(EARTHLIVING_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(WINDFURY_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(FROSTBRAND_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(ROCKBITER_WEAPON, EFFECT_INDEX_0) && ai->CastSpell(FLAMETONGUE_WEAPON,*m_bot) );
else if (FROSTBRAND_WEAPON > 0)
(!m_bot->HasAura(FROSTBRAND_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(EARTHLIVING_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(WINDFURY_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, EFFECT_INDEX_0) && !m_bot->HasAura(ROCKBITER_WEAPON, EFFECT_INDEX_0) && ai->CastSpell(FROSTBRAND_WEAPON,*m_bot) );
*/
// 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;
}
// 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;
}
// heal 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 = sObjectMgr.GetPlayer(itr->guid);
if (!tPlayer || !tPlayer->isAlive())
continue;
if (tPlayer->IsInDuelWith(GetMaster()))
continue;
// heal
(HealTarget(*tPlayer, tPlayer->GetHealth() * 100 / tPlayer->GetMaxHealth()));
}
}
} // end DoNonCombatActions
示例5: 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
示例6: DoNonCombatActions
void PlayerbotHunterAI::DoNonCombatActions()
{
PlayerbotAI *ai = GetAI();
if (!ai)
return;
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
// reset ranged combat state
if (!m_rangedCombat)
m_rangedCombat = true;
// buff group
if (TRUESHOT_AURA > 0)
(!m_bot->HasAura(TRUESHOT_AURA, EFFECT_INDEX_0) && ai->CastSpell (TRUESHOT_AURA, *m_bot));
// buff myself
if (ASPECT_OF_THE_HAWK > 0)
(!m_bot->HasAura(ASPECT_OF_THE_HAWK, EFFECT_INDEX_0) && ai->CastSpell (ASPECT_OF_THE_HAWK, *m_bot));
// 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;
}
// 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;
}
// check for pet
if (PET_SUMMON > 0 && !m_petSummonFailed && HasPet(m_bot))
{
// we can summon pet, and no critical summon errors before
Pet *pet = m_bot->GetPet();
if (!pet)
{
// summon pet
if (PET_SUMMON > 0 && ai->CastSpell(PET_SUMMON, *m_bot))
ai->TellMaster("summoning pet.");
else
{
m_petSummonFailed = true;
ai->TellMaster("summon pet failed!");
}
}
else if (pet->getDeathState() != ALIVE)
{
// revive pet
if (PET_REVIVE > 0 && ai->GetManaPercent() >= 80 && ai->CastSpell(PET_REVIVE, *m_bot))
ai->TellMaster("reviving pet.");
}
else if (((float) pet->GetHealth() / (float) pet->GetMaxHealth()) < 0.5f)
{
// heal pet when health lower 50%
if (PET_MEND > 0 && !pet->getDeathState() != ALIVE && !pet->HasAura(PET_MEND, EFFECT_INDEX_0) && ai->GetManaPercent() >= 13 && ai->CastSpell(PET_MEND, *m_bot))
ai->TellMaster("healing pet.");
}
else if (pet->GetHappinessState() != HAPPY) // if pet is hungry
{
Unit *caster = (Unit *) m_bot;
// list out items in main backpack
for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++)
{
Item* const pItem = m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
if (pItem)
{
const ItemPrototype* const pItemProto = pItem->GetProto();
if (!pItemProto)
continue;
if (pet->HaveInDiet(pItemProto)) // is pItem in pets diet
{
// DEBUG_LOG ("[PlayerbotHunterAI]: DoNonCombatActions - Food for pet: %s",pItemProto->Name1);
caster->CastSpell(caster, 51284, true); // pet feed visual
//.........这里部分代码省略.........
示例7: DoNonCombatActions
void PlayerbotPaladinAI::DoNonCombatActions()
{
PlayerbotAI* ai = GetAI();
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
// Buff myself
if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_TANK) ai->SelfBuff(RIGHTEOUS_FURY);
if (SEAL_OF_WISDOM > 0 && !m_bot->HasAura(SEAL_OF_WISDOM, EFFECT_INDEX_0) && ai->GetManaPercent() <= 30)
ai->CastSpell(SEAL_OF_WISDOM, *m_bot);
else if (m_bot->HasAura(SEAL_OF_WISDOM, EFFECT_INDEX_0) && ai->GetManaPercent() < 85)
{ }
else if (SEAL_OF_LIGHT > 0 && !m_bot->HasAura(SEAL_OF_LIGHT, EFFECT_INDEX_0) && ai->GetHealthPercent() < 40)
ai->CastSpell(SEAL_OF_LIGHT, *m_bot);
else if (SEAL_OF_RIGHTEOUSNESS > 0 && !m_bot->HasAura(SEAL_OF_RIGHTEOUSNESS, EFFECT_INDEX_0))
ai->CastSpell(SEAL_OF_RIGHTEOUSNESS, *m_bot);
BuffPlayer(m_bot);
// Buff master
if(!GetMaster()->IsInDuel(GetMaster()))
BuffPlayer(GetMaster());
// 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() < 40)
{
ai->TellMaster("I could use a drink.");
ai->UseItem(pItem);
return;
}
// hp check original
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
pItem = ai->FindFood();
if (pItem != NULL && ai->GetHealthPercent() < 40)
{
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;
}
// heal and buff group
if (GetMaster()->GetGroup())
{
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)
continue;
if (tPlayer->IsInDuelWith(GetMaster()))
continue;
if (!tPlayer->isAlive())
{
if (ai->CastSpell(REDEMPTION, *tPlayer))
{
std::string msg = "Resurrecting ";
msg += tPlayer->GetName();
m_bot->Say(msg, LANG_UNIVERSAL);
return;
}
else
continue;
}
if (HealTarget(tPlayer))
return;
if (tPlayer != m_bot && tPlayer != GetMaster())
if (BuffPlayer(tPlayer))
return;
}
}
}
示例8: DoNonCombatActions
void PlayerbotPriestAI::DoNonCombatActions()
{
PlayerbotAI* ai = GetAI();
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
SpellSequence = SPELL_HOLY;
// buff myself
if (FORTITUDE > 0)
(!m_bot->HasAura(FORTITUDE, EFFECT_INDEX_0) && ai->CastSpell (FORTITUDE, *m_bot));
if (INNER_FIRE > 0)
(!m_bot->HasAura(INNER_FIRE, EFFECT_INDEX_0) && ai->CastSpell (INNER_FIRE, *m_bot));
// buff master
if (FORTITUDE > 0)
(!GetMaster()->HasAura(FORTITUDE, EFFECT_INDEX_0) && ai->CastSpell(FORTITUDE,*(GetMaster())) );
// 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);
ai->SetIgnoreUpdateTime(30);
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);
ai->SetIgnoreUpdateTime(30);
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);
ai->SetIgnoreUpdateTime(8);
return;
}
// buff and heal 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 = sObjectMgr.GetPlayer(itr->guid);
if( !tPlayer )
continue;
// first rezz em
if ( !tPlayer->isAlive() && !tPlayer->GetPlayerbotAI() )
{
std::string msg = "rezzing ";
msg += tPlayer->GetName();
GetPlayerBot()->Say(msg, LANG_UNIVERSAL);
ai->CastSpell(REZZ, *tPlayer);
// rez is only 10 sec, but give time for lag
ai->SetIgnoreUpdateTime(17);
}
else if( tPlayer->isAlive() )
{
// buff and heal
(!tPlayer->HasAura(FORTITUDE, EFFECT_INDEX_0) && ai->CastSpell (FORTITUDE, *tPlayer));
(HealTarget(*tPlayer, tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth()));
}
}
}
} // end DoNonCombatActions
示例9: DoNextCombatManeuver
//.........这里部分代码省略.........
//heal pets and bots
Unit *target = DoSelectLowestHpFriendly(40, 1000);
if(target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth()) ) { return; }
break;
#pragma endregion
}
#pragma region ShamanCommon
//Defensive Stuff
if (m_tank->GetGUID() != m_bot->GetGUID() && pVictim && pVictim->GetGUID() == m_bot->GetGUID() )
{
if (pDist > 5 && CastSpell(FROST_SHOCK, pTarget)) { return; }
if ((pTarget->GetCreatureType() == (uint32) CREATURE_TYPE_BEAST || pTarget->GetCreatureType() == (uint32) CREATURE_TYPE_HUMANOID) && CastSpell(HEX, pTarget)) { return; } // no gcd
if (CastSpell(WIND_SHEAR, pTarget)) { } // no gcd
}
if (m_bot->getRace() == (uint8) RACE_BLOODELF && pDist < 8 && pTarget->IsNonMeleeSpellCasted(true) && CastSpell(R_ARCANE_TORRENT, pTarget)) { } //no gcd
if (pTarget->IsNonMeleeSpellCasted(true) && CastSpell(WIND_SHEAR, pTarget)) { } //no gcd
if (m_bot->getRace() == (uint8) RACE_TAUREN && pVictim && pVictim->GetGUID() == m_bot->GetGUID() && pDist < 8 && CastSpell(R_WAR_STOMP, pTarget)) { return; }
//Catch
if (pTarget->HasUnitMovementFlag(UNIT_FLAG_FLEEING))
{
if (CastSpell(FROST_SHOCK,pTarget)) return;
}
//Buff and restores
if ( ( (ai->GetHealthPercent() < 60 && isUnderAttack()) ||
(ai->GetManaPercent() < 30) ) && CastSpell(SHAMANISTIC_RAGE, m_bot)) { return; }
if (m_bot->getRace() == (uint8) RACE_TROLL && CastSpell(R_BERSERKING,m_bot)) {} // no GCD
if (m_bot->getRace() == (uint8) RACE_ORC && CastSpell(R_BLOOD_FURY,m_bot)) {} // no GCD
if (!m_bot->HasAura(HEROISM) && !m_bot->HasAura(EXHAUSTION) && !m_bot->HasAura(SATED) && CastSpell(HEROISM,m_bot)) { return; }
if (m_role != BOT_ROLE_SUPPORT && CastSpell(NATURES_SWIFTNESS, m_bot)) { } //healers keep it for healing no gcd
else if (CastSpell(ELEMENTAL_MASTERY, m_bot)) { } //no gcd
// If at threat limit, use WIND_SHEAR to reduce threat
if (pThreat > threatThreshold && m_tank->GetGUID() != m_bot->GetGUID() && !isUnderAttack())
{
if (m_tank->getVictim() && m_tank->getVictim()->GetGUID() != pTarget->GetGUID()) // I am attacking wrong target!!
{
m_bot->SetSelection(m_tank->getVictim()->GetGUID());
return;
}
else
{
if (CastSpell(WIND_SHEAR,pTarget)) { return; } //Lets see if we can manage
else { return; } //use no spells and wait threat to be reduced
}
}
if (TALENT_ELEMENTAL)
{
if (CastSpell(ELEMENTAL_MASTERY, m_bot)) { } //no gcd
if (!pTarget->HasAura(FLAME_SHOCK,m_bot->GetGUID()) && CastSpell(FLAME_SHOCK,pTarget)) { return; }
if (CastSpell(LAVA_BURST,pTarget)) { return; }
if (CastSpell(CHAIN_LIGHTNING,pTarget)) { return; }
if (CastSpell(LIGHTNING_BOLT,pTarget)) { return; }
}
//dps
if (MAELSTROM_WEAPON)
{
Aura *maelaura = m_bot->GetAura(MAELSTROM_WEAPON);
if (maelaura && maelaura->GetStackAmount() == 5)
{
if ((isUnderAttack(m_tank,3) || m_tank->GetGUID() == m_bot->GetGUID()) && CastSpell(CHAIN_LIGHTNING,pTarget,true,true)) { return; }
if (CastSpell(LIGHTNING_BOLT,pTarget,true,true)) { return; }
}
}
if (CastSpell(FLAME_SHOCK,pTarget)) { return; }
if (CastSpell(STORMSTRIKE,pTarget,true,true)) { return; }
//if (!TALENT_ENHANCEMENT && CanCast(LAVA_BURST,pTarget,true) && pTarget->HasAura(FLAME_SHOCK,m_bot->GetGUID()) && CastSpell(LAVA_BURST,pTarget,false)) { return; }
if (CastSpell(FERAL_SPIRIT,m_bot)) { return; }
if (CanCast(EARTH_SHOCK,pTarget,true) && (pTarget->HasAura(STORMSTRIKE,m_bot->GetGUID()) || pTarget->HasAura(FLAME_SHOCK,m_bot->GetGUID()) ) && CastSpell(EARTH_SHOCK,pTarget)) { return; }
//if (CanCast(FLAME_SHOCK,pTarget) && CastSpell(FLAME_SHOCK,pTarget)) { return; }
if (CastSpell(LAVA_LASH,pTarget,true,true)) { return; }
if (CastSpell(FIRE_NOVA,pTarget)) { return; }
//if ((isUnderAttack(m_tank,4) || m_tank->GetGUID() == m_bot->GetGUID()) && CastSpell(FIRE_NOVA,pTarget)) { return; }
if (ai->GetManaPercent() > 60 && castDispel(PURGE,pTarget)) { return; } //PURGE but dont overpurge
#pragma endregion
// drink potion if support / healer (Other builds simply overuse mana and waste mana pots)
if(ai->GetManaPercent() < 5 && (m_role == BOT_ROLE_SUPPORT || m_role == BOT_ROLE_HEALER) )
{
Item *pItem = ai->FindPotion();
if(pItem != NULL)
{
if (pItem->GetSpell() && m_bot->HasSpellCooldown(pItem->GetSpell()) ) { return; } //pot is in cooldown
ai->UseItem(*pItem);
}
}
} //end DoNextCombatManeuver
示例10: DoNextCombatManeuver
//.........这里部分代码省略.........
if (TALENT_ARCANE)
{
if (CastSpell(ARCANE_POWER,m_bot)) {} //nogcd
if (CastSpell(MIRROR_IMAGE,m_bot)) { return; }
//AOE
if (isUnderAttack(m_tank,5))
{
if (CastSpell(BLIZZARD,pTarget)) { return; }
}
//DPS
if (ARCANE_BLAST)
{
Aura *abaura = m_bot->GetAura(P_ARCANE_BLAST);
if (abaura && abaura->GetStackAmount() >= 3)
{
if (m_bot->HasAura(P_MISSILE_BARRAGE) && CastSpell(ARCANE_MISSILES,pTarget)) { return; }
else if (CastSpell(ARCANE_BARRAGE,pTarget)) { return; }
}
}
if (CastSpell(ARCANE_BARRAGE,pTarget) ) { return; }
}
if (TALENT_FIRE)
{
if (CastSpell(COMBUSTION,m_bot)) { } //nogcd
if (CastSpell(MIRROR_IMAGE,m_bot)) { return; }
//AOE
if (isUnderAttack(m_tank,5))
{
if (CastSpell(FLAMESTRIKE,pTarget)) { return; }
if (CastSpell(BLAST_WAVE,pTarget)) { return; }
if (CastSpell(LIVING_BOMB,pTarget)) { return; }
if (CastSpell(DRAGONS_BREATH,pTarget)) { return; }
}
//DPS
if (m_bot->HasAura(P_HOT_STREAK) && CastSpell(PYROBLAST,pTarget)) { return; }
if (!pTarget->HasAura(LIVING_BOMB,m_bot->GetGUID()) && CastSpell(LIVING_BOMB,pTarget)) { return; }
//if (!pTarget->HasAura(IMP_SCORCH) && CastSpell(SCORCH,pTarget)) { return; }
if (CastSpell(FIREBALL,pTarget)) { return; }
}
if (TALENT_FROST)
{
if (CastSpell(MIRROR_IMAGE,m_bot)) { return; }
if (CastSpell(WATER_ELEMENTAL,m_bot)) { return; }
uint64 pet_guid = m_bot->GetPetGUID();
if (pet_guid>0){
Pet* pet = ObjectAccessor::GetPet(*m_bot, pet_guid);
Unit *unit = ObjectAccessor::GetUnit(*m_bot, pet_guid);
if (unit!=NULL){
if (!unit->isInCombat()) {
m_bot->GetSession()->HandlePetActionHelper(unit, pet_guid, COMMAND_ATTACK, ACT_COMMAND, pTarget->GetGUID());
}
}
}
//if (CastSpell(33395, pTarget)) // pet freeze spell
// sLog.outError ("successfully casted freeze");
//AOE
if (isUnderAttack(m_tank,5))
{
if (CastSpell(BLIZZARD,pTarget)) { return; }
}
//DPS
if (m_bot->HasAura(P_FINGERS_OF_FROST) && CastSpell(DEEP_FREEZE,pTarget)) { return; }
if (m_bot->HasAura(P_BRAIN_FREEZE) && CastSpell(FROSTFIRE_BOLT,pTarget)) { return; }
if (CastSpell(FROSTBOLT,pTarget,true,true)) { return; }
}
// Defaults especialy for lower levels
if (m_bot->HasAura(P_BRAIN_FREEZE) && CastSpell(FIREBALL,pTarget,1,1)) { return; }
if (m_bot->HasAura(P_FIRESTARTER) && CastSpell(FLAMESTRIKE,pTarget,1,1)) { return; }
if (m_bot->HasAura(P_HOT_STREAK) && CastSpell(PYROBLAST,pTarget,1,1)) { return; }
if (m_bot->HasAura(POM) && (CastSpell(PYROBLAST,pTarget,1,1) || CastSpell(FIREBALL,pTarget,1,1) || CastSpell(FROSTBOLT,pTarget,1,1))) { return; }
if (pTarget->isFrozen() && CastSpell(ICE_LANCE,pTarget)) { return; }
if (m_bot->isMoving() && (CastSpell(FIRE_BLAST,pTarget,1,1) || CastSpell(ARCANE_BARRAGE,pTarget) || CastSpell(ICE_LANCE,pTarget))) { return; }
if (CastSpell(FIREBALL,pTarget)) { return; }
if (CastSpell(FROSTBOLT,pTarget)) { return; }
if (CastSpell(ARCANE_MISSILES,pTarget)) { return; }
// drink potion
if(ai->GetManaPercent() < 5 )
{
Item *pItem = ai->FindPotion();
if(pItem != NULL)
{
if (pItem->GetSpell() && m_bot->HasSpellCooldown(pItem->GetSpell()) ) { return; } //pot is in cooldown
ai->UseItem(*pItem);
}
}
// if we get down here, it means we are out of mana, so use wand
CastSpell(SHOOT, pTarget);
} //end DoNextCombatManeuver
示例11: DoNonCombatActions
void PlayerbotWarlockAI::DoNonCombatActions()
{
PlayerbotAI *ai = GetAI();
if( !ai )
return;
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
SpellSequence = SPELL_CURSES;
Pet *pet = m_bot->GetPet();
// buff myself DEMON_SKIN, DEMON_ARMOR, FEL_ARMOR
if (FEL_ARMOR > 0)
(!m_bot->HasAura(FEL_ARMOR, EFFECT_INDEX_0) && ai->CastSpell(FEL_ARMOR, *m_bot));
else if (DEMON_ARMOR > 0)
(!m_bot->HasAura(DEMON_ARMOR, EFFECT_INDEX_0) && !m_bot->HasAura(FEL_ARMOR, EFFECT_INDEX_0) && ai->CastSpell(DEMON_ARMOR, *m_bot));
else if (DEMON_SKIN > 0)
(!m_bot->HasAura(DEMON_SKIN, EFFECT_INDEX_0) && !m_bot->HasAura(FEL_ARMOR, EFFECT_INDEX_0) && !m_bot->HasAura(DEMON_ARMOR, EFFECT_INDEX_0) && ai->CastSpell(DEMON_SKIN, *m_bot));
// buff myself & master DETECT_INVISIBILITY
if (DETECT_INVISIBILITY > 0)
(!m_bot->HasAura(DETECT_INVISIBILITY, EFFECT_INDEX_0) && ai->GetManaPercent() >= 2 && ai->CastSpell(DETECT_INVISIBILITY, *m_bot));
if (DETECT_INVISIBILITY > 0)
(!GetMaster()->HasAura(DETECT_INVISIBILITY, EFFECT_INDEX_0) && ai->GetManaPercent() >= 2 && ai->CastSpell(DETECT_INVISIBILITY, *GetMaster()));
// 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() < 25)
{
ai->TellMaster("I could use a drink.");
ai->UseItem(*pItem);
ai->SetIgnoreUpdateTime(30);
return;
}
else if(( pet )
&& (pItem == NULL && DARK_PACT>0 && ai->GetManaPercent() <= 50 && pet->GetPower(POWER_MANA) > 0) )
{
ai->CastSpell(DARK_PACT, *m_bot);
//ai->TellMaster("casting dark pact.");
return;
}
else if(( !pet )
&& (pItem == NULL && LIFE_TAP>0 && ai->GetManaPercent() <= 50 && ai->GetHealthPercent() > 25) )
{
ai->CastSpell(LIFE_TAP, *m_bot);
//ai->TellMaster("casting life tap.");
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);
ai->SetIgnoreUpdateTime(30);
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);
ai->SetIgnoreUpdateTime(8);
return;
}
else if(( pet )
&& (pItem == NULL && fItem == NULL && CONSUME_SHADOWS>0 && !m_bot->HasAura(CONSUME_SHADOWS, EFFECT_INDEX_0) && ai->GetHealthPercent() < 75) )
{
ai->CastSpell(CONSUME_SHADOWS, *m_bot);
//ai->TellMaster("casting consume shadows.");
return;
}
// check for demon
if( SUMMON_FELGUARD>0 || SUMMON_FELHUNTER>0 || SUMMON_SUCCUBUS>0 || SUMMON_VOIDWALKER>0 || SUMMON_IMP>0 && !m_demonSummonFailed )
{
if( !pet )
{
// summon demon
if( SUMMON_FELGUARD>0 && ai->CastSpell(SUMMON_FELGUARD,*m_bot) )
ai->TellMaster( "summoning felguard." );
else if( SUMMON_FELHUNTER>0 && ai->CastSpell(SUMMON_FELHUNTER,*m_bot) )
ai->TellMaster( "summoning felhunter." );
else if( SUMMON_SUCCUBUS>0 && ai->CastSpell(SUMMON_SUCCUBUS,*m_bot) )
ai->TellMaster( "summoning succubus." );
else if( SUMMON_VOIDWALKER>0 && ai->CastSpell(SUMMON_VOIDWALKER,*m_bot) )
ai->TellMaster( "summoning voidwalker." );
else if( SUMMON_IMP>0 && ai->GetManaPercent() >= 64 && ai->CastSpell(SUMMON_IMP,*m_bot) )
//.........这里部分代码省略.........
示例12: DoNextCombatManeuver
//.........这里部分代码省略.........
}
}
// My target is not attacking me, taunt..
if ( m_tank->GetGUID() == m_bot->GetGUID() && pVictim && pVictim->GetGUID() != m_bot->GetGUID() && CastSpell(HOR, pTarget,true,true) ) { } //NO GCD
// Tank specials
if (TALENT_PROT && ai->GetManaPercent() < 90 && CastSpell (DIVINE_PLEA, m_bot)) { return; } //Prot paladin always uses this..
if (pVictim && pVictim->GetGUID() == m_bot->GetGUID() && CastSpell(HOLY_SHIELD,m_bot)) { return; }
if (CastSpell(AVENGERS_SHIELD,pTarget,true,true)) { return; }
if (CastSpell(HOTR,pTarget,true,true)) { return; }
if (CastSpell(HOLY_WRATH,pTarget,true,true)){ return; }
if (CastSpell(CONSECRATION,pTarget)) { return; }
if (m_bot->getRace() == (uint8) RACE_DWARF && CastSpell(R_STONEFORM,m_bot)) { return; }
if (DoSupportRaid(m_bot)) { return; }
//heal pets and bots
if(target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth()) ) { return; }
break;
#pragma endregion
#pragma region BOT_ROLE_DPS_MELEE
case BOT_ROLE_DPS_MELEE:
ChangeAura(RETRIBUTION_AURA);
if (!TALENT_PROT && m_tank->GetGUID() != m_bot->GetGUID()) m_bot->RemoveAurasDueToSpell(RIGHTEOUS_FURY);
if (CastSpell(SOV,m_bot)) { return; }
if (CastSpell (HAMMER_OF_JUSTICE, pTarget)) { return; }
if (!m_bot->HasAura(FORBEARANCE) && CastSpell(AVENGING_WRATH,m_bot)) {} //no gcd
if (CastSpell(JOW,pTarget)) { return; }
if (CastSpell(DIVINE_STORM, pTarget)) { return; }
if (CastSpell(CRUSADER_STRIKE, pTarget)) { return; }
if (GetAI()->GetHealthPercent(*pTarget)<20 && CastSpell(HAMMER_OF_WRATH, pTarget)) { return; }
if (CastSpell(CONSECRATION,pTarget)) { return; }
if (m_bot->HasAura(AOW) && CastSpell(EXORCISM,pTarget)) { return; }
if (CastSpell(HOLY_WRATH,pTarget)) { return; }
break;
#pragma endregion
}
#pragma region PaladinCommon
// Shared dps spells
if (pTarget->GetCreatureType() == (uint32) CREATURE_TYPE_HUMANOID && pTarget->IsNonMeleeSpellCasted(true) && CastSpell (REPENTANCE, pTarget)) { return; }
if (m_bot->getRace() == (uint8) RACE_BLOODELF && pDist < 8 && pTarget->IsNonMeleeSpellCasted(true) && CastSpell(R_ARCANE_TORRENT, pTarget)) { } //no gcd
if (m_bot->getRace() == (uint8) RACE_TROLL && CastSpell(R_BERSERKING,m_bot)) {} // no GCD
if (m_bot->getRace() == (uint8) RACE_ORC && CastSpell(R_BLOOD_FURY,m_bot)) {} // no GCD
// If at threat limit, stop
if(pThreat > threatThreshold && !TALENT_PROT && m_tank->GetGUID() != m_bot->GetGUID() && !isUnderAttack())
{
if (m_tank->getVictim() && m_tank->getVictim()->GetGUID() != pTarget->GetGUID()) // I am attacking wrong target!!
{
m_bot->SetSelection(m_tank->getVictim()->GetGUID());
return;
}
else
{
if (CastSpell(HOS,m_bot)) { return; } //Lets see if we can manage with HOS
else { return; } //use no spells and wait threat to be reduced
}
}
// Continue attacking if theres excess mana (for healers)
if (m_role == BOT_ROLE_SUPPORT && ai->GetManaPercent() < offensiveSpellThreshold) { return; }
if (GetAI()->GetHealthPercent(*pTarget)<20 && CastSpell(HAMMER_OF_WRATH, pTarget,true,true)) { return; } //no gcd but cast
if (CastSpell (HAMMER_OF_JUSTICE, pTarget)) { return; }
if (CanCast(JOW,pTarget,true) &&
( ( ai->GetManaPercent() <= 70 && ai->GetHealthPercent() > 90)
|| ( ai->GetManaPercent() <= 50 && ai->GetHealthPercent() > 75)
|| ( ai->GetManaPercent() <= 20 && ai->GetHealthPercent() > 20) )
&& CastSpell(JOW,pTarget,false)) { return; }
else if (CastSpell(JOL,pTarget),true,true) { return; }
if (CastSpell(SHIELD_OF_RIGHTEOUSNESS,pTarget,true,true)) { return; }
if (CastSpell (DIVINE_STORM, pTarget,true,true)) { return; }
if (CastSpell (CRUSADER_STRIKE, pTarget,true,true)) { return; }
if (m_bot->getRace() == (uint8) RACE_TAUREN && pDist < 8 && CastSpell(R_WAR_STOMP, pTarget)) { return; } //no GCD but cast
if (isUnderAttack(m_tank,4) && CastSpell(HOLY_WRATH,pTarget,true,true)) { return; }
if (isUnderAttack(m_tank,4) && CastSpell(CONSECRATION,pTarget)) { return; }
if (CastSpell(HOLY_SHOCK,pTarget,true,true)) { return; }
if (m_role != BOT_ROLE_SUPPORT && ai->GetManaPercent() > 60 && OwnPartyHP < 65 && DoSupportRaid(m_bot)) { return; } //if there is spare time and mana, do healz and other stuff..
else if (m_role != BOT_ROLE_SUPPORT && ai->GetManaPercent() > 30 && DoSupportRaid(m_bot,30,false,false,false,true,false)) { return; }
if (CastSpell(EXORCISM,pTarget,true,true)) { return; }
// drink potion if support / healer (Other builds simply overuse mana and waste mana pots)
if(ai->GetManaPercent() < 5 && (m_role == BOT_ROLE_SUPPORT || m_role == BOT_ROLE_HEALER) )
{
Item *pItem = ai->FindPotion();
if(pItem != NULL)
{
if (pItem->GetSpell() && m_bot->HasSpellCooldown(pItem->GetSpell()) ) { return; } //pot is in cooldown
ai->UseItem(*pItem);
}
}
#pragma endregion
} //end DoNextCombatManeuver
示例13: DoNonCombatActions
void PlayerbotDruidAI::DoNonCombatActions()
{
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
PlayerbotAI* ai = GetAI();
if(m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
{
m_bot->RemoveAurasDueToSpell(768);
//ai->TellMaster("FormClearCat");
}
if(m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
{
m_bot->RemoveAurasDueToSpell(5487);
//ai->TellMaster("FormClearBear");
}
if(m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
{
m_bot->RemoveAurasDueToSpell(9634);
//ai->TellMaster("FormClearDireBear");
}
if(m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
{
m_bot->RemoveAurasDueToSpell(24858);
//ai->TellMaster("FormClearMoonkin");
}
// buff myself with MARK_OF_THE_WILD
if (MARK_OF_THE_WILD > 0 && !m_bot->HasAura(MARK_OF_THE_WILD, EFFECT_INDEX_0))
ai->CastSpell (MARK_OF_THE_WILD, *m_bot);
// Thorns generates aggro for moonkin
if (THORNS > 0 && !m_bot->HasAura(THORNS, EFFECT_INDEX_0))
ai->CastSpell (THORNS, *m_bot);
// 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);
ai->SetIgnoreUpdateTime(30);
return;
}
else if(pItem == NULL && INNERVATE>0 && !m_bot->HasAura(INNERVATE, EFFECT_INDEX_0) && ai->GetManaPercent() <= 70)
{
ai->CastSpell(INNERVATE, *m_bot);
//ai->TellMaster("casting innervate.");
return;
}
else if(pItem == NULL && MANA_REJUVENATION>0 && !m_bot->HasAura(INNERVATE, EFFECT_INDEX_0) && !m_bot->HasAura(MANA_REJUVENATION, EFFECT_INDEX_0) && ai->GetManaPercent() <= 70)
{
ai->CastSpell(MANA_REJUVENATION, *m_bot);
//ai->TellMaster("casting mana rejuvenation.");
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);
ai->SetIgnoreUpdateTime(30);
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);
ai->SetIgnoreUpdateTime(8);
return;
}
// buff and heal 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 = sObjectMgr.GetPlayer(uint64 (itr->guid));
if( !tPlayer || !tPlayer->isAlive() )
continue;
// buff and heal
(!tPlayer->HasAura(MARK_OF_THE_WILD,EFFECT_INDEX_0) && ai->CastSpell (MARK_OF_THE_WILD, *tPlayer));
//(!tPlayer->HasAura(THORNS,0) && ai->CastSpell (THORNS, *tPlayer));
(HealTarget(*tPlayer, tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth()));
}
}
//.........这里部分代码省略.........
示例14: DoNonCombatActions
bool PlayerbotDruidAI::DoNonCombatActions()
{
Player * m_bot = GetPlayerBot();
if (!m_bot)
return false;
PlayerbotAI* ai = GetAI();
if (!ai)
return false;
Player* pMaster = ai->GetMaster();
if (!pMaster)
return false;
if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
m_bot->RemoveAurasDueToSpell(768);
if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
m_bot->RemoveAurasDueToSpell(5487);
if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
m_bot->RemoveAurasDueToSpell(9634);
if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
m_bot->RemoveAurasDueToSpell(24858);
if ((MARK_OF_THE_WILD > 0)
&& (!m_bot->HasAura(MARK_OF_THE_WILD, EFFECT_INDEX_0))
&& (ai->CastSpell(MARK_OF_THE_WILD, *m_bot)))
return true;
if ((THORNS > 0)
&& (!m_bot->HasAura(THORNS, EFFECT_INDEX_0))
&& (ai->CastSpell(THORNS, *m_bot)))
return true;
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
Item* drinkOrFoodItem = ai->FindDrink();
Item* bandageItem = ai->FindBandage();
if (drinkOrFoodItem
&& (ai->GetManaPercent() < 30))
{
ai->UseItem(*drinkOrFoodItem);
ai->SetIgnoreUpdateTime(30);
return true;
}
if (!drinkOrFoodItem
&& (INNERVATE > 0)
&& (!m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
&& (ai->GetManaPercent() <= 70)
&& (ai->CastSpell(INNERVATE, *m_bot)))
return true;
if (!drinkOrFoodItem
&& (MANA_REJUVENATION > 0)
&& (!m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
&& (!m_bot->HasAura(MANA_REJUVENATION, EFFECT_INDEX_0))
&& (ai->GetManaPercent() <= 70)
&& (ai->CastSpell(MANA_REJUVENATION, *m_bot)))
return true;
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
drinkOrFoodItem = ai->FindFood();
if (drinkOrFoodItem
&& (ai->GetHealthPercent() < 30))
{
ai->UseItem(*drinkOrFoodItem);
ai->SetIgnoreUpdateTime(30);
return true;
}
if (!drinkOrFoodItem
&& bandageItem
&& (!m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0))
&& (ai->GetHealthPercent() < 70))
{
ai->UseItem(*bandageItem);
ai->SetIgnoreUpdateTime(8);
return true;
}
if (pMaster->GetGroup())
{
Group::MemberSlotList const& groupSlot = pMaster->GetGroup()->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *tPlayer = sObjectMgr.GetPlayer(itr->guid);
if (!tPlayer || !tPlayer->isAlive())
continue;
if ((!tPlayer->HasAura(MARK_OF_THE_WILD, EFFECT_INDEX_0))
&& (ai->CastSpell(MARK_OF_THE_WILD, *tPlayer)))
return true;
if (HealTarget(*tPlayer, tPlayer->GetHealth() * 100 / tPlayer->GetMaxHealth()))
return true;
}
//.........这里部分代码省略.........
示例15: 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;
//.........这里部分代码省略.........