本文整理汇总了C++中PlayerbotAI::GetHealthPercent方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetHealthPercent方法的具体用法?C++ PlayerbotAI::GetHealthPercent怎么用?C++ PlayerbotAI::GetHealthPercent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetHealthPercent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoNonCombatActions
void PlayerbotDeathKnightAI::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_STATE_CASTING)) { return; }
if (m_bot->getStandState() == UNIT_STAND_STATE_SIT) { return; }
//Buff UP
if (CastSpell(HORN_OF_WINTER,m_bot)) { return; }
if (CastSpell(BONE_SHIELD,m_bot)) { return; }
//mana/hp check
if (m_bot->getRace() == (uint8) RACE_UNDEAD_PLAYER && ai->GetHealthPercent() < 75 && CastSpell(R_CANNIBALIZE,m_bot)) { return; }
if (m_bot->GetHealth() < m_bot->GetMaxHealth() && CastSpell(RUNE_TAP,m_bot)) { return; } //no gcd but lets give the others a time to heal
if (ai->GetHealthPercent() < 30) { ai->Feast(); }
//Item* fItem = ai->FindBandage();
/* 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()
{
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
示例3: 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
示例4: DoNonCombatActions
void PlayerbotShamanAI::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 and heal raid
if (DoSupportRaid(m_bot)) { return; }
//heal pets and bots
Unit *target = DoSelectLowestHpFriendly(40, 1000);
if (target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth())) { return; }
//Buffs
if (ChangeWeaponEnchants()) { return; }
if (CastSpell(WATER_SHIELD,m_bot)) { return; }
if (CastSpell(EARTH_SHIELD,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 (m_bot->GetHealth() < m_bot->GetMaxHealth() && CastSpell(LESSER_HEAL,m_bot)) { return; }
if (ai->GetManaPercent() < 50) { ai->Feast(); }
} //end DoNonCombatActions
示例5: DoNonCombatActions
void PlayerbotDruidAI::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 and heal raid
if (DoSupportRaid(GetMaster())) { return; }
if (m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup() && DoSupportRaid(m_bot)) { return; }
//heal pets and bots
Unit *target = DoSelectLowestHpFriendly(30, 1000);
if (target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth())) { 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() < 10 && CastSpell (INNERVATE, m_bot)) { return; } //Need mana fast
if (m_bot->GetHealth() < m_bot->GetMaxHealth() &&
(ai->GetForm() != FORM_CAT && ai->GetForm() != FORM_MOONKIN && ai->GetForm() != FORM_DIREBEAR && ai->GetForm() != FORM_BEAR)
&& CastSpell(REGROWTH,m_bot)) { return; }
if (ai->GetManaPercent() < 50) { ai->Feast(); }
} //end DoNonCombatActions
示例6: DoNonCombatActions
void PlayerbotRogueAI::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 Up
if (ChangeWeaponEnchants()) { return; }
//mana/hp check
if (m_bot->getRace() == (uint8) RACE_UNDEAD_PLAYER && ai->GetHealthPercent() < 75 && CastSpell(R_CANNIBALIZE,m_bot)) { return; }
if (ai->GetHealthPercent() < 50) { ai->Feast(); }
} //end DoNonCombatActions
示例7: 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
示例8: _DoNextPVECombatManeuverHeal
void PlayerbotDruidAI::_DoNextPVECombatManeuverHeal(Unit* pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
if (TREE_OF_LIFE > 0 && !m_bot->HasAura(TREE_OF_LIFE, EFFECT_INDEX_0))
ai->CastSpell(TREE_OF_LIFE, *m_bot);
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;
}
// spellcasting form, but disables healing spells so it's got to go
if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
{
m_bot->RemoveAurasDueToSpell(MOONKIN_FORM_1);
//ai->TellMaster("FormClearMoonkin");
return;
}
if (ai->GetHealthPercent() <= 60)
{
HealTarget(m_bot);
return;
}
if (masterHP <= 50)
{
HealTarget(GetMaster());
return;
}
// TODO: err... what about the other teammates?
DruidSpellCombat = 0;
}
示例9: HealTarget
void PlayerbotPaladinAI::HealTarget(Unit &target, uint8 hp)
{
PlayerbotAI* ai = GetAI();
if (hp < 40 && HOLY_LIGHT > 0 && ai->GetManaPercent() >= 34)
ai->CastSpell(HOLY_LIGHT, target);
if (hp < 35 && HOLY_SHOCK > 0 && ai->GetManaPercent() >= 21)
ai->CastSpell(HOLY_SHOCK, target);
if (hp < 30 && FLASH_OF_LIGHT > 0 && ai->GetManaPercent() >= 8)
ai->CastSpell(FLASH_OF_LIGHT, target);
if (hp < 25 && LAY_ON_HANDS > 0 && ai->GetHealthPercent() > 30 && ai->GetManaPercent() >= 8)
ai->CastSpell(LAY_ON_HANDS, target);
} // end HealTarget
示例10: HealTarget
bool PlayerbotPaladinAI::HealTarget(Unit &target, uint8 hp)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return false;
Player* pMaster = ai->GetMaster();
if (!pMaster)
return false;
if ((hp < 40)
&& (HOLY_LIGHT > 0)
&& (ai->GetManaPercent() >= 34)
&& (ai->CastSpell(HOLY_LIGHT, target)))
return true;
if ((hp < 35)
&& (HOLY_SHOCK > 0)
&& (ai->GetManaPercent() >= 21)
&& (ai->CastSpell(HOLY_SHOCK, target)))
return true;
if ((hp < 30)
&& (FLASH_OF_LIGHT > 0)
&& (ai->GetManaPercent() >= 8)
&& (ai->CastSpell(FLASH_OF_LIGHT, target)))
return true;
if ((hp < 25)
&& (LAY_ON_HANDS > 0)
&& (ai->GetHealthPercent() > 30)
&& (ai->GetManaPercent() >= 8)
&& (ai->CastSpell(LAY_ON_HANDS, target)))
return true;
return false;
}
示例11: DoNextCombatManeuver
//.........这里部分代码省略.........
else if (dist > ATTACK_DISTANCE && !m_rangedCombat)
{
// switch to ranged combat
m_rangedCombat = true;
// increase ranged attack power...
(ASPECT_OF_THE_HAWK > 0 && !m_bot->HasAura(ASPECT_OF_THE_HAWK, EFFECT_INDEX_0) && ai->CastSpell(ASPECT_OF_THE_HAWK, *m_bot));
}
else if (m_rangedCombat && !m_bot->HasAura(ASPECT_OF_THE_HAWK, EFFECT_INDEX_0))
// check if we have hawk aspect in ranged combat
(ASPECT_OF_THE_HAWK > 0 && ai->CastSpell(ASPECT_OF_THE_HAWK, *m_bot));
else if (!m_rangedCombat && !m_bot->HasAura(ASPECT_OF_THE_MONKEY, EFFECT_INDEX_0))
// check if we have monkey aspect in melee combat
(ASPECT_OF_THE_MONKEY > 0 && ai->CastSpell(ASPECT_OF_THE_MONKEY, *m_bot));
// activate auto shot
if (AUTO_SHOT > 0 && m_rangedCombat && !m_bot->FindCurrentSpellBySpellId(AUTO_SHOT))
ai->CastSpell(AUTO_SHOT, *pTarget);
//ai->TellMaster( "started auto shot." );
else if (AUTO_SHOT > 0 && m_bot->FindCurrentSpellBySpellId(AUTO_SHOT))
m_bot->InterruptNonMeleeSpells(true, AUTO_SHOT);
//ai->TellMaster( "stopped auto shot." );
// damage spells
std::ostringstream out;
if (m_rangedCombat)
{
out << "Case Ranged";
if (HUNTERS_MARK > 0 && ai->GetManaPercent() >= 3 && !pTarget->HasAura(HUNTERS_MARK, EFFECT_INDEX_0) && ai->CastSpell(HUNTERS_MARK, *pTarget))
out << " > Hunter's Mark";
else if (RAPID_FIRE > 0 && ai->GetManaPercent() >= 3 && !m_bot->HasAura(RAPID_FIRE, EFFECT_INDEX_0) && ai->CastSpell(RAPID_FIRE, *m_bot))
out << " > Rapid Fire";
else if (MULTI_SHOT > 0 && ai->GetManaPercent() >= 13 && ai->GetAttackerCount() >= 3 && ai->CastSpell(MULTI_SHOT, *pTarget))
out << " > Multi-Shot";
else if (ARCANE_SHOT > 0 && ai->GetManaPercent() >= 7 && ai->CastSpell(ARCANE_SHOT, *pTarget))
out << " > Arcane Shot";
else if (CONCUSSIVE_SHOT > 0 && ai->GetManaPercent() >= 6 && !pTarget->HasAura(CONCUSSIVE_SHOT, EFFECT_INDEX_0) && ai->CastSpell(CONCUSSIVE_SHOT, *pTarget))
out << " > Concussive Shot";
else if (EXPLOSIVE_SHOT > 0 && ai->GetManaPercent() >= 10 && !pTarget->HasAura(EXPLOSIVE_SHOT, EFFECT_INDEX_0) && ai->CastSpell(EXPLOSIVE_SHOT, *pTarget))
out << " > Explosive Shot";
else if (VIPER_STING > 0 && ai->GetManaPercent() >= 8 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() < 70 && !pTarget->HasAura(VIPER_STING, EFFECT_INDEX_0) && ai->CastSpell(VIPER_STING, *pTarget))
out << " > Viper Sting";
else if (SERPENT_STING > 0 && ai->GetManaPercent() >= 13 && !pTarget->HasAura(SERPENT_STING, EFFECT_INDEX_0) && !pTarget->HasAura(SCORPID_STING, EFFECT_INDEX_0) && !pTarget->HasAura(VIPER_STING, EFFECT_INDEX_0) && ai->CastSpell(SERPENT_STING, *pTarget))
out << " > Serpent Sting";
else if (SCORPID_STING > 0 && ai->GetManaPercent() >= 11 && !pTarget->HasAura(WYVERN_STING, EFFECT_INDEX_0) && !pTarget->HasAura(SCORPID_STING, EFFECT_INDEX_0) && !pTarget->HasAura(SERPENT_STING, EFFECT_INDEX_0) && !pTarget->HasAura(VIPER_STING, EFFECT_INDEX_0) && ai->CastSpell(SCORPID_STING, *pTarget))
out << " > Scorpid Sting";
else if (CHIMERA_SHOT > 0 && ai->GetManaPercent() >= 12 && ai->CastSpell(CHIMERA_SHOT, *pTarget))
out << " > Chimera Shot";
else if (VOLLEY > 0 && ai->GetManaPercent() >= 24 && ai->GetAttackerCount() >= 3 && ai->CastSpell(VOLLEY, *pTarget))
out << " > Volley";
else if (BLACK_ARROW > 0 && ai->GetManaPercent() >= 6 && !pTarget->HasAura(BLACK_ARROW, EFFECT_INDEX_0) && ai->CastSpell(BLACK_ARROW, *pTarget))
out << " > Black Arrow";
else if (AIMED_SHOT > 0 && ai->GetManaPercent() >= 12 && ai->CastSpell(AIMED_SHOT, *pTarget))
out << " > Aimed Shot";
else if (STEADY_SHOT > 0 && ai->GetManaPercent() >= 5 && ai->CastSpell(STEADY_SHOT, *pTarget))
out << " > Steady Shot";
else if (KILL_SHOT > 0 && ai->GetManaPercent() >= 7 && pTarget->GetHealth() < pTarget->GetMaxHealth() * 0.2 && ai->CastSpell(KILL_SHOT, *pTarget))
out << " > Kill Shot!";
else
out << " NONE!";
}
else
{
out << "Case Melee";
if (RAPTOR_STRIKE > 0 && ai->GetManaPercent() >= 6 && ai->CastSpell(RAPTOR_STRIKE, *pTarget))
out << " > Raptor Strike";
else if (EXPLOSIVE_TRAP > 0 && ai->GetManaPercent() >= 27 && !pTarget->HasAura(EXPLOSIVE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(ARCANE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(IMMOLATION_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(FROST_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(BEAR_TRAP, EFFECT_INDEX_0) && ai->CastSpell(EXPLOSIVE_TRAP, *pTarget))
out << " > Explosive Trap";
else if (WING_CLIP > 0 && ai->GetManaPercent() >= 6 && !pTarget->HasAura(WING_CLIP, EFFECT_INDEX_0) && ai->CastSpell(WING_CLIP, *pTarget))
out << " > Wing Clip";
else if (IMMOLATION_TRAP > 0 && ai->GetManaPercent() >= 13 && !pTarget->HasAura(IMMOLATION_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(ARCANE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(EXPLOSIVE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(FROST_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(BEAR_TRAP, EFFECT_INDEX_0) && ai->CastSpell(IMMOLATION_TRAP, *pTarget))
out << " > Immolation Trap";
else if (MONGOOSE_BITE > 0 && ai->GetManaPercent() >= 4 && ai->CastSpell(MONGOOSE_BITE, *pTarget))
out << " > Mongoose Bite";
else if (FROST_TRAP > 0 && ai->GetManaPercent() >= 2 && !pTarget->HasAura(FROST_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(ARCANE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(IMMOLATION_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(EXPLOSIVE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(BEAR_TRAP, EFFECT_INDEX_0) && ai->CastSpell(FROST_TRAP, *pTarget))
out << " > Frost Trap";
else if (ARCANE_TRAP > 0 && !pTarget->HasAura(ARCANE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(BEAR_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(EXPLOSIVE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(IMMOLATION_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(FROST_TRAP, EFFECT_INDEX_0) && ai->CastSpell(ARCANE_TRAP, *pTarget))
out << " > Arcane Trap";
else if (DETERRENCE > 0 && pVictim == m_bot && m_bot->GetHealth() < m_bot->GetMaxHealth() * 0.5 && !m_bot->HasAura(DETERRENCE, EFFECT_INDEX_0) && ai->CastSpell(DETERRENCE, *m_bot))
out << " > Deterrence";
else if (m_bot->getRace() == RACE_TAUREN && !pTarget->HasAura(WAR_STOMP, EFFECT_INDEX_0) && ai->CastSpell(WAR_STOMP, *pTarget))
out << " > War Stomp";
else if (m_bot->getRace() == RACE_DWARF && m_bot->HasAuraState(AURA_STATE_DEADLY_POISON) && ai->CastSpell(STONEFORM, *m_bot))
out << " > Stoneform";
else if (m_bot->getRace() == RACE_NIGHTELF && pVictim == m_bot && ai->GetHealthPercent() < 25 && !m_bot->HasAura(SHADOWMELD, EFFECT_INDEX_0) && ai->CastSpell(SHADOWMELD, *m_bot))
out << " > Shadowmeld";
else if ((pet && !pet->getDeathState() != ALIVE)
&& (MISDIRECTION > 0 && pVictim == m_bot && !m_bot->HasAura(MISDIRECTION, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9 && ai->CastSpell(MISDIRECTION, *pet)))
out << " > Misdirection"; // give threat to pet
/*else if( FREEZING_TRAP>0 && ai->GetManaPercent()>=5 && !pTarget->HasAura(FREEZING_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(ARCANE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(EXPLOSIVE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(BEAR_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(IMMOLATION_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(FROST_TRAP, EFFECT_INDEX_0) && ai->CastSpell(FREEZING_TRAP,*pTarget) )
out << " > Freezing Trap"; // this can trap your bots too
else if( BEAR_TRAP>0 && !pTarget->HasAura(BEAR_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(ARCANE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(EXPLOSIVE_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(IMMOLATION_TRAP, EFFECT_INDEX_0) && !pTarget->HasAura(FROST_TRAP, EFFECT_INDEX_0) && ai->CastSpell(BEAR_TRAP,*pTarget) )
out << " > Bear Trap"; // this was just too annoying :)
else if( DISENGAGE>0 && pVictim && ai->GetManaPercent()>=5 && ai->CastSpell(DISENGAGE,*pTarget) )
out << " > Disengage!"; // attempt to return to ranged combat*/
else
out << " NONE!";
}
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster(out.str().c_str());
} // end DoNextCombatManeuver
示例12: DoNextCombatManeuver
void PlayerbotShamanAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
ai->CastSpell(LIGHTNING_BOLT);
return;
default:
break;
}
// ------- Non Duel combat ----------
Player *m_bot = GetPlayerBot();
Group *m_group = m_bot->GetGroup();
// Heal myself
if (ai->GetHealthPercent() < 30 && ai->GetManaPercent() >= 32)
ai->CastSpell(HEALING_WAVE);
else if (ai->GetHealthPercent() < 50 && ai->GetManaPercent() >= 19)
ai->CastSpell(LESSER_HEALING_WAVE);
else if (ai->GetHealthPercent() < 70)
HealTarget (*m_bot, ai->GetHealthPercent());
// Heal master
uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
if (GetMaster()->isAlive())
{
if (masterHP < 30 && ai->GetManaPercent() >= 32)
ai->CastSpell(HEALING_WAVE, *(GetMaster()));
else if (masterHP < 70)
HealTarget (*GetMaster(), masterHP);
}
// Heal group
if (m_group)
{
Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *m_groupMember = sObjectMgr.GetPlayer(itr->guid);
if (!m_groupMember || !m_groupMember->isAlive())
continue;
uint32 memberHP = m_groupMember->GetHealth() * 100 / m_groupMember->GetMaxHealth();
if (memberHP < 30)
HealTarget(*m_groupMember, memberHP);
}
}
// Damage Spells
switch (SpellSequence)
{
case SPELL_ENHANCEMENT:
if (STRENGTH_OF_EARTH_TOTEM > 0 && LastSpellEnhancement == 1 && (!m_bot->HasAura(STRENGTH_OF_EARTH_TOTEM, EFFECT_INDEX_0)) && ai->GetManaPercent() >= 13)
{
ai->CastSpell(STRENGTH_OF_EARTH_TOTEM);
SpellSequence = SPELL_RESTORATION;
LastSpellEnhancement = LastSpellEnhancement + 1;
break;
}
else if (STONESKIN_TOTEM > 0 && LastSpellEnhancement == 5 && (!m_bot->HasAura(STONESKIN_TOTEM, EFFECT_INDEX_0)) && (!m_bot->HasAura(STRENGTH_OF_EARTH_TOTEM, EFFECT_INDEX_0)) && ai->GetManaPercent() >= 13)
{
ai->CastSpell(STONESKIN_TOTEM);
SpellSequence = SPELL_RESTORATION;
LastSpellEnhancement = LastSpellEnhancement + 1;
break;
}
else if (FOCUSED > 0 && LastSpellEnhancement == 2)
{
ai->CastSpell(FOCUSED, *pTarget);
SpellSequence = SPELL_RESTORATION;
LastSpellEnhancement = LastSpellEnhancement + 1;
break;
}
else if (FROST_RESISTANCE_TOTEM > 0 && LastSpellEnhancement == 10 && (!m_bot->HasAura(FROST_RESISTANCE_TOTEM, EFFECT_INDEX_0)) && (!m_bot->HasAura(TOTEM_OF_WRATH, EFFECT_INDEX_0)) && (!m_bot->HasAura(FLAMETONGUE_TOTEM, EFFECT_INDEX_0)) && ai->GetManaPercent() >= 10)
{
ai->CastSpell(FROST_RESISTANCE_TOTEM);
SpellSequence = SPELL_RESTORATION;
LastSpellEnhancement = LastSpellEnhancement + 1;
break;
}
else if (FLAMETONGUE_TOTEM > 0 && LastSpellEnhancement == 15 && (!m_bot->HasAura(FLAMETONGUE_TOTEM, EFFECT_INDEX_0)) && (!m_bot->HasAura(TOTEM_OF_WRATH, EFFECT_INDEX_0)) && (!m_bot->HasAura(FROST_RESISTANCE_TOTEM, EFFECT_INDEX_0)) && ai->GetManaPercent() >= 14)
{
ai->CastSpell(FLAMETONGUE_TOTEM);
SpellSequence = SPELL_RESTORATION;
LastSpellEnhancement = LastSpellEnhancement + 1;
break;
}
else if (FIRE_RESISTANCE_TOTEM > 0 && LastSpellEnhancement == 20 && (!m_bot->HasAura(FIRE_RESISTANCE_TOTEM, EFFECT_INDEX_0)) && (!m_bot->HasAura(HEALING_STREAM_TOTEM, EFFECT_INDEX_0)) && (!m_bot->HasAura(MANA_SPRING_TOTEM, EFFECT_INDEX_0)) && ai->GetManaPercent() >= 10)
{
ai->CastSpell(FIRE_RESISTANCE_TOTEM);
SpellSequence = SPELL_RESTORATION;
LastSpellEnhancement = LastSpellEnhancement + 1;
break;
//.........这里部分代码省略.........
示例13: 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))
//.........这里部分代码省略.........
示例14: 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;
}
}
}
示例15: _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))
{
//.........这里部分代码省略.........