本文整理汇总了C++中PlayerbotAI::GetManager方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetManager方法的具体用法?C++ PlayerbotAI::GetManager怎么用?C++ PlayerbotAI::GetManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetManager方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoFirstCombatManeuver
bool PlayerbotWarriorAI::DoFirstCombatManeuver(Unit *pTarget)
{
Player *m_bot = GetPlayerBot();
PlayerbotAI *ai = GetAI();
PlayerbotAI::CombatOrderType co = ai->GetCombatOrder();
float fTargetDist = m_bot->GetCombatDistance(pTarget);
if ((co & PlayerbotAI::ORDERS_TANK) && DEFENSIVE_STANCE > 0 && !m_bot->HasAura(DEFENSIVE_STANCE, EFFECT_INDEX_0) && ai->CastSpell(DEFENSIVE_STANCE))
{
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("First > Defensive Stance (%d)", DEFENSIVE_STANCE);
return true;
}
else if ((co & PlayerbotAI::ORDERS_TANK) && TAUNT > 0 && m_bot->HasAura(DEFENSIVE_STANCE, EFFECT_INDEX_0) && ai->CastSpell(TAUNT, *pTarget))
{
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("First > Taunt (%d)", TAUNT);
return false;
}
else if (BATTLE_STANCE > 0 && !m_bot->HasAura(BATTLE_STANCE, EFFECT_INDEX_0) && ai->CastSpell(BATTLE_STANCE))
{
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("First > Battle Stance (%d)", BATTLE_STANCE);
return true;
}
else if (BATTLE_STANCE > 0 && CHARGE > 0 && m_bot->HasAura(BATTLE_STANCE, EFFECT_INDEX_0))
{
if (fTargetDist < 8.0f)
return false;
else if (fTargetDist > 25.0f)
return true;
else if (CHARGE > 0 && ai->CastSpell(CHARGE, *pTarget))
{
float x, y, z;
pTarget->GetContactPoint(m_bot, x, y, z, 3.666666f);
m_bot->Relocate(x, y, z);
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("First > Charge (%d)", CHARGE);
return false;
}
}
return false;
}
示例2: DoFirstCombatManeuver
bool PlayerbotRogueAI::DoFirstCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
Player * m_bot = GetPlayerBot();
if (STEALTH > 0 && !m_bot->HasAura(STEALTH, EFFECT_INDEX_0) && ai->CastSpell(STEALTH, *m_bot))
{
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("First > Stealth (%d)", STEALTH);
m_bot->addUnitState(UNIT_STAT_CHASE); // ensure that the bot does not use MoveChase(), as this doesn't seem to work with STEALTH
return true;
}
else if (m_bot->HasAura(STEALTH, EFFECT_INDEX_0))
{
m_bot->GetMotionMaster()->MoveFollow(pTarget, 4.5f, m_bot->GetOrientation());
return false;
}
return false;
}
示例3: 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
示例4: DoNextCombatManeuver
//.........这里部分代码省略.........
{
ai->CastSpell (DIVINE_STORM, *pTarget);
out << " Divine Storm";
CombatCounter++;
break;
}
else if (HAMMER_OF_WRATH > 0 && CombatCounter < 8 && pTarget->GetHealth() < pTarget->GetMaxHealth() * 0.20 && ai->GetManaPercent() >= 14)
{
ai->CastSpell (HAMMER_OF_WRATH, *pTarget);
out << " Hammer of Wrath";
CombatCounter++;
break;
}
else if (HOLY_WRATH > 0 && CombatCounter < 9 && ai->GetAttackerCount() >= 3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 24)
{
ai->CastSpell (HOLY_WRATH, *pTarget);
out << " Holy Wrath";
CombatCounter++;
break;
}
else if (HAND_OF_SACRIFICE > 0 && pVictim == GetMaster() && !GetMaster()->HasAura(HAND_OF_SACRIFICE, EFFECT_INDEX_0) && CombatCounter < 10 && ai->GetManaPercent() >= 6)
{
ai->CastSpell (HAND_OF_SACRIFICE, *GetMaster());
out << " Hand of Sacrifice";
CombatCounter++;
break;
}
else if (DIVINE_PROTECTION > 0 && pVictim == m_bot && !m_bot->HasAura(FORBEARANCE, EFFECT_INDEX_0) && ai->GetHealthPercent() < 30 && CombatCounter < 11 && ai->GetManaPercent() >= 3)
{
ai->CastSpell (DIVINE_PROTECTION, *m_bot);
out << " Divine Protection";
CombatCounter++;
break;
}
else if (RIGHTEOUS_DEFENSE > 0 && pVictim != m_bot && ai->GetHealthPercent() > 70 && CombatCounter < 12)
{
ai->CastSpell (RIGHTEOUS_DEFENSE, *pTarget);
out << " Righteous Defense";
CombatCounter++;
break;
}
else if (DIVINE_PLEA > 0 && !m_bot->HasAura(DIVINE_PLEA, EFFECT_INDEX_0) && ai->GetManaPercent() < 50 && CombatCounter < 13)
{
ai->CastSpell (DIVINE_PLEA, *m_bot);
out << " Divine Plea";
CombatCounter++;
break;
}
else if (DIVINE_FAVOR > 0 && !m_bot->HasAura(DIVINE_FAVOR, EFFECT_INDEX_0) && CombatCounter < 14)
{
ai->CastSpell (DIVINE_FAVOR, *m_bot);
out << " Divine Favor";
CombatCounter++;
break;
}
else if (CombatCounter > 15)
{
CombatCounter = 0;
//ai->TellMaster("CombatCounter Reset");
break;
}
else
{
CombatCounter = 0;
//ai->TellMaster("Counter = 0");
break;
}
case Healing:
if (ai->GetHealthPercent() <= 40)
{
HealTarget (m_bot);
out << " ...healing bot";
break;
}
if (masterHP <= 40)
{
HealTarget (GetMaster());
out << " ...healing master";
break;
}
else
{
CombatCounter = 0;
//ai->TellMaster("Counter = 0");
break;
}
}
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster(out.str().c_str());
if (AVENGING_WRATH > 0 && !m_bot->HasAura(AVENGING_WRATH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
ai->CastSpell(AVENGING_WRATH, *m_bot);
if (DIVINE_SHIELD > 0 && ai->GetHealthPercent() < 30 && pVictim == m_bot && !m_bot->HasAura(FORBEARANCE, EFFECT_INDEX_0) && !m_bot->HasAura(DIVINE_SHIELD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 3)
ai->CastSpell(DIVINE_SHIELD, *m_bot);
if (DIVINE_SACRIFICE > 0 && ai->GetHealthPercent() > 50 && pVictim != m_bot && !m_bot->HasAura(DIVINE_SACRIFICE, EFFECT_INDEX_0))
ai->CastSpell(DIVINE_SACRIFICE, *m_bot);
}
示例5: DoNextCombatManeuver
void PlayerbotRogueAI::DoNextCombatManeuver(Unit *pTarget)
{
if (!pTarget)
return;
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
{
if (SINISTER_STRIKE > 0)
ai->CastSpell(SINISTER_STRIKE);
return;
}
default:
break;
}
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
float fTargetDist = m_bot->GetCombatDistance(pTarget);
// TODO: make this work better...
/*if (pVictim)
{
if( pVictim!=m_bot && !m_bot->hasUnitState(UNIT_STAT_FOLLOW) && !pTarget->isInBackInMap(m_bot,10) ) {
GetAI()->TellMaster( "getting behind target" );
m_bot->GetMotionMaster()->Clear( true );
m_bot->GetMotionMaster()->MoveFollow( pTarget, 1, 2*M_PI );
}
else if( pVictim==m_bot && m_bot->hasUnitState(UNIT_STAT_FOLLOW) )
{
GetAI()->TellMaster( "chasing attacking target" );
m_bot->GetMotionMaster()->Clear( true );
m_bot->GetMotionMaster()->MoveChase( pTarget );
}
}*/
//Rouge like behaviour. ^^
/* if (VANISH > 0 && GetMaster()->isDead()) { //Causes the server to crash :( removed for now.
m_bot->AttackStop();
m_bot->RemoveAllAttackers();
ai->CastSpell(VANISH);
// m_bot->RemoveAllSpellCooldown();
GetAI()->TellMaster("AttackStop, CombatStop, Vanish");
}*/
// decide what to do:
if (pVictim == m_bot && CLOAK_OF_SHADOWS > 0 && pVictim->HasAura(SPELL_AURA_PERIODIC_DAMAGE) && !m_bot->HasAura(CLOAK_OF_SHADOWS, EFFECT_INDEX_0) && ai->CastSpell(CLOAK_OF_SHADOWS))
{
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("CoS!");
return;
}
else if (m_bot->HasAura(STEALTH, EFFECT_INDEX_0))
SpellSequence = RogueStealth;
else if (pTarget->IsNonMeleeSpellCasted(true))
SpellSequence = RogueSpellPreventing;
else if (pVictim == m_bot && ai->GetHealthPercent() < 40)
SpellSequence = RogueThreat;
else
SpellSequence = RogueCombat;
// we fight in melee, target is not in range, skip the next part!
if (fTargetDist > ATTACK_DISTANCE)
return;
std::ostringstream out;
switch (SpellSequence)
{
case RogueStealth:
out << "Case Stealth";
if (PICK_POCKET > 0 && (pTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0 &&
!((Creature*)pTarget)->lootForPickPocketed && ai->CastSpell(PICK_POCKET, *pTarget))
out << " > Pick Pocket";
else if (PREMEDITATION > 0 && ai->CastSpell(PREMEDITATION, *pTarget))
out << " > Premeditation";
else if (AMBUSH > 0 && ai->GetEnergyAmount() >= 60 && ai->CastSpell(AMBUSH, *pTarget))
out << " > Ambush";
else if (CHEAP_SHOT > 0 && !pTarget->HasAura(CHEAP_SHOT, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 60 && ai->CastSpell(CHEAP_SHOT, *pTarget))
out << " > Cheap Shot";
else if (GARROTE > 0 && ai->GetEnergyAmount() >= 50 && ai->CastSpell(GARROTE, *pTarget))
out << " > Garrote";
else
m_bot->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
break;
case RogueThreat:
out << "Case Threat";
if (GOUGE > 0 && ai->GetEnergyAmount() >= 45 && !pTarget->HasAura(GOUGE, EFFECT_INDEX_0) && ai->CastSpell(GOUGE, *pTarget))
out << " > Gouge";
else if (EVASION > 0 && ai->GetHealthPercent() <= 35 && !m_bot->HasAura(EVASION, EFFECT_INDEX_0) && ai->CastSpell(EVASION))
out << " > Evasion";
else if (BLIND > 0 && ai->GetHealthPercent() <= 30 && !pTarget->HasAura(BLIND, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 30 && ai->CastSpell(BLIND, *pTarget))
out << " > Blind";
else if (FEINT > 0 && ai->GetHealthPercent() <= 25 && ai->GetEnergyAmount() >= 20 && ai->CastSpell(FEINT))
out << " > Feint";
else if (VANISH > 0 && ai->GetHealthPercent() <= 20 && !m_bot->HasAura(FEINT, EFFECT_INDEX_0) && ai->CastSpell(VANISH))
//.........这里部分代码省略.........
示例6: DoNextCombatManeuver
void PlayerbotWarriorAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
if (HEROIC_STRIKE > 0)
ai->CastSpell(HEROIC_STRIKE);
return;
}
// ------- Non Duel combat ----------
// Damage Attacks
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
float fTargetDist = m_bot->GetCombatDistance(pTarget);
PlayerbotAI::CombatOrderType co = ai->GetCombatOrder();
// decide what stance to use
if ((co & PlayerbotAI::ORDERS_TANK) && !m_bot->HasAura(DEFENSIVE_STANCE, EFFECT_INDEX_0) && ai->CastSpell(DEFENSIVE_STANCE))
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("Stance > Defensive");
else if (!(co & PlayerbotAI::ORDERS_TANK) && !m_bot->HasAura(BATTLE_STANCE, EFFECT_INDEX_0) && ai->CastSpell(BATTLE_STANCE))
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("Stance > Battle");
// get spell sequence
if (pTarget->IsNonMeleeSpellCasted(true))
SpellSequence = WarriorSpellPreventing;
else if (m_bot->HasAura(BATTLE_STANCE, EFFECT_INDEX_0))
SpellSequence = WarriorBattle;
else if (m_bot->HasAura(DEFENSIVE_STANCE, EFFECT_INDEX_0))
SpellSequence = WarriorDefensive;
else if (m_bot->HasAura(BERSERKER_STANCE, EFFECT_INDEX_0))
SpellSequence = WarriorBerserker;
// do shouts, berserker rage, etc...
if (BERSERKER_RAGE > 0 && !m_bot->HasAura(BERSERKER_RAGE, EFFECT_INDEX_0) && ai->CastSpell(BERSERKER_RAGE))
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("Pre > Berseker Rage");
else if (DEMORALIZING_SHOUT > 0 && ai->GetRageAmount() >= 10 && !pTarget->HasAura(DEMORALIZING_SHOUT, EFFECT_INDEX_0) && ai->CastSpell(DEMORALIZING_SHOUT))
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("Pre > Demoralizing Shout");
else if (BATTLE_SHOUT > 0 && ai->GetRageAmount() >= 10 && !m_bot->HasAura(BATTLE_SHOUT, EFFECT_INDEX_0) && ai->CastSpell(BATTLE_SHOUT))
if (ai->GetManager()->m_confDebugWhisper)
ai->TellMaster("Pre > Battle Shout");
std::ostringstream out;
switch (SpellSequence)
{
case WarriorSpellPreventing:
out << "Case Prevent";
if (SHIELD_BASH > 0 && ai->GetRageAmount() >= 10 && ai->CastSpell(SHIELD_BASH, *pTarget))
out << " > Shield Bash";
else if (PUMMEL > 0 && ai->GetRageAmount() >= 10 && ai->CastSpell(PUMMEL, *pTarget))
out << " > Pummel";
else if (SPELL_REFLECTION > 0 && ai->GetRageAmount() >= 15 && !m_bot->HasAura(SPELL_REFLECTION, EFFECT_INDEX_0) && ai->CastSpell(SPELL_REFLECTION, *m_bot))
out << " > Spell Reflection";
else
out << " > NONE";
break;
case WarriorBattle:
out << "Case Battle";
if (EXECUTE > 0 && ai->GetRageAmount() >= 15 && pTarget->GetHealth() < pTarget->GetMaxHealth() * 0.2 && ai->CastSpell(EXECUTE, *pTarget))
out << " > Execute!";
else if (LAST_STAND > 0 && !m_bot->HasAura(LAST_STAND, EFFECT_INDEX_0) && m_bot->GetHealth() < m_bot->GetMaxHealth() * 0.5 && ai->CastSpell(LAST_STAND, *m_bot))
out << " > Last Stand!";
else if (BLOODRAGE > 0 && ai->GetRageAmount() < 50 && !m_bot->HasAura(BLOODRAGE, EFFECT_INDEX_0) && ai->CastSpell(BLOODRAGE, *m_bot))
out << " > Bloodrage";
else if (DEATH_WISH > 0 && ai->GetRageAmount() >= 10 && !m_bot->HasAura(DEATH_WISH, EFFECT_INDEX_0) && ai->CastSpell(DEATH_WISH, *m_bot))
out << " > Death Wish";
else if (RETALIATION > 0 && pVictim == m_bot && ai->GetAttackerCount() >= 2 && !m_bot->HasAura(RETALIATION, EFFECT_INDEX_0) && ai->CastSpell(RETALIATION, *m_bot))
out << " > Retaliation";
else if (DEMORALIZING_SHOUT > 0 && ai->GetRageAmount() >= 10 && !pTarget->HasAura(DEMORALIZING_SHOUT, EFFECT_INDEX_0) && ai->CastSpell(DEMORALIZING_SHOUT, *pTarget))
out << " > Demoralizing Shout";
else if (SWEEPING_STRIKES > 0 && ai->GetRageAmount() >= 30 && ai->GetAttackerCount() >= 2 && !m_bot->HasAura(SWEEPING_STRIKES, EFFECT_INDEX_0) && ai->CastSpell(SWEEPING_STRIKES, *m_bot))
out << " > Sweeping Strikes!";
else if (BLADESTORM > 0 && ai->GetRageAmount() >= 25 && pVictim == m_bot && !m_bot->HasAura(BLADESTORM, EFFECT_INDEX_0) && ai->GetAttackerCount() >= 3 && ai->CastSpell(BLADESTORM, *pTarget))
out << " > Bladestorm!";
else if (MORTAL_STRIKE > 0 && ai->GetRageAmount() >= 30 && !pTarget->HasAura(MORTAL_STRIKE, EFFECT_INDEX_0) && ai->CastSpell(MORTAL_STRIKE, *pTarget))
out << " > Mortal Strike";
else if (INTIMIDATING_SHOUT > 0 && ai->GetRageAmount() >= 25 && ai->GetAttackerCount() > 5 && ai->CastSpell(INTIMIDATING_SHOUT, *pTarget))
out << " > Intimidating Shout";
else if (THUNDER_CLAP > 0 && ai->GetRageAmount() >= 20 && pVictim == m_bot && !pTarget->HasAura(THUNDER_CLAP, EFFECT_INDEX_0) && ai->CastSpell(THUNDER_CLAP, *pTarget))
out << " > Thunder Clap";
else if (ENRAGED_REGENERATION > 0 && ai->GetRageAmount() >= 15 && !m_bot->HasAura(BERSERKER_RAGE, EFFECT_INDEX_0) && !m_bot->HasAura(ENRAGED_REGENERATION, EFFECT_INDEX_0) && m_bot->GetHealth() < m_bot->GetMaxHealth() * 0.5 && ai->CastSpell(ENRAGED_REGENERATION, *m_bot))
out << " > Enraged Regeneration";
else if (SHOCKWAVE > 0 && ai->GetRageAmount() >= 15 && pVictim == m_bot && !pTarget->HasAura(WAR_STOMP, EFFECT_INDEX_0) && !pTarget->HasAura(PIERCING_HOWL, EFFECT_INDEX_0) && !pTarget->HasAura(SHOCKWAVE, EFFECT_INDEX_0) && !pTarget->HasAura(CONCUSSION_BLOW, EFFECT_INDEX_0) && ai->CastSpell(SHOCKWAVE, *pTarget))
out << " > Shockwave";
else if (REND > 0 && ai->GetRageAmount() >= 10 && !pTarget->HasAura(REND, EFFECT_INDEX_0) && ai->CastSpell(REND, *pTarget))
out << " > Rend";
else if (HAMSTRING > 0 && ai->GetRageAmount() >= 10 && !pTarget->HasAura(HAMSTRING, EFFECT_INDEX_0) && ai->CastSpell(HAMSTRING, *pTarget))
out << " > Hamstring";
else if (CHALLENGING_SHOUT > 0 && ai->GetRageAmount() >= 5 && pVictim != m_bot && ai->GetHealthPercent() > 25 && !pTarget->HasAura(MOCKING_BLOW, EFFECT_INDEX_0) && !pTarget->HasAura(CHALLENGING_SHOUT, EFFECT_INDEX_0) && ai->CastSpell(CHALLENGING_SHOUT, *pTarget))
out << " > Challenging Shout";
//.........这里部分代码省略.........
示例7: DoNextCombatManeuver
//.........这里部分代码省略.........
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (PESTILENCE > 0 && dist <= ATTACK_DISTANCE && ai->GetAttackerCount()>=3 && LastSpellBloodDK < 3)
{
ai->CastSpell(PESTILENCE, *pTarget);
out << " Pestilence";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (STRANGULATE > 0 && !pTarget->HasAura(STRANGULATE, 0) && LastSpellBloodDK < 4)
{
ai->CastSpell(STRANGULATE, *pTarget);
out << " Strangulate";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (BLOOD_BOIL > 0 && ai->GetAttackerCount()>=5 && dist <= ATTACK_DISTANCE && LastSpellBloodDK < 5)
{
ai->CastSpell(BLOOD_BOIL, *pTarget);
out << " Blood Boil";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (HEART_STRIKE > 0 && LastSpellBloodDK < 6)
{
ai->CastSpell(HEART_STRIKE, *pTarget);
out << " Heart Strike";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (VAMPIRIC_BLOOD > 0 && ai->GetHealthPercent() < 70 && !m_bot->HasAura(VAMPIRIC_BLOOD, 0) && LastSpellBloodDK < 7)
{
ai->CastSpell(VAMPIRIC_BLOOD, *m_bot);
out << " Vampiric Blood";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (RUNE_TAP > 0 && ai->GetHealthPercent() < 70 && !m_bot->HasAura(VAMPIRIC_BLOOD, 0) && LastSpellBloodDK < 8)
{
ai->CastSpell(RUNE_TAP, *m_bot);
out << " Rune Tap";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (HYSTERIA > 0 && ai->GetHealthPercent() > 25 && !m_bot->HasAura(HYSTERIA, 0) && LastSpellBloodDK < 9)
{
ai->CastSpell(HYSTERIA, *m_bot);
out << " Hysteria";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (DANCING_WEAPON > 0 && !m_bot->HasAura(DANCING_WEAPON, 0) && ai->GetRunicPower() >= 60 && LastSpellBloodDK < 10)
{
ai->CastSpell(DANCING_WEAPON, *pTarget);
out << " summoning Dancing Rune Weapon";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (DARK_COMMAND > 0 && ai->GetHealthPercent() > 50 && pVictim != m_bot && !pTarget->HasAura(DARK_COMMAND, 0) && dist <= ATTACK_DISTANCE && LastSpellBloodDK < 11)
{
ai->CastSpell(DARK_COMMAND, *pTarget);
out << " Dark Command";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if(( pet )
&& (DEATH_PACT > 0 && ai->GetHealthPercent() < 50 && LastSpellBloodDK < 12 && ai->GetRunicPower() >= 40))
{
ai->CastSpell(DEATH_PACT, *pet);
out << " Death Pact (sacrifice pet)";
SpellSequence = SPELL_DK_UNHOLY;
LastSpellBloodDK = LastSpellBloodDK +1;
break;
}
else if (LastSpellBloodDK > 13)
{
LastSpellBloodDK = 0;
SpellSequence = SPELL_DK_UNHOLY;
break;
}
else
{
LastSpellBloodDK = 0;
SpellSequence = SPELL_DK_UNHOLY;
}
}
if( ai->GetManager()->m_confDebugWhisper )
ai->TellMaster( out.str().c_str() );
} // end DoNextCombatManeuver