本文整理汇总了C++中PlayerbotAI::FindDrink方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::FindDrink方法的具体用法?C++ PlayerbotAI::FindDrink怎么用?C++ PlayerbotAI::FindDrink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::FindDrink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoNonCombatActions
void PlayerbotMageAI::DoNonCombatActions()
{
PlayerbotAI *ai = GetAI();
Player *m_bot = GetPlayerBot();
if (!m_bot || !ai || m_bot->isDead()) { return; }
// make sure pet stays by your side
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){
m_bot->GetSession()->HandlePetActionHelper(unit, pet_guid, COMMAND_FOLLOW, ACT_COMMAND, 0);
m_bot->GetSession()->HandlePetActionHelper(unit, pet_guid, REACT_DEFENSIVE, ACT_REACTION, 0);
}
}
//If Casting or Eating/Drinking return
if (m_bot->HasUnitState(UNIT_STAT_CASTING)) { return; }
if (m_bot->getStandState() == UNIT_STAND_STATE_SIT) { return; }
//buff and heal raid
if (DoSupportRaid(m_bot,30,0,0,0,1,1)) { return; }
//Own Buffs
if (MOLTEN_ARMOR) { if ( CastSpell(MOLTEN_ARMOR,m_bot)) { return; } }
else if (CastSpell(MAGE_ARMOR,m_bot)) { return; }
if (CastSpell(COMBUSTION,m_bot)) { } //nogcd
if (!HasAuraName(m_bot, MANA_SHIELD)) CastSpell (MANA_SHIELD);
//conjure food & water
Item *pItem = ai->FindDrink();
if(pItem == NULL && ai->GetManaPercent() >= 48)
{
if (CastSpell(CONJURE_REFRESHMENT, m_bot)) { return; }
if (CastSpell(CONJURE_WATER, m_bot)) { return; }
return;
}
pItem = ai->FindFood();
if(pItem == NULL && ai->GetManaPercent() >= 48)
{
if (CastSpell(CONJURE_REFRESHMENT, m_bot)) { return; }
if (CastSpell(CONJURE_FOOD, m_bot)) { return; }
return;
}
//Conjure mana gem??
//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() < 50 && CastSpell (EVOCATION, m_bot)) { return; }
if (ai->GetManaPercent() < 50 || ai->GetHealthPercent() < 50) { ai->Feast(); }
} //end DoNonCombatActions
示例2: 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
示例3: 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
示例4: DoNonCombatActions
//.........这里部分代码省略.........
}
// 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))
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
示例5: 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
示例6: DoNonCombatActions
void PlayerbotPriestAI::DoNonCombatActions()
{
PlayerbotAI* ai = GetAI();
Player * m_bot = GetPlayerBot();
Player * master = GetMaster();
if (!m_bot || !master)
return;
SpellSequence = SPELL_HOLY;
// selfbuff goes first
if (ai->SelfBuff(INNER_FIRE))
return;
// mana check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
Item* pItem = ai->FindDrink();
Item* fItem = ai->FindBandage();
if (pItem != nullptr && ai->GetManaPercent() < 30)
{
ai->TellMaster("I could use a drink.");
ai->UseItem(pItem);
return;
}
// hp check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
pItem = ai->FindFood();
if (pItem != nullptr && ai->GetHealthPercent() < 30)
{
ai->TellMaster("I could use some food.");
ai->UseItem(pItem);
return;
}
else if (pItem == nullptr && fItem != nullptr && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
{
ai->TellMaster("I could use first aid.");
ai->UseItem(fItem);
return;
}
// buff and heal master's group
if (master->GetGroup())
{
// Buff master with group buffs
if (master->isAlive())
{
if (PRAYER_OF_FORTITUDE && ai->HasSpellReagents(PRAYER_OF_FORTITUDE) && ai->Buff(PRAYER_OF_FORTITUDE, master))
return;
if (PRAYER_OF_SPIRIT && ai->HasSpellReagents(PRAYER_OF_SPIRIT) && ai->Buff(PRAYER_OF_SPIRIT, master))
return;
if (PRAYER_OF_SHADOW_PROTECTION && ai->HasSpellReagents(PRAYER_OF_SHADOW_PROTECTION) && ai->Buff(PRAYER_OF_SHADOW_PROTECTION, master))
return;
}
Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *tPlayer = sObjectMgr.GetPlayer(itr->guid);
if (!tPlayer || tPlayer == m_bot)
continue;
// first rezz em
if (!tPlayer->isAlive())
{
if (ai->CastSpell(RESURRECTION, *tPlayer))
{
std::string msg = "Resurrecting ";
msg += tPlayer->GetName();
m_bot->Say(msg, LANG_UNIVERSAL);
return;
}
else
continue;
}
else
{
// buff and heal
if (BuffPlayer(tPlayer))
return;
if (HealTarget(tPlayer))
return;
}
}
}
else
{
if (master->isAlive())
{
if (BuffPlayer(master))
return;
//.........这里部分代码省略.........
示例7: 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
示例8: 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
//.........这里部分代码省略.........
示例9: DoNonCombatActions
void PlayerbotPaladinAI::DoNonCombatActions()
{
PlayerbotAI* ai = GetAI();
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
// buff myself
if (GREATER_BLESSING_OF_MIGHT > 0 && !m_bot->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0))
ai->CastSpell (GREATER_BLESSING_OF_MIGHT, *m_bot);
else if (BLESSING_OF_MIGHT > 0 && !m_bot->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !m_bot->HasAura(BLESSING_OF_MIGHT, EFFECT_INDEX_0))
ai->CastSpell (BLESSING_OF_MIGHT, *m_bot);
if (DIVINE_FAVOR > 0 && !m_bot->HasAura(DIVINE_FAVOR, EFFECT_INDEX_0) && ai->GetManaPercent() >= 3)
ai->CastSpell(DIVINE_FAVOR , *m_bot);
/*
if (SEAL_OF_COMMAND > 0)
ai->CastSpell (SEAL_OF_COMMAND, *m_bot); // interferes with drinking/eating
*/
//Select Class buff seq.
///Process Who is my master --> get the player class --> aura already present if not then proced --> cast the spell
//Priest
if (BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_PRIEST && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_WISDOM, EFFECT_INDEX_0))
ai->CastSpell (BLESSING_OF_WISDOM, *(GetMaster()));
if (GREATER_BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_PRIEST && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0))
ai->CastSpell (GREATER_BLESSING_OF_WISDOM, *(GetMaster()));
//Mage
if (BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_MAGE && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_WISDOM, EFFECT_INDEX_0))
ai->CastSpell (BLESSING_OF_WISDOM, *(GetMaster()));
if (GREATER_BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_MAGE && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0))
ai->CastSpell (GREATER_BLESSING_OF_WISDOM, *(GetMaster()));
//Paladin
if (BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_PALADIN && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_WISDOM, EFFECT_INDEX_0))
ai->CastSpell (BLESSING_OF_WISDOM, *(GetMaster()));
if (GREATER_BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_PALADIN && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0))
ai->CastSpell (GREATER_BLESSING_OF_WISDOM, *(GetMaster()));
//Warlock
if (BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_WARLOCK && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_WISDOM, EFFECT_INDEX_0))
ai->CastSpell (BLESSING_OF_WISDOM, *(GetMaster()));
if (GREATER_BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_WARLOCK && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0))
ai->CastSpell (GREATER_BLESSING_OF_WISDOM, *(GetMaster()));
//Warrior
if (BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_WARRIOR && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(DEFENSIVE_STANCE, EFFECT_INDEX_0))
ai->CastSpell (BLESSING_OF_MIGHT, *(GetMaster()));
if (GREATER_BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_WARRIOR && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(DEFENSIVE_STANCE, EFFECT_INDEX_0))
ai->CastSpell (GREATER_BLESSING_OF_MIGHT, *(GetMaster()));
if (BLESSING_OF_KINGS > 0 && GetMaster()->getClass() == CLASS_WARRIOR && !GetMaster()->HasAura(GREATER_BLESSING_OF_KINGS, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_KINGS, EFFECT_INDEX_0) && !GetMaster()->HasAura(BERSERKER_STANCE, EFFECT_INDEX_0) && !GetMaster()->HasAura(BATTLE_STANCE, EFFECT_INDEX_0))
ai->CastSpell (BLESSING_OF_KINGS, *(GetMaster()));
if (GREATER_BLESSING_OF_KINGS > 0 && GetMaster()->getClass() == CLASS_WARRIOR && !GetMaster()->HasAura(GREATER_BLESSING_OF_KINGS, EFFECT_INDEX_0) && !GetMaster()->HasAura(BERSERKER_STANCE, EFFECT_INDEX_0) && !GetMaster()->HasAura(BATTLE_STANCE, EFFECT_INDEX_0))
ai->CastSpell (GREATER_BLESSING_OF_KINGS, *(GetMaster()));
//Rogue
if (BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_ROGUE && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_MIGHT, EFFECT_INDEX_0))
ai->CastSpell (BLESSING_OF_MIGHT, *(GetMaster()));
if (GREATER_BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_ROGUE && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0))
ai->CastSpell (GREATER_BLESSING_OF_MIGHT, *(GetMaster()));
//Shaman
if (BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_SHAMAN && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_MIGHT, EFFECT_INDEX_0))
ai->CastSpell (BLESSING_OF_MIGHT, *(GetMaster()));
if (GREATER_BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_SHAMAN && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0))
ai->CastSpell (GREATER_BLESSING_OF_MIGHT, *(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);
ai->SetIgnoreUpdateTime(30);
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.");
//.........这里部分代码省略.........
示例10: 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) )
//.........这里部分代码省略.........
示例11: 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()));
}
}
//.........这里部分代码省略.........
示例12: 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;
}
//.........这里部分代码省略.........
示例13: 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;
}
}
}
示例14: DoNonCombatActions
void PlayerbotDruidAI::DoNonCombatActions()
{
PlayerbotAI *ai = GetAI();
if (!ai)
return;
Player * m_bot = GetPlayerBot();
if (!m_bot)
return;
Player* m_master = ai->GetLeader();
if (!m_master)
return;
// mana check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
Item* pItem = ai->FindDrink();
Item* fItem = ai->FindBandage();
if (pItem != NULL && ai->GetManaPercent() < 30)
{
ai->UseItem(pItem);
return;
}
else if (!pItem && INNERVATE > 0 && !m_bot->HasAura(INNERVATE) && ai->GetManaPercent() <= 20 && ai->CastSpell(INNERVATE, m_bot))
return;
// hp check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
pItem = ai->FindFood();
if (pItem != NULL && ai->GetHealthPercent() < 30)
{
ai->UseItem(pItem);
return;
}
else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
{
ai->UseItem(fItem);
return;
}
// buff and heal master's group
if (m_master->GetGroup())
{
// Buff master with group buff
if (m_master->isAlive() && GIFT_OF_THE_WILD && ai->HasSpellReagents(GIFT_OF_THE_WILD) && ai->Buff(GIFT_OF_THE_WILD, m_master))
return;
Group::MemberSlotList const& groupSlot = m_master->GetGroup()->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *tPlayer = sObjectMgr.GetPlayer(itr->guid);
if (!tPlayer || tPlayer == m_bot)
continue;
// Resurrect member if needed
if (!tPlayer->isAlive())
{
if (ai->CastSpell(REVIVE, tPlayer))
return;
else
continue;
}
else
{
// buff and heal
if (BuffPlayer(tPlayer))
return;
if (HealTarget(tPlayer))
return;
}
}
}
else
{
if (m_master->isAlive())
{
if (BuffPlayer(m_master))
return;
if (HealTarget(m_master))
return;
}
else
ai->CastSpell(REVIVE, m_master);
}
BuffPlayer(m_bot);
} // end DoNonCombatActions
示例15: DoNonCombatActions
void PlayerbotDruidAI::DoNonCombatActions()
{
Player* m_bot = GetPlayerBot();
Player* master = GetMaster();
if (!m_bot || !master)
return;
PlayerbotAI* ai = GetAI();
// mana check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
Item* pItem = ai->FindDrink();
Item* fItem = ai->FindBandage();
if (pItem != NULL && ai->GetManaPercent() < 30)
{
ai->TellMaster("I could use a drink.");
ai->UseItem(pItem);
return;
}
else if (!pItem && INNERVATE > 0 && !m_bot->HasAura(INNERVATE) && ai->GetManaPercent() <= 20 && ai->CastSpell(INNERVATE, *m_bot))
return;
// hp check
if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
m_bot->SetStandState(UNIT_STAND_STATE_STAND);
pItem = ai->FindFood();
if (pItem != NULL && ai->GetHealthPercent() < 30)
{
ai->TellMaster("I could use some food.");
ai->UseItem(pItem);
return;
}
else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
{
ai->TellMaster("I could use first aid.");
ai->UseItem(fItem);
return;
}
// buff and heal master's group
if (master->GetGroup())
{
// Buff master with group buff
if (!master->IsInDuel(master))
if (master->isAlive() && GIFT_OF_THE_WILD && ai->HasSpellReagents(GIFT_OF_THE_WILD) && ai->Buff(GIFT_OF_THE_WILD, master))
return;
Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *tPlayer = sObjectMgr.GetPlayer(itr->guid);
if (!tPlayer || tPlayer == m_bot)
continue;
if (tPlayer->IsInDuelWith(master))
continue;
// Resurrect member if needed
if (!tPlayer->isAlive())
{
if (ai->CastSpell(REVIVE, *tPlayer))
{
std::string msg = "Resurrecting ";
msg += tPlayer->GetName();
m_bot->Say(msg, LANG_UNIVERSAL);
return;
}
else
continue;
}
else
{
// buff and heal
if (BuffPlayer(tPlayer))
return;
if (HealTarget(tPlayer))
return;
}
}
}
else
{
if (master->IsInDuel(master))
return;
if (master->isAlive())
{
if (BuffPlayer(master))
return;
if (HealTarget(master))
return;
}
else
if (ai->CastSpell(REVIVE, *master))
//.........这里部分代码省略.........