本文整理汇总了C++中PlayerbotAI::GetForm方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetForm方法的具体用法?C++ PlayerbotAI::GetForm怎么用?C++ PlayerbotAI::GetForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetForm方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HealGroup
bool PlayerbotDruidAI::HealGroup(Unit *target, uint8 hp, uint8 &countNeedHeal)
{
PlayerbotAI *ai = GetAI();
Player *m_bot = GetPlayerBot();
if (!m_bot || !ai || m_bot->isDead()) { return false; }
if (!target || target->isDead()) { return false; }
if (countNeedHeal < 2) { return false; }
// Decide if it is worth to change form
if (ai->GetForm() == FORM_MOONKIN || ai->GetForm() == FORM_CAT || ai->GetForm() == FORM_DIREBEAR || ai->GetForm() == FORM_BEAR)
{
if (hp > 70) { return false; }
if (!CanCast(TRANQUILITY,target,0,0,1) && !WILD_GROWTH) { return false; }
if (!WILD_GROWTH && hp > 35) { return false; }
if (hp < 65 && GetAI()->GetManaPercent() >= 70 ) { ChangeForm(1); }
else if (hp < 40 && GetAI()->GetManaPercent() >= 50) { ChangeForm(1); }
else if (hp < 25 && GetAI()->GetManaPercent() >= 30) { ChangeForm(1); }
else return false;
}
if (hp < 36 && m_bot->isInCombat() && CanCast(TRANQUILITY,target))
{
bool sc = CastSpell(TRANQUILITY, target, false);
if (sc) GetAI()->SetIgnoreUpdateTime(10);
return sc;
}
if (hp < 75 && CastSpell(WILD_GROWTH,target)) { return true; }
return false;
}
示例2: HealTarget
bool PlayerbotDruidAI::HealTarget(Unit *target, uint8 hp)
{
PlayerbotAI *ai = GetAI();
Player *m_bot = GetPlayerBot();
if (!m_bot || !ai || m_bot->isDead()) { return false; }
if (!target || target->isDead()) { return false; }
// Decide if it is worth to change form
if (ai->GetForm() == FORM_MOONKIN || ai->GetForm() == FORM_CAT || ai->GetForm() == FORM_DIREBEAR || ai->GetForm() == FORM_BEAR)
{
if (hp < 75 && GetAI()->GetManaPercent() >= 70 ) { ChangeForm(1); }
else if (hp < 40 && GetAI()->GetManaPercent() >= 50) { ChangeForm(1); }
else if (hp < 25 && GetAI()->GetManaPercent() >= 30) { ChangeForm(1); }
else return false;
}
// if(m_bot->HasAura(TRAVEL_FORM)) ChangeForm(1);
if(hp < 60 && m_bot->HasAura(NATURES_SWIFTNESS) && CastSpell(HEALING_TOUCH, target)) { return true; }
if(hp < 90 && CastSpell(LIFEBLOOM, target)) { return true; }
if(hp < 80 && CastSpell(REJUVENATION, target)) { return true; }
if(hp < 60 && CastSpell(REGROWTH, target)) { return true; }
if(hp < 70 && CanCast(NOURISH,target) &&
(HasAuraName(target,REJUVENATION,m_bot->GetGUID()) || HasAuraName(target,LIFEBLOOM,m_bot->GetGUID()) || HasAuraName(target,REGROWTH,m_bot->GetGUID()))
) { return CastSpell(NOURISH, target, false); }
if(hp < 50 && CanCast(SWIFTMEND,target) &&
(HasAuraName(target,REJUVENATION,m_bot->GetGUID()) || HasAuraName(target,REGROWTH,m_bot->GetGUID()))
) { return CastSpell(SWIFTMEND, target, false); }
if(hp < 40 && m_bot->isInCombat() && CastSpell(NATURES_SWIFTNESS, m_bot)) { } // NO gcd
if(hp < 40 && CastSpell(HEALING_TOUCH, target)) { return true; }
return false;
} //end HealTarget
示例3: 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
示例4: ChangeForm
bool PlayerbotDruidAI::ChangeForm(uint32 form)
{
PlayerbotAI *ai = GetAI();
Player *m_bot = GetPlayerBot();
if (!m_bot || !ai || m_bot->isDead()) { return false; }
if (!form) return false;
if (form == 1 && ai->GetForm() == FORM_NONE) return false;
if (form != 1)
{
if (!CanCast(form,m_bot,0,0,1)) return false;
if (m_bot->HasAura(form)) { return false; }
}
if (ai->GetForm() == FORM_TREE) m_bot->RemoveAurasDueToSpell(TREE_OF_LIFE_FORM);
else if (ai->GetForm() == FORM_CAT) m_bot->RemoveAurasDueToSpell(CAT_FORM);
else if (ai->GetForm() == FORM_MOONKIN) m_bot->RemoveAurasDueToSpell(MOONKIN_FORM);
else if (ai->GetForm() == FORM_DIREBEAR || ai->GetForm() == FORM_BEAR) m_bot->RemoveAurasDueToSpell(BEAR_FORM);
else if (ai->GetForm() == FORM_TRAVEL) m_bot->RemoveAurasDueToSpell(TRAVEL_FORM);
else if (ai->GetForm() == FORM_FLIGHT || ai->GetForm() == FORM_FLIGHT_EPIC) m_bot->RemoveAurasDueToSpell(FLIGHT_FORM);
else if (ai->GetForm() == FORM_AQUA) m_bot->RemoveAurasDueToSpell(AQUATIC_FORM);
if (form == 1) { return true; }
return CastSpell(form,m_bot,false);
}
示例5: CureTarget
bool PlayerbotDruidAI::CureTarget(Unit *target)
{
PlayerbotAI *ai = GetAI();
Player *m_bot = GetPlayerBot();
if (!m_bot || !ai || m_bot->isDead()) { return false; }
if (!target || target->isDead()) { return false; }
// Decide if it is worth to change form (they cange forms even if theres nothing to cure..)
if (ai->GetForm() == FORM_CAT || ai->GetForm() == FORM_DIREBEAR || ai->GetForm() == FORM_BEAR)
{
//if(GetAI()->GetManaPercent() >= 80 ) { ChangeForm(1); }
//else { return false; }
return false;
}
if (castDispel(CURE_POISON, target)) { return true; }
// if(HasAuraName(target, "Venom Spit") || HasAuraName(target, "Poison")) return CastSpell(CURE_POISON, target);
return false;
} //end HealTarget
示例6: DoNextCombatManeuver
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
if (!pTarget || pTarget->isDead()) return;
PlayerbotAI *ai = GetAI();
if (!ai) return;
Player *m_bot = GetPlayerBot();
if (!m_bot || m_bot->isDead()) return;
Unit *pVictim = pTarget->getVictim();
Unit *m_tank = FindMainTankInRaid(GetMaster());
if (!m_tank && m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup()) { FindMainTankInRaid(m_bot); }
if (!m_tank) { m_tank = m_bot; }
uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
float pDist = m_bot->GetDistance(pTarget);
uint8 pThreat = GetThreatPercent(pTarget);
uint8 reqHeal = 0;
uint8 OwnPartyHP = GetHealthPercentRaid(m_bot, reqHeal);
#pragma region Select behaviour
if (m_tank->GetGUID() == m_bot->GetGUID()) // Hey! I am Main Tank
{
if (TALENT_FERAL && BEAR_FORM) { m_role = BOT_ROLE_TANK; } //Just Keep Tanking dont even change forms for healing
else
{
if (TALENT_BALANCE) {
if ((ai->GetHealthPercent() <= 40 || masterHP <30 ) && (ai->GetManaPercent() >= 40)) { m_role = BOT_ROLE_SUPPORT; }
else if (OwnPartyHP < 20 && ai->GetManaPercent() >= 30) { m_role = BOT_ROLE_SUPPORT; }
else if (ai->GetManaPercent() < 25 ) { m_role = BOT_ROLE_TANK; }
else { m_role = BOT_ROLE_DPS_RANGED; }
}
else //I am both healer and tank?? Hmm
{
if ((ai->GetHealthPercent() <= 70 || masterHP <70 ) && (ai->GetManaPercent() >= 50)) { m_role = BOT_ROLE_SUPPORT; }
else if (OwnPartyHP < 20 && ai->GetManaPercent() >= 30) { m_role = BOT_ROLE_SUPPORT; }
else if (ai->GetManaPercent() < 15 ) { m_role = BOT_ROLE_TANK; }
else { m_role = BOT_ROLE_DPS_RANGED; }
}
}
}
else if (isUnderAttack() && !( ai->GetForm() == FORM_MOONKIN || ai->GetForm() == FORM_TREE) ) // if i am under attack
{
// Keep being in Cat Form if you can reduce threat
if (ai->GetForm() == FORM_CAT && CastSpell(COWER,pTarget)) {return; }
else if (TALENT_RESTO && ai->GetManaPercent() > 10 ) { m_role = BOT_ROLE_SUPPORT; }
else { m_role = BOT_ROLE_OFFTANK; }
}
else if (TALENT_FERAL && CAT_FORM) { // If has any feral forms at all
if ((ai->GetHealthPercent() <= 40 || masterHP <40 ) && (ai->GetManaPercent() >= 40)) { m_role = BOT_ROLE_SUPPORT; }
else if (OwnPartyHP < 30 && ai->GetManaPercent() >= 30) { m_role = BOT_ROLE_SUPPORT; }
else{ m_role = BOT_ROLE_DPS_MELEE; }
}
else if (TALENT_BALANCE) {
if ((ai->GetHealthPercent() <= 50 || masterHP <40 ) && (ai->GetManaPercent() >= 10)) { m_role = BOT_ROLE_SUPPORT; }
else if (OwnPartyHP < 40 && ai->GetManaPercent() >= 30) { m_role = BOT_ROLE_SUPPORT; }
else { m_role = BOT_ROLE_DPS_RANGED; }
}
else if (TALENT_RESTO) { m_role = BOT_ROLE_SUPPORT; }
else
{
// Unknown build or low level : Do not change forms rapidly..
if ( (ai->GetManaPercent() < 30 && BEAR_FORM) || ( (ai->GetForm() == FORM_CAT || ai->GetForm() == FORM_DIREBEAR || ai->GetForm() == FORM_BEAR) && ai->GetManaPercent() < 70 ) ) m_role = BOT_ROLE_DPS_MELEE;
else { m_role = BOT_ROLE_DPS_RANGED; }
}
if (!isUnderAttack() && m_tank->GetGUID() != m_bot->GetGUID())
{
// Select Attacking target
if (pVictim && pVictim->GetGUID() == m_bot->GetGUID() && pDist <= 2) {} //if my target is attacking me continue
else
{
Unit *curAtt = GetNearestAttackerOf(m_bot);
if (curAtt && curAtt->GetGUID() != pTarget->GetGUID())
{
m_bot->SetSelection(curAtt->GetGUID());
//ai->AddLootGUID(curAtt->GetGUID());
DoNextCombatManeuver(curAtt); //Restart new update to get variables fixed..
return;
}
}
//my target is attacking me
}
#pragma endregion
// If there's a cast stop
if (m_bot->HasUnitState(UNIT_STAT_CASTING)) return;
// Return to normal form from non combat forms
if (ai->GetForm() == FORM_NONE || ai->GetForm() == FORM_CAT || ai->GetForm() == FORM_TREE || ai->GetForm() == FORM_MOONKIN || ai->GetForm() == FORM_DIREBEAR || ai->GetForm() == FORM_BEAR ) { } //Those are valid incombat auras
else if (ai->GetForm() != FORM_NONE && ChangeForm(1)) { } //return to caster form
switch(m_role)
{
#pragma region BOT_ROLE_DPS_MELEE
case BOT_ROLE_DPS_MELEE:
//ai->TellMaster("DruidCombat");
// Do caster form stuff
if (ai->GetForm() == FORM_NONE)
{
//We have little mana probably cant change form
//.........这里部分代码省略.........