本文整理汇总了C++中PlayerbotAI::SetIgnoreUpdateTime方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::SetIgnoreUpdateTime方法的具体用法?C++ PlayerbotAI::SetIgnoreUpdateTime怎么用?C++ PlayerbotAI::SetIgnoreUpdateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::SetIgnoreUpdateTime方法的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 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
示例3: 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);
//.........这里部分代码省略.........
示例4: _DoNextPVECombatManeuverSpellDPS
void PlayerbotDruidAI::_DoNextPVECombatManeuverSpellDPS(Unit* pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
//uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
if (MOONKIN_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
ai->CastSpell (MOONKIN_FORM);
// NOTE: Tree of Life is beneficial to armor and Wrath - leave on if not in Moonkin (not talented or OutOfMana)
if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
{
m_bot->RemoveAurasDueToSpell(CAT_FORM_1);
//ai->TellMaster("FormClearCat");
return;
}
if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
{
m_bot->RemoveAurasDueToSpell(BEAR_FORM_1);
//ai->TellMaster("FormClearBear");
return;
}
if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
{
m_bot->RemoveAurasDueToSpell(DIRE_BEAR_FORM_1);
//ai->TellMaster("FormClearDireBear");
return;
}
if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
{
ai->CastSpell(FAERIE_FIRE, *pTarget);
return;
}
DruidSpellCombat++;
if (MOONFIRE > 0 && DruidSpellCombat < 2 && !pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 24)
{
ai->CastSpell(MOONFIRE, *pTarget);
return;
}
DruidSpellCombat++;
if (ROOTS > 0 && DruidSpellCombat < 3 && !pTarget->HasAura(ROOTS, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
{
ai->CastSpell(ROOTS, *pTarget);
return;
}
DruidSpellCombat++;
if (HURRICANE > 0 && ai->GetAttackerCount() >= 5 && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
{
ai->CastSpell(HURRICANE, *pTarget);
ai->SetIgnoreUpdateTime(10);
return;
}
DruidSpellCombat++;
if (WRATH > 0 && DruidSpellCombat < 5 && ai->GetManaPercent() >= 13)
{
ai->CastSpell(WRATH, *pTarget);
return;
}
DruidSpellCombat++;
if (INSECT_SWARM > 0 && DruidSpellCombat < 6 && !pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9)
{
ai->CastSpell(INSECT_SWARM, *pTarget);
return;
}
DruidSpellCombat++;
if (STARFIRE > 0 && DruidSpellCombat < 7 && ai->GetManaPercent() >= 18)
{
ai->CastSpell(STARFIRE, *pTarget);
return;
}
DruidSpellCombat++;
if (FORCE_OF_NATURE > 0 && DruidSpellCombat < 8 && ai->GetManaPercent() >= 12)
{
ai->CastSpell(FORCE_OF_NATURE);
return;
}
DruidSpellCombat++;
if (STARFALL > 0 && !m_bot->HasAura(STARFALL, EFFECT_INDEX_0) && ai->GetAttackerCount() >= 3 && DruidSpellCombat < 9 && ai->GetManaPercent() >= 39)
{
ai->CastSpell(STARFALL, *pTarget);
return;
}
DruidSpellCombat++;
if (BARKSKIN > 0 && pVictim == m_bot && ai->GetHealthPercent() < 75 && DruidSpellCombat < 10 && !m_bot->HasAura(BARKSKIN, EFFECT_INDEX_0))
{
//.........这里部分代码省略.........
示例5: 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
示例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 myself
(ASPECT_OF_THE_HAWK>0 && !m_bot->HasAura(ASPECT_OF_THE_HAWK, 0) && ai->CastSpell (ASPECT_OF_THE_HAWK, *m_bot));
// mana check
if (m_bot->getStandState() != PLAYER_STATE_NONE)
m_bot->SetStandState(PLAYER_STATE_NONE);
Item* pItem = ai->FindDrink();
if (pItem != NULL && ai->GetManaPercent() < 15) {
ai->TellMaster("I could use a drink.");
ai->UseItem(*pItem);
ai->SetIgnoreUpdateTime(30);
return;
}
// hp check
if (m_bot->getStandState() != PLAYER_STATE_NONE)
m_bot->SetStandState(PLAYER_STATE_NONE);
pItem = ai->FindFood();
if (pItem != NULL && ai->GetHealthPercent() < 15) {
ai->TellMaster("I could use some food.");
ai->UseItem(*pItem);
ai->SetIgnoreUpdateTime(30);
return;
}
// check for pet
if( PET_SUMMON>0 && !m_petSummonFailed ) {
// 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->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 && ai->CastSpell(PET_MEND,*m_bot) )
ai->TellMaster( "healing pet" );
}
}
} // end DoNonCombatActions
示例7: DoNextCombatManeuver
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
ai->CastSpell(MOONFIRE);
return;
default:
break;
}
uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_HEAL) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
SpellSequence = DruidHeal;
else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
SpellSequence = DruidCombat;
else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_TANK)
SpellSequence = DruidTank;
else
SpellSequence = DruidSpell;
switch (SpellSequence)
{
case DruidTank: // Its now a tank druid!
//ai->TellMaster("DruidTank");
if (!m_bot->HasInArc(M_PI_F, pTarget))
{
m_bot->SetFacingTo(m_bot->GetAngle(pTarget));
if (pVictim)
pVictim->Attack(pTarget, true);
}
if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
m_bot->RemoveAurasDueToSpell(768);
//ai->TellMaster("FormClearCat");
if (MOONKIN_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
ai->CastSpell (MOONKIN_FORM);
else if (DIRE_BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
ai->CastSpell (DIRE_BEAR_FORM);
else if (BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
ai->CastSpell (BEAR_FORM);
else if (DEMORALIZING_ROAR > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !pTarget->HasAura(DEMORALIZING_ROAR, EFFECT_INDEX_0) && ai->GetRageAmount() >= 10)
ai->CastSpell(DEMORALIZING_ROAR, *pTarget);
if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0))
{
ai->CastSpell(FAERIE_FIRE, *pTarget);
DruidSpellCombat++;
break;
}
else if (MOONFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 2 && !pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 24)
{
ai->CastSpell(MOONFIRE, *pTarget);
DruidSpellCombat++;
break;
}
else if (ROOTS > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 3 && !pTarget->HasAura(ROOTS, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
{
ai->CastSpell(ROOTS, *pTarget);
DruidSpellCombat++;
break;
}
else if (HURRICANE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && ai->GetAttackerCount() >= 5 && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
{
//ai->TellMaster("casting hurricane!");
ai->CastSpell(HURRICANE, *pTarget);
ai->SetIgnoreUpdateTime(10);
DruidSpellCombat++;
break;
}
else if (WRATH > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 5 && ai->GetManaPercent() >= 13)
{
ai->CastSpell(WRATH, *pTarget);
DruidSpellCombat++;
break;
}
else if (INSECT_SWARM > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 6 && !pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9)
{
ai->CastSpell(INSECT_SWARM, *pTarget);
DruidSpellCombat++;
break;
}
else if (STARFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 7 && ai->GetManaPercent() >= 18)
{
ai->CastSpell(STARFIRE, *pTarget);
DruidSpellCombat++;
break;
}
else if (FORCE_OF_NATURE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 8 && ai->GetManaPercent() >= 12)
{
//ai->TellMaster("summoning treants.");
ai->CastSpell(FORCE_OF_NATURE);
DruidSpellCombat++;
//.........这里部分代码省略.........
示例8: 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, 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);
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 (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
示例9: 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;
}
//.........这里部分代码省略.........
示例10: DoNextCombatManeuver
//.........这里部分代码省略.........
DruidSpellCombat++;
return true;
}
if ((MOONFIRE > 0)
&& (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
&& (DruidSpellCombat < 2)
&& (!pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0))
&& (ai->GetManaPercent() >= 24)
&& (ai->CastSpell(MOONFIRE, *pTarget)))
{
DruidSpellCombat++;
return true;
}
if ((ROOTS > 0)
&& (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
&& (DruidSpellCombat < 3)
&& (!pTarget->HasAura(ROOTS, EFFECT_INDEX_0))
&& (ai->GetManaPercent() >= 8)
&& (ai->CastSpell(ROOTS, *pTarget)))
{
DruidSpellCombat++;
return true;
}
if ((HURRICANE > 0)
&& (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
&& (ai->GetAttackerCount() >= 5)
&& (DruidSpellCombat < 4)
&& (ai->GetManaPercent() >= 91)
&& (ai->CastSpell(HURRICANE, *pTarget)))
{
ai->SetIgnoreUpdateTime(10);
DruidSpellCombat++;
return true;
}
if ((WRATH > 0)
&& (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
&& (DruidSpellCombat < 5)
&& (ai->GetManaPercent() >= 13)
&& (ai->CastSpell(WRATH, *pTarget)))
{
DruidSpellCombat++;
return true;
}
if ((INSECT_SWARM > 0)
&& (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
&& (DruidSpellCombat < 6)
&& (!pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0))
&& (ai->GetManaPercent() >= 9)
&& (ai->CastSpell(INSECT_SWARM , *pTarget)))
{
DruidSpellCombat++;
return true;
}
if ((STARFIRE > 0)
&& (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
&& (DruidSpellCombat < 7)
&& (ai->GetManaPercent() >= 18)
&& (ai->CastSpell(STARFIRE, *pTarget)))
{
DruidSpellCombat++;
示例11: 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, 0) && ai->CastSpell(EARTH_SHIELD,*(GetMaster())) );
// buff myself with WATER_SHIELD, LIGHTNING_SHIELD
if (WATER_SHIELD > 0)
(!m_bot->HasAura(WATER_SHIELD, 0) && !m_bot->HasAura(LIGHTNING_SHIELD, 0) && ai->CastSpell(WATER_SHIELD,*m_bot) );
else if (LIGHTNING_SHIELD > 0)
(!m_bot->HasAura(LIGHTNING_SHIELD, 0) && !m_bot->HasAura(WATER_SHIELD, 0) && ai->CastSpell(LIGHTNING_SHIELD,*m_bot) );
/*
// buff myself weapon
if (ROCKBITER_WEAPON > 0)
(!m_bot->HasAura(ROCKBITER_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(WINDFURY_WEAPON, 0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(FROSTBRAND_WEAPON, 0) && ai->CastSpell(ROCKBITER_WEAPON,*m_bot) );
else if (EARTHLIVING_WEAPON > 0)
(!m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(FROSTBRAND_WEAPON, 0) && !m_bot->HasAura(ROCKBITER_WEAPON, 0) && ai->CastSpell(WINDFURY_WEAPON,*m_bot) );
else if (WINDFURY_WEAPON > 0)
(!m_bot->HasAura(WINDFURY_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(FROSTBRAND_WEAPON, 0) && !m_bot->HasAura(ROCKBITER_WEAPON, 0) && ai->CastSpell(WINDFURY_WEAPON,*m_bot) );
else if (FLAMETONGUE_WEAPON > 0)
(!m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(WINDFURY_WEAPON, 0) && !m_bot->HasAura(FROSTBRAND_WEAPON, 0) && !m_bot->HasAura(ROCKBITER_WEAPON, 0) && ai->CastSpell(FLAMETONGUE_WEAPON,*m_bot) );
else if (FROSTBRAND_WEAPON > 0)
(!m_bot->HasAura(FROSTBRAND_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(WINDFURY_WEAPON, 0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(ROCKBITER_WEAPON, 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);
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, 0) && ai->GetHealthPercent() < 70)
{
ai->TellMaster("I could use first aid.");
ai->UseItem(*fItem);
ai->SetIgnoreUpdateTime(8);
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(uint64 (itr->guid));
if( !tPlayer || !tPlayer->isAlive() )
continue;
// heal
(HealTarget(*tPlayer, tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth()));
}
}
} // end DoNonCombatActions
示例12: DoNonCombatActions
void PlayerbotHunterAI::DoNonCombatActions()
{
PlayerbotAI *ai = GetAI();
Player *m_bot = GetPlayerBot();
if (!m_bot || !ai || m_bot->isDead()) { return; }
//If Casting or Eating/Drinking return
if (m_bot->HasUnitState(UNIT_STAT_CASTING)) { return; }
if (m_bot->getStandState() == UNIT_STAND_STATE_SIT) { return; }
// buff group
if (CastSpell(TRUESHOT_AURA, m_bot)) { return; }
//mana/hp check
//Don't bother with eating, if low on hp, just let it heal themself
if (m_bot->getRace() == (uint8) RACE_UNDEAD_PLAYER && ai->GetHealthPercent() < 75 && CastSpell(R_CANNIBALIZE,m_bot)) { return; }
if (ai->GetManaPercent() < 20 || ai->GetHealthPercent() < 30) { ai->Feast(); }
#pragma region Check Pet
// 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,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 ItemTemplate* const pItemProto = pItem->GetTemplate();
if (!pItemProto )
continue;
if(pet->HaveInDiet(pItemProto)) // is pItem in pets diet
{
//sLog.outDebug("Food for pet: %s",pItemProto->Name1);
caster->CastSpell(caster,51284,true); // pet feed visual
uint32 count = 1; // number of items used
int32 benefit = pet->GetCurrentFoodBenefitLevel(pItemProto->ItemLevel); // nutritional value of food
m_bot->DestroyItemCount(pItem,count,true); // remove item from inventory
m_bot->CastCustomSpell(m_bot,PET_FEED,&benefit,NULL,NULL,true); // feed pet
ai->TellMaster( "feeding pet." );
ai->SetIgnoreUpdateTime(10);
return;
}
}
}
// list out items in other removable backpacks
for (uint8 bag = INVENTORY_SLOT_BAG_START; bag < INVENTORY_SLOT_BAG_END; ++bag)
{
const Bag* const pBag = (Bag*) m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag);
if (pBag)
{
for (uint8 slot = 0; slot < pBag->GetBagSize(); ++slot)
{
Item* const pItem = m_bot->GetItemByPos(bag, slot);
if (pItem)
{
const ItemTemplate* const pItemProto = pItem->GetTemplate();
if (!pItemProto )
continue;
if(pet->HaveInDiet(pItemProto)) // is pItem in pets diet
{
//sLog.outDebug("Food for pet: %s",pItemProto->Name1);
caster->CastSpell(caster,51284,true); // pet feed visual
uint32 count = 1; // number of items used
int32 benefit = pet->GetCurrentFoodBenefitLevel(pItemProto->ItemLevel); // nutritional value of food
m_bot->DestroyItemCount(pItem,count,true); // remove item from inventory
m_bot->CastCustomSpell(m_bot,PET_FEED,&benefit,NULL,NULL,true); // feed pet
ai->TellMaster( "feeding pet." );
ai->SetIgnoreUpdateTime(10);
return;
}
}
//.........这里部分代码省略.........
示例13: DoNextCombatManeuver
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI *ai = GetAI();
if (!ai)
return;
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
Player* m_master = ai->GetLeader();
if (!m_master)
return;
uint32 masterHP = m_master->GetHealth() * 100 / m_master->GetMaxHealth();
ai->SetInFront(pTarget);
Unit* pVictim = pTarget->getVictim();
if (pVictim && ai->GetHealthPercent() >= 40 && m_master->GetHealth() >= m_master->GetMaxHealth() * 0.4)
{
if (pVictim == m_bot)
SpellSequence = DruidTank;
}
else if (pTarget->GetHealth() > pTarget->GetMaxHealth() * 0.8 && pVictim)
{
if (pVictim != m_bot)
SpellSequence = DruidSpell;
}
else if (ai->GetHealthPercent() <= 40 || m_master->GetHealth() <= m_master->GetMaxHealth() * 0.4)
SpellSequence = DruidHeal;
else
SpellSequence = DruidCombat;
switch (SpellSequence)
{
case DruidTank: // Its now a tank druid!
if (!m_bot->HasInArc(M_PI_F, pTarget))
{
m_bot->SetInFront(pTarget);
}
if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
m_bot->RemoveAurasDueToSpell(768);
if (MOONKIN_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
ai->CastSpell (MOONKIN_FORM);
else if (DIRE_BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
ai->CastSpell (DIRE_BEAR_FORM);
else if (BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
ai->CastSpell (BEAR_FORM);
else if (DEMORALIZING_ROAR > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !pTarget->HasAura(DEMORALIZING_ROAR, EFFECT_INDEX_0) && ai->GetRageAmount() >= 10)
ai->CastSpell(DEMORALIZING_ROAR, pTarget);
if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0))
{
ai->CastSpell(FAERIE_FIRE, pTarget);
DruidSpellCombat++;
break;
}
else if (MOONFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 2 && !pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 24)
{
ai->CastSpell(MOONFIRE, pTarget);
DruidSpellCombat++;
break;
}
else if (ROOTS > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 3 && !pTarget->HasAura(ROOTS, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
{
ai->CastSpell(ROOTS, pTarget);
DruidSpellCombat++;
break;
}
else if (HURRICANE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
{
ai->CastSpell(HURRICANE, pTarget);
ai->SetIgnoreUpdateTime(10);
DruidSpellCombat++;
break;
}
else if (WRATH > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 5 && ai->GetManaPercent() >= 13)
{
ai->CastSpell(WRATH, pTarget);
DruidSpellCombat++;
break;
}
else if (INSECT_SWARM > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 6 && !pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9)
{
ai->CastSpell(INSECT_SWARM, pTarget);
DruidSpellCombat++;
break;
}
else if (STARFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 7 && ai->GetManaPercent() >= 18)
{
ai->CastSpell(STARFIRE, pTarget);
DruidSpellCombat++;
break;
}
else if (FORCE_OF_NATURE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 8 && ai->GetManaPercent() >= 12)
{
ai->CastSpell(FORCE_OF_NATURE);
DruidSpellCombat++;
break;
}
//.........这里部分代码省略.........
示例14: DoNonCombatActions
void PlayerbotHunterAI::DoNonCombatActions()
{
PlayerbotAI *ai = GetAI();
Player * m_bot = GetPlayerBot();
Player* m_master = ai->GetLeader();
static const uint32 MinorGlyphs[] = {57903, 57866, 57870}; // feigh death - revive pet - healing pet
static const uint32 SurvivalMajorGlyphs[] = {56832, 56826, 63066}; // serpent sting - steady shot - explosive shot
for (uint32 i = 0; i < 3; i++)
{
if (!m_bot->HasSpell(MinorGlyphs[i]))
m_bot->learnSpell(MinorGlyphs[i], true);
if (!m_bot->HasSpell(SurvivalMajorGlyphs[i]))
m_bot->learnSpell(SurvivalMajorGlyphs[i], true);
}
if (!m_bot->HasAura(TRUESHOT_AURA, EFFECT_INDEX_0))
ai->CastSpell(TRUESHOT_AURA, m_bot);
if (!m_bot->HasAura(ASPECT_OF_THE_VIPER, EFFECT_INDEX_0) && ai->GetManaPercent() < 90 && ai->CastSpell(ASPECT_OF_THE_VIPER, m_bot))
return;
else if (!m_bot->HasAura(ASPECT_OF_THE_DRAGONHAWK, EFFECT_INDEX_0) && ai->GetManaPercent() >= 90 && ai->CastSpell(ASPECT_OF_THE_DRAGONHAWK, m_bot))
return;
// reset ranged combat state
if (!m_rangedCombat)
m_rangedCombat = true;
// 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))
{
}
else
{
m_petSummonFailed = true;
}
}
else if (pet->getDeathState() != ALIVE)
{
// revive pet
if (PET_REVIVE > 0 && ai->GetManaPercent() >= 80 && ai->CastSpell(PET_REVIVE, m_bot))
{
}
}
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))
{
}
}
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
{
caster->CastSpell(caster, 51284, true); // pet feed visual
uint32 count = 1; // number of items used
int32 benefit = pet->GetCurrentFoodBenefitLevel(pItemProto->ItemLevel); // nutritional value of food
m_bot->DestroyItemCount(pItem, count, true); // remove item from inventory
m_bot->CastCustomSpell(m_bot, PET_FEED, &benefit, NULL, NULL, true); // feed pet
ai->SetIgnoreUpdateTime(10);
return;
}
}
}
// list out items in other removable backpacks
for (uint8 bag = INVENTORY_SLOT_BAG_START; bag < INVENTORY_SLOT_BAG_END; ++bag)
{
const Bag* const pBag = (Bag*) m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag);
if (pBag)
for (uint8 slot = 0; slot < pBag->GetBagSize(); ++slot)
{
Item* const pItem = m_bot->GetItemByPos(bag, slot);
if (pItem)
{
const ItemPrototype* const pItemProto = pItem->GetProto();
if (!pItemProto)
continue;
//.........这里部分代码省略.........
示例15: 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()));
}
}
//.........这里部分代码省略.........