本文整理汇总了C++中PlayerbotAI::GetCombatStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetCombatStyle方法的具体用法?C++ PlayerbotAI::GetCombatStyle怎么用?C++ PlayerbotAI::GetCombatStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetCombatStyle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoNextCombatManeuver
void PlayerbotPriestAI::DoNextCombatManeuver(Unit *pTarget)
{
Unit* pVictim = pTarget->getVictim();
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_PVP_DUEL:
(ai->HasAura(SCREAM, *pTarget) && ai->GetHealthPercent() < 60 && ai->CastSpell(HEAL)) ||
ai->CastSpell(SHADOW_WORD_PAIN) ||
(ai->GetHealthPercent() < 80 && ai->CastSpell(RENEW)) ||
(ai->GetPlayerBot()->GetDistance(pTarget) <= 5 && ai->CastSpell(SCREAM)) ||
ai->CastSpell(MIND_BLAST) ||
(ai->GetHealthPercent() < 50 && ai->CastSpell(GREATER_HEAL)) ||
ai->CastSpell(SMITE);
return;
default:
break;
}
// ------- Non Duel combat ----------
Player *m_bot = GetPlayerBot();
Group *m_group = m_bot->GetGroup();
bool meleeReach = m_bot->CanReachWithMeleeAttack(pTarget);
if (ai->GetCombatStyle() != PlayerbotAI::COMBAT_RANGED && !meleeReach)
ai->SetCombatStyle(PlayerbotAI::COMBAT_RANGED);
// if in melee range OR can't shoot OR have no ranged (wand) equipped
else if (ai->GetCombatStyle() != PlayerbotAI::COMBAT_MELEE
&& (meleeReach || SHOOT == 0 || !m_bot->GetWeaponForAttack(RANGED_ATTACK, true, true))
&& !ai->IsHealer())
ai->SetCombatStyle(PlayerbotAI::COMBAT_MELEE);
if (SHOOT > 0 && ai->GetCombatStyle() == PlayerbotAI::COMBAT_RANGED && !m_bot->FindCurrentSpellBySpellId(SHOOT))
ai->CastSpell(SHOOT, *pTarget);
//ai->TellMaster( "started auto shot." );
else if (SHOOT > 0 && m_bot->FindCurrentSpellBySpellId(SHOOT))
m_bot->InterruptNonMeleeSpells(true, SHOOT);
// Heal myself
if (ai->GetHealthPercent() < 15 && FADE > 0 && !m_bot->HasAura(FADE, EFFECT_INDEX_0))
{
ai->TellMaster("I'm casting fade.");
ai->CastSpell(FADE, *m_bot);
}
else if (ai->GetHealthPercent() < 25 && POWER_WORD_SHIELD > 0 && !m_bot->HasAura(POWER_WORD_SHIELD, EFFECT_INDEX_0))
{
ai->TellMaster("I'm casting pws on myself.");
ai->CastSpell(POWER_WORD_SHIELD);
}
else if (ai->GetHealthPercent() < 35 && DESPERATE_PRAYER > 0)
{
ai->TellMaster("I'm casting desperate prayer.");
ai->CastSpell(DESPERATE_PRAYER, *m_bot);
}
else if (ai->GetHealthPercent() < 80)
HealTarget (m_bot);
// Heal master
uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
if (GetMaster()->isAlive())
{
if (masterHP < 25 && POWER_WORD_SHIELD > 0 && !GetMaster()->HasAura(POWER_WORD_SHIELD, EFFECT_INDEX_0))
ai->CastSpell(POWER_WORD_SHIELD, *(GetMaster()));
else if (masterHP < 80)
HealTarget (GetMaster());
}
// 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 < 25)
HealTarget(m_groupMember);
}
}
// Damage Spells
switch (SpellSequence)
{
case SPELL_HOLY:
if (SMITE > 0 && ai->In_Reach(pTarget,SMITE) && LastSpellHoly < 1 && !pTarget->HasAura(SMITE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 17)
{
ai->CastSpell(SMITE, *pTarget);
SpellSequence = SPELL_SHADOWMAGIC;
LastSpellHoly = LastSpellHoly + 1;
break;
}
else if (MANA_BURN > 0 && ai->In_Reach(pTarget,MANA_BURN) && LastSpellHoly < 2 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 14)
{
//ai->TellMaster("I'm casting mana burn.");
//.........这里部分代码省略.........
示例2: DoNextCombatManeuver
void PlayerbotMageAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_PVP_DUEL:
if (FIREBALL > 0)
ai->CastSpell(FIREBALL);
return;
}
// ------- Non Duel combat ----------
//ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob
// Damage Spells (primitive example)
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
bool meleeReach = m_bot->CanReachWithMeleeAttack(pTarget);
if (!meleeReach && ai->GetCombatStyle() != PlayerbotAI::COMBAT_RANGED)
{
// switch to ranged combat
ai->SetCombatStyle(PlayerbotAI::COMBAT_RANGED);
}
if (SHOOT > 0 && ai->GetCombatStyle() == PlayerbotAI::COMBAT_RANGED && !m_bot->FindCurrentSpellBySpellId(SHOOT))
ai->CastSpell(SHOOT, *pTarget);
//ai->TellMaster( "started auto shot." );
else if (SHOOT > 0 && m_bot->FindCurrentSpellBySpellId(SHOOT))
m_bot->InterruptNonMeleeSpells(true, SHOOT);
switch (SpellSequence)
{
case SPELL_FROST:
if (ICY_VEINS > 0 && !m_bot->HasAura(ICY_VEINS, EFFECT_INDEX_0) && LastSpellFrost < 1 && ai->GetManaPercent() >= 3)
{
ai->CastSpell(ICY_VEINS, *m_bot);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
}
else if (FROSTBOLT > 0 && LastSpellFrost < 2 && !pTarget->HasAura(FROSTBOLT, EFFECT_INDEX_0) && ai->GetManaPercent() >= 16)
{
ai->CastSpell(FROSTBOLT, *pTarget);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
}
else if (FROST_WARD > 0 && LastSpellFrost < 3 && !m_bot->HasAura(FROST_WARD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 19)
{
ai->CastSpell(FROST_WARD, *m_bot);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
}
else if (FROST_NOVA > 0 && LastSpellFrost < 4 && meleeReach && !pTarget->HasAura(FROST_NOVA, EFFECT_INDEX_0) && ai->GetManaPercent() >= 10)
{
ai->CastSpell(FROST_NOVA, *pTarget);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
}
else if (ICE_LANCE > 0 && LastSpellFrost < 5 && ai->GetManaPercent() >= 7)
{
ai->CastSpell(ICE_LANCE, *pTarget);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
}
else if (BLIZZARD > 0 && LastSpellFrost < 6 && ai->GetAttackerCount() >= 5 && ai->GetManaPercent() >= 89)
{
ai->CastSpell(BLIZZARD, *pTarget);
ai->SetIgnoreUpdateTime(8);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
}
else if (CONE_OF_COLD > 0 && LastSpellFrost < 7 && meleeReach && !pTarget->HasAura(CONE_OF_COLD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 35)
{
ai->CastSpell(CONE_OF_COLD, *pTarget);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
}
else if (DEEP_FREEZE > 0 && LastSpellFrost < 8 && pTarget->HasAura(AURA_STATE_FROZEN, EFFECT_INDEX_0) && !pTarget->HasAura(DEEP_FREEZE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9)
{
ai->CastSpell(DEEP_FREEZE, *pTarget);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
}
else if (ICE_BARRIER > 0 && LastSpellFrost < 9 && pVictim == m_bot && !m_bot->HasAura(ICE_BARRIER, EFFECT_INDEX_0) && ai->GetHealthPercent() < 50 && ai->GetManaPercent() >= 30)
{
ai->CastSpell(ICE_BARRIER, *m_bot);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
//.........这里部分代码省略.........