本文整理汇总了C++中PlayerbotAI::GetScenarioType方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetScenarioType方法的具体用法?C++ PlayerbotAI::GetScenarioType怎么用?C++ PlayerbotAI::GetScenarioType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetScenarioType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoNextCombatManeuver
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
ai->CastSpell(MOONFIRE);
return;
default:
break;
}
uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_HEAL) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
SpellSequence = DruidHeal;
else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
SpellSequence = DruidCombat;
else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_TANK)
SpellSequence = DruidTank;
else
SpellSequence = DruidSpell;
switch (SpellSequence)
{
case DruidTank: // Its now a tank druid!
//ai->TellMaster("DruidTank");
_DoNextPVECombatManeuverBear(pTarget);
break;
case DruidSpell:
//ai->TellMaster("DruidSpell");
_DoNextPVECombatManeuverSpellDPS(pTarget);
break;
case DruidHeal:
//ai->TellMaster("DruidHeal");
_DoNextPVECombatManeuverHeal(pTarget);
break;
case DruidCombat:
//ai->TellMaster("DruidCombat");
_DoNextPVECombatManeuverMeleeDPS(pTarget);
break;
}
} // end DoNextCombatManeuver
示例2: DoNextCombatManeuver
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
ai->CastSpell(MOONFIRE);
return;
}
uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_HEAL)
SpellSequence = DruidHeal;
else if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST && CAT_FORM > 0)
SpellSequence = DruidCombat;
// No check for Dire Bear here: you must have Bear form to learn Dire Bear form.
else if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_TANK && BEAR_FORM > 0)
SpellSequence = DruidTank;
else
SpellSequence = DruidSpell;
switch (SpellSequence)
{
case DruidTank: // Its now a tank druid!
//ai->TellMaster("DruidTank");
_DoNextPVECombatManeuverBear(pTarget);
break;
case DruidSpell:
//ai->TellMaster("DruidSpell");
_DoNextPVECombatManeuverSpellDPS(pTarget);
break;
case DruidHeal:
//ai->TellMaster("DruidHeal");
_DoNextPVECombatManeuverHeal(pTarget);
break;
case DruidCombat:
//ai->TellMaster("DruidCombat");
_DoNextPVECombatManeuverMeleeDPS(pTarget);
break;
}
} // end DoNextCombatManeuver
示例3: DoNextCombatManeuver
void PlayerbotPaladinAI::DoNextCombatManeuver(Unit *pTarget)
{
Unit* pVictim = pTarget->getVictim();
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
if (HAMMER_OF_JUSTICE > 0)
ai->CastSpell(HAMMER_OF_JUSTICE);
return;
default:
break;
}
// damage spells
Player *m_bot = GetPlayerBot();
Group *m_group = m_bot->GetGroup();
float dist = m_bot->GetCombatDistance(pTarget);
std::ostringstream out;
//Shield master if low hp.
uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
if (GetMaster()->isAlive())
if (masterHP < 25 && HAND_OF_PROTECTION > 0 && !GetMaster()->HasAura(FORBEARANCE, EFFECT_INDEX_0) && !GetMaster()->HasAura(HAND_OF_PROTECTION, EFFECT_INDEX_0) && !GetMaster()->HasAura(DIVINE_PROTECTION, EFFECT_INDEX_0) && !GetMaster()->HasAura(DIVINE_SHIELD, EFFECT_INDEX_0))
ai->CastSpell(HAND_OF_PROTECTION, *GetMaster());
// heal group inside combat, but do not heal if tank
if (m_group && pVictim != m_bot) // possible tank
{
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 < 40 && ai->GetManaPercent() >= 40) // do not heal bots without plenty of mana for master & self
if (HealTarget(m_groupMember))
return;
}
}
if (RIGHTEOUS_FURY > 0 && !m_bot->HasAura(RIGHTEOUS_FURY, EFFECT_INDEX_0))
ai->CastSpell (RIGHTEOUS_FURY, *m_bot);
if (SHADOW_RESISTANCE_AURA > 0 && !m_bot->HasAura(SHADOW_RESISTANCE_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_WARLOCK)
ai->CastSpell (SHADOW_RESISTANCE_AURA, *m_bot);
if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_WARRIOR)
ai->CastSpell (DEVOTION_AURA, *m_bot);
if (FIRE_RESISTANCE_AURA > 0 && !m_bot->HasAura(FIRE_RESISTANCE_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_MAGE)
ai->CastSpell (FIRE_RESISTANCE_AURA, *m_bot);
if (RETRIBUTION_AURA > 0 && !m_bot->HasAura(RETRIBUTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_PRIEST)
ai->CastSpell (RETRIBUTION_AURA, *m_bot);
if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_SHAMAN)
ai->CastSpell (DEVOTION_AURA, *m_bot);
if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_ROGUE)
ai->CastSpell (DEVOTION_AURA, *m_bot);
if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_PALADIN)
ai->CastSpell (DEVOTION_AURA, *m_bot);
if (ai->GetHealthPercent() <= 40 || GetMaster()->GetHealth() <= GetMaster()->GetMaxHealth() * 0.4)
SpellSequence = Healing;
else
SpellSequence = Combat;
switch (SpellSequence)
{
case Combat:
if (JUDGEMENT_OF_LIGHT > 0 && !pTarget->HasAura(JUDGEMENT_OF_LIGHT, EFFECT_INDEX_0) && CombatCounter < 1 && ai->GetManaPercent() >= 5)
{
ai->CastSpell (JUDGEMENT_OF_LIGHT, *pTarget);
out << " Judgement of Light";
CombatCounter++;
break;
}
else if (SEAL_OF_COMMAND > 0 && !m_bot->HasAura(SEAL_OF_COMMAND, EFFECT_INDEX_0) && CombatCounter < 2 && ai->GetManaPercent() >= 14)
{
ai->CastSpell (SEAL_OF_COMMAND, *m_bot);
out << " Seal of Command";
CombatCounter++;
break;
}
else if (HAMMER_OF_JUSTICE > 0 && !pTarget->HasAura(HAMMER_OF_JUSTICE, EFFECT_INDEX_0) && CombatCounter < 3 && ai->GetManaPercent() >= 3)
{
ai->CastSpell (HAMMER_OF_JUSTICE, *pTarget);
out << " Hammer of Justice";
CombatCounter++;
break;
}
//.........这里部分代码省略.........
示例4: 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))
//.........这里部分代码省略.........
示例5: DoNextCombatManeuver
void PlayerbotPriestAI::DoNextCombatManeuver(Unit *pTarget)
{
Unit* pVictim = pTarget->getVictim();
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
(ai->HasAura(SCREAM,*pTarget) && ai->GetHealthPercent() < 60 && ai->CastSpell(HEAL)) ||
ai->CastSpell(PAIN) ||
(ai->GetHealthPercent() < 80 && ai->CastSpell(RENEW)) ||
(ai->GetPlayerBot()->GetDistance(pTarget) <= 5 && ai->CastSpell(SCREAM)) ||
ai->CastSpell(MIND_BLAST) ||
(ai->GetHealthPercent() < 20 && ai->CastSpell(GREAT_HEAL)) ||
ai->CastSpell(SMITE);
return;
}
// ------- Non Duel combat ----------
ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob
Player *m_bot = GetPlayerBot();
Group *m_group = m_bot->GetGroup();
// 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 && PWS > 0 && !m_bot->HasAura(PWS, EFFECT_INDEX_0))
{
ai->TellMaster("I'm casting pws on myself.");
ai->CastSpell(PWS);
}
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, ai->GetHealthPercent());
// Heal master
uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
if (GetMaster()->isAlive())
{
if (masterHP < 25 && PWS > 0 && !GetMaster()->HasAura(PWS, EFFECT_INDEX_0))
ai->CastSpell(PWS, *(GetMaster()));
else if (masterHP < 80)
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 < 25 )
HealTarget( *m_groupMember, memberHP );
}
}
// Damage Spells
ai->SetInFront( pTarget );
float dist = m_bot->GetDistance( pTarget );
switch (SpellSequence)
{
case SPELL_HOLY:
if (SMITE > 0 && 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 && LastSpellHoly <2 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 14)
{
//ai->TellMaster("I'm casting mana burn.");
ai->CastSpell(MANA_BURN, *pTarget);
ai->SetIgnoreUpdateTime(3);
SpellSequence = SPELL_SHADOWMAGIC;
LastSpellHoly = LastSpellHoly +1;
break;
}
else if (HOLY_NOVA > 0 && LastSpellHoly <3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 22)
{
//ai->TellMaster("I'm casting holy nova.");
ai->CastSpell(HOLY_NOVA);
SpellSequence = SPELL_SHADOWMAGIC;
//.........这里部分代码省略.........
示例6: DoNextCombatManeuver
void PlayerbotHunterAI::DoNextCombatManeuver(Unit *pTarget){
PlayerbotAI* ai = GetAI();
if (!ai) return;
switch (ai->GetScenarioType()) {
case PlayerbotAI::SCENARIO_DUEL:
ai->CastSpell(RAPTOR_STRIKE);
return;
}
// ------- Non Duel combat ----------
// Hunter
ai->SetInFront( pTarget );
Player *m_bot = GetPlayerBot();
// check for pet and heal if neccessary
Pet *pet = m_bot->GetPet();
if( pet ) {
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" );
return;
}
}
}
// check if ranged combat is possible (set m_rangedCombat and switch auras
float dist = m_bot->GetDistance( pTarget );
if( (dist<=ATTACK_DISTANCE || !m_bot->GetUInt32Value(PLAYER_AMMO_ID)) && m_rangedCombat ) {
// switch to melee combat (target in melee range, out of ammo)
m_rangedCombat = false;
if( !m_bot->GetUInt32Value(PLAYER_AMMO_ID) )
ai->TellMaster( "OUT OF AMMO!" );
// become monkey (increases dodge chance)...
( ASPECT_OF_THE_MONKEY>0 && !m_bot->HasAura(ASPECT_OF_THE_MONKEY, 0) && ai->CastSpell(ASPECT_OF_THE_MONKEY,*m_bot) );
} else if( dist>ATTACK_DISTANCE && !m_rangedCombat ) {
// switch to ranged combat
m_rangedCombat = false;
// increase ranged attack power...
( ASPECT_OF_THE_HAWK>0 && !m_bot->HasAura(ASPECT_OF_THE_HAWK, 0) && ai->CastSpell(ASPECT_OF_THE_HAWK,*m_bot) );
} else if( m_rangedCombat && !m_bot->HasAura(ASPECT_OF_THE_HAWK, 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, 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,0) && ai->CastSpell(HUNTERS_MARK,*pTarget) )
out << " > Hunter's Mark";
else if( MULTI_SHOT>0 && ai->GetAttackerCount()>=3 && ai->CastSpell(MULTI_SHOT,*pTarget) )
out << " > Multi Shot";
else if( ARCANE_SHOT>0 && ai->GetManaPercent()>=5 && ai->CastSpell(ARCANE_SHOT,*pTarget) )
out << " > Arcane Shot";
else if( CONCUSSIVE_SHOT>0 && ai->GetManaPercent()>=8 && !pTarget->HasAura(CONCUSSIVE_SHOT,0) && ai->CastSpell(CONCUSSIVE_SHOT,*pTarget) )
out << " > Concussive Shot";
else
out << " NONE!";
} else {
out << "Case Melee";
if( RAPTOR_STRIKE>0 && ai->CastSpell(RAPTOR_STRIKE,*pTarget) )
out << " > Raptor Strike";
else
out << " NONE!";
}
ai->TellMaster( out.str().c_str() );
} // end DoNextCombatManeuver
示例7: DoNextCombatManeuver
void PlayerbotShamanAI::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);
switch(ai->GetScenarioType())
{
case SCENARIO_DUEL:
((ai->GetHealthPercent() < 80 && CastSpell(LESSER_HEAL)) ||
CastSpell(LIGHTNING_BOLT, pTarget));
return;
}
// Cast CC breakers if any match found (include any dispels first) does not work yet
//uint32 ccSpells[4] = { R_ESCAPE_ARTIST, R_EVERY_MAN_FOR_HIMSELF, R_WILL_OF_FORSAKEN, R_STONEFORM };
//if (ai->GetManaPercent() < 35) { ccSpells[0] = 0; ccSpells[1] = 0; } //We dont have any mana to waste...
//if (castSelfCCBreakers(ccSpells)) { } // Most of them don't trigger gcd
#pragma region Choose Actions
// Choose actions accoring to talents
if (m_tank->GetGUID() == m_bot->GetGUID()) { m_role=BOT_ROLE_TANK; } // Hey! I am Main Tank
else if (TALENT_ENHANCEMENT) { m_role = BOT_ROLE_DPS_MELEE; }
else if (TALENT_ELEMENTAL) { m_role = BOT_ROLE_DPS_RANGED; }
else if (TALENT_RESTO) { m_role = BOT_ROLE_SUPPORT; }
else { m_role = BOT_ROLE_DPS_MELEE; } //Unknown build or low level.. Mainly attack
// if i am under attack and if i am not tank or offtank: change target if needed
if (m_tank->GetGUID() != m_bot->GetGUID() && isUnderAttack() )
{
if (pVictim && pVictim->GetGUID() == m_bot->GetGUID() && pDist <= 2) { } // My target is almost up to me, no need to search
else //Have to select nearest target
{
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
// Choose Weapon Enchant
if (ChangeWeaponEnchants()) return;
if (TALENT_ELEMENTAL){ if (!m_bot->HasAura(WATER_SHIELD) && CastSpell(WATER_SHIELD,m_bot)) { return; }}
if (TALENT_ENHANCEMENT){ if (!m_bot->HasAura(LIGHTNING_SHIELD) && CastSpell(LIGHTNING_SHIELD,m_bot)) { return; }}
if (TALENT_RESTO){ if (!m_bot->HasAura(WATER_SHIELD) && CastSpell(WATER_SHIELD,m_bot)) { return; }}
// Choose shield
/*
if (EARTH_SHIELD && ai->GetHealthPercent() < 80 && isUnderAttack()) { if (CastSpell(EARTH_SHIELD,m_bot)) { return; } }
else if (WATER_SHIELD && ai->GetManaPercent() < 40) { if (CastSpell(WATER_SHIELD,m_bot)) { return; } }
else if (LIGHTNING_SHIELD &&
( isUnderAttack() || m_tank->GetGUID() == m_bot->GetGUID() ) && !(m_bot->HasAura(WATER_SHIELD) && ai->GetManaPercent() < 80)
) { if (CastSpell(LIGHTNING_SHIELD,m_bot)) { return; } }
else if (CastSpell(WATER_SHIELD,m_bot)) { return; }
*/
// If there's a cast stop
if(m_bot->HasUnitState(UNIT_STAT_CASTING)) return;
switch(m_role)
{
#pragma region BOT_ROLE_TANK / BOT_ROLE_OFFTANK
case BOT_ROLE_TANK:
case BOT_ROLE_OFFTANK:
if (!TALENT_ELEMENTAL && !TALENT_RESTO) { TakePosition(pTarget); }
else { TakePosition(pTarget,BOT_ROLE_DPS_RANGED); } // mob will come to you sooner or later no need to hurry
// Do support stuff
if (!m_bot->isMoving() && ChangeTotems(m_role)) { return; }
if (ai->GetManaPercent() > 70 && DoSupportRaid(m_bot)) { return; }
break;
#pragma endregion
#pragma region BOT_ROLE_DPS_MELEE
case BOT_ROLE_DPS_MELEE:
TakePosition(pTarget);
// Do support stuff
if (!m_bot->isMoving() && ChangeTotems(m_role)) { return; }
if (ai->GetManaPercent() > 40 && DoSupportRaid(m_bot)) { return; }
break;
#pragma endregion
//.........这里部分代码省略.........
示例8: DoNextCombatManeuver
void PlayerbotPaladinAI::DoNextCombatManeuver(Unit *pTarget){
PlayerbotAI* ai = GetAI();
if (!ai) return;
switch (ai->GetScenarioType()) {
case PlayerbotAI::SCENARIO_DUEL:
if (HAMMER_OF_JUSTICE > 0) {
ai->CastSpell(HAMMER_OF_JUSTICE);
}
return;
}
// damage spells
ai->SetInFront( pTarget );
Player *m_bot = GetPlayerBot();
//Shield master if low hp.
uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
if (GetMaster()->isAlive()) {
if (masterHP < 25 && HAND_OF_PROTECTION > 0 && !GetMaster()->HasAura(HAND_OF_PROTECTION, 0)) {
ai->CastSpell(HAND_OF_PROTECTION, *(GetMaster()));
}
}
if (SHADOW_RESISTANCE_AURA > 0 && !m_bot->HasAura(SHADOW_RESISTANCE_AURA, 0) && pTarget->getClass() == CLASS_WARLOCK) {
GetAI()->CastSpell (SHADOW_RESISTANCE_AURA, *m_bot);
}
if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, 0) && pTarget->getClass() == CLASS_WARRIOR) {
GetAI()->CastSpell (DEVOTION_AURA, *m_bot);
}
if (FIRE_RESISTANCE_AURA > 0 && !m_bot->HasAura(FIRE_RESISTANCE_AURA, 0) && pTarget->getClass() == CLASS_MAGE) {
GetAI()->CastSpell (FIRE_RESISTANCE_AURA, *m_bot);
}
if (RETRIBUTION_AURA > 0 && !m_bot->HasAura(RETRIBUTION_AURA, 0) && pTarget->getClass() == CLASS_PRIEST) {
GetAI()->CastSpell (RETRIBUTION_AURA, *m_bot);
}
if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, 0) && pTarget->getClass() == CLASS_SHAMAN) {
GetAI()->CastSpell (DEVOTION_AURA, *m_bot);
}
if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, 0) && pTarget->getClass() == CLASS_ROGUE) {
GetAI()->CastSpell (DEVOTION_AURA, *m_bot);
}
if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, 0) && pTarget->getClass() == CLASS_PALADIN) {
GetAI()->CastSpell (DEVOTION_AURA, *m_bot);
}
if (ai->GetHealthPercent() < 55) {
SpellSequence = Healing;
}
else {
SpellSequence = Combat;
}
switch (SpellSequence) {
case Combat:
//GetAI()->TellMaster("Combat");
if (JUDGEMENT_OF_LIGHT > 0 && CombatCounter < 1 && ai->GetManaPercent() >=15) {
GetAI()->CastSpell (JUDGEMENT_OF_LIGHT, *pTarget);
//GetAI()->TellMaster("Judgement");
CombatCounter++;
break;
}
else if (SEAL_OF_COMMAND > 0 && CombatCounter < 2 && ai->GetManaPercent() >= 25) {
GetAI()->CastSpell (SEAL_OF_COMMAND, *m_bot);
//GetAI()->TellMaster("SealC");
CombatCounter++;
break;
}
else if (HAMMER_OF_JUSTICE > 0 && CombatCounter < 3 && ai->GetManaPercent() >=15) {
GetAI()->CastSpell (HAMMER_OF_JUSTICE, *pTarget);
//GetAI()->TellMaster("Hammer");
CombatCounter++;
break;
}
else if (CRUSADER_STRIKE > 0 && CombatCounter < 4 && ai->GetManaPercent() >=15) {
GetAI()->CastSpell (CRUSADER_STRIKE, *pTarget);
GetAI()->TellMaster("CStrike");
CombatCounter++;
break;
}
else if (CombatCounter < 5) {
CombatCounter = 0;
//GetAI()->TellMaster("CombatCounter Reset");
break;
}
else {
CombatCounter = 0;
//GetAI()->TellMaster("Counter = 0");
break;
}
case Healing:
//GetAI()->TellMaster("Healing");
if (HOLY_LIGHT > 0 && HealCounter < 1 && ai->GetHealthPercent() < 45 && ai->GetManaPercent() >= 20) {
GetAI()->CastSpell (HOLY_LIGHT);
//GetAI()->TellMaster("HLight1");
HealCounter++;
break;
}
else if (HOLY_LIGHT > 0 && HealCounter < 2 && ai->GetHealthPercent() < 75 && ai->GetManaPercent() >= 20) {
GetAI()->CastSpell (HOLY_LIGHT);
//.........这里部分代码省略.........
示例9: DoNextCombatManeuver
void PlayerbotMageAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_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)
ai->SetInFront(pTarget);
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
float dist = m_bot->GetDistance(pTarget);
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 && dist <= ATTACK_DISTANCE && !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 && dist <= ATTACK_DISTANCE && !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;
}
else if (SUMMON_WATER_ELEMENTAL > 0 && LastSpellFrost < 10 && ai->GetManaPercent() >= 16)
{
ai->CastSpell(SUMMON_WATER_ELEMENTAL);
SpellSequence = SPELL_FIRE;
LastSpellFrost = LastSpellFrost + 1;
break;
}
else if (ICE_BLOCK > 0 && LastSpellFrost < 11 && pVictim == m_bot && !m_bot->HasAura(ICE_BLOCK, EFFECT_INDEX_0) && ai->GetHealthPercent() < 30)
{
//.........这里部分代码省略.........
示例10: 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;
//.........这里部分代码省略.........
示例11: DoNextCombatManeuver
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
ai->CastSpell(MOONFIRE);
return;
default:
break;
}
uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_HEAL) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
SpellSequence = DruidHeal;
else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
SpellSequence = DruidCombat;
else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_TANK)
SpellSequence = DruidTank;
else
SpellSequence = DruidSpell;
switch (SpellSequence)
{
case DruidTank: // Its now a tank druid!
//ai->TellMaster("DruidTank");
if (!m_bot->HasInArc(M_PI_F, pTarget))
{
m_bot->SetFacingTo(m_bot->GetAngle(pTarget));
if (pVictim)
pVictim->Attack(pTarget, true);
}
if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
m_bot->RemoveAurasDueToSpell(768);
//ai->TellMaster("FormClearCat");
if (MOONKIN_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
ai->CastSpell (MOONKIN_FORM);
else if (DIRE_BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
ai->CastSpell (DIRE_BEAR_FORM);
else if (BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
ai->CastSpell (BEAR_FORM);
else if (DEMORALIZING_ROAR > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !pTarget->HasAura(DEMORALIZING_ROAR, EFFECT_INDEX_0) && ai->GetRageAmount() >= 10)
ai->CastSpell(DEMORALIZING_ROAR, *pTarget);
if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0))
{
ai->CastSpell(FAERIE_FIRE, *pTarget);
DruidSpellCombat++;
break;
}
else if (MOONFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 2 && !pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 24)
{
ai->CastSpell(MOONFIRE, *pTarget);
DruidSpellCombat++;
break;
}
else if (ROOTS > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 3 && !pTarget->HasAura(ROOTS, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
{
ai->CastSpell(ROOTS, *pTarget);
DruidSpellCombat++;
break;
}
else if (HURRICANE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && ai->GetAttackerCount() >= 5 && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
{
//ai->TellMaster("casting hurricane!");
ai->CastSpell(HURRICANE, *pTarget);
ai->SetIgnoreUpdateTime(10);
DruidSpellCombat++;
break;
}
else if (WRATH > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 5 && ai->GetManaPercent() >= 13)
{
ai->CastSpell(WRATH, *pTarget);
DruidSpellCombat++;
break;
}
else if (INSECT_SWARM > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 6 && !pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9)
{
ai->CastSpell(INSECT_SWARM, *pTarget);
DruidSpellCombat++;
break;
}
else if (STARFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 7 && ai->GetManaPercent() >= 18)
{
ai->CastSpell(STARFIRE, *pTarget);
DruidSpellCombat++;
break;
}
else if (FORCE_OF_NATURE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 8 && ai->GetManaPercent() >= 12)
{
//ai->TellMaster("summoning treants.");
ai->CastSpell(FORCE_OF_NATURE);
DruidSpellCombat++;
//.........这里部分代码省略.........
示例12: 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.");
//.........这里部分代码省略.........
示例13: DoNextCombatManeuver
void PlayerbotWarlockAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
if (SHADOW_BOLT > 0)
ai->CastSpell(SHADOW_BOLT);
return;
}
// ------- Non Duel combat ----------
//ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob
ai->SetInFront( pTarget );
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
Pet *pet = m_bot->GetPet();
// Damage Spells
ai->SetInFront( pTarget );
switch (SpellSequence)
{
case SPELL_CURSES:
if (CURSE_OF_AGONY > 0 && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && LastSpellCurse < 1 && ai->GetManaPercent() >= 14)
{
ai->CastSpell(CURSE_OF_AGONY, *pTarget);
SpellSequence = SPELL_AFFLICTION;
LastSpellCurse = LastSpellCurse +1;
break;
}
else if (CURSE_OF_THE_ELEMENTS > 0 && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_WEAKNESS, EFFECT_INDEX_0) && LastSpellCurse < 2 && ai->GetManaPercent() >= 10)
{
ai->CastSpell(CURSE_OF_THE_ELEMENTS, *pTarget);
SpellSequence = SPELL_AFFLICTION;
LastSpellCurse = LastSpellCurse +1;
break;
}
else if (CURSE_OF_EXHAUSTION > 0 && !pTarget->HasAura(CURSE_OF_EXHAUSTION, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_WEAKNESS, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS, EFFECT_INDEX_0) && LastSpellCurse < 3 && ai->GetManaPercent() >= 6)
{
ai->CastSpell(CURSE_OF_EXHAUSTION, *pTarget);
SpellSequence = SPELL_AFFLICTION;
LastSpellCurse = LastSpellCurse +1;
break;
}
else if (CURSE_OF_WEAKNESS > 0 && !pTarget->HasAura(CURSE_OF_WEAKNESS, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_EXHAUSTION, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS, EFFECT_INDEX_0) && LastSpellCurse < 4 && ai->GetManaPercent() >= 14)
{
ai->CastSpell(CURSE_OF_WEAKNESS, *pTarget);
SpellSequence = SPELL_AFFLICTION;
LastSpellCurse = LastSpellCurse +1;
break;
}
else if (CURSE_OF_TONGUES > 0 && !pTarget->HasAura(CURSE_OF_TONGUES, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_WEAKNESS, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_EXHAUSTION, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS, EFFECT_INDEX_0) && LastSpellCurse < 5 && ai->GetManaPercent() >= 4)
{
ai->CastSpell(CURSE_OF_TONGUES, *pTarget);
SpellSequence = SPELL_AFFLICTION;
LastSpellCurse = LastSpellCurse +1;
break;
}
LastSpellCurse = 0;
//SpellSequence = SPELL_AFFLICTION;
//break;
case SPELL_AFFLICTION:
if (LIFE_TAP > 0 && LastSpellAffliction < 1 && ai->GetManaPercent() <= 50)
{
ai->CastSpell(LIFE_TAP, *m_bot);
SpellSequence = SPELL_DESTRUCTION;
LastSpellAffliction = LastSpellAffliction +1;
break;
}
else if (CORRUPTION > 0 && !pTarget->HasAura(CORRUPTION, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(SEED_OF_CORRUPTION, EFFECT_INDEX_0) && LastSpellAffliction < 2 && ai->GetManaPercent() >= 19)
{
ai->CastSpell(CORRUPTION, *pTarget);
SpellSequence = SPELL_DESTRUCTION;
LastSpellAffliction = LastSpellAffliction +1;
break;
}
else if (DRAIN_SOUL > 0 && pTarget->GetHealth() < pTarget->GetMaxHealth()*0.40 && !pTarget->HasAura(DRAIN_SOUL, EFFECT_INDEX_0) && LastSpellAffliction < 3 && ai->GetManaPercent() >= 19)
{
ai->CastSpell(DRAIN_SOUL, *pTarget);
ai->SetIgnoreUpdateTime(15);
SpellSequence = SPELL_DESTRUCTION;
LastSpellAffliction = LastSpellAffliction +1;
break;
}
else if (DRAIN_LIFE > 0 && LastSpellAffliction < 4 && !pTarget->HasAura(DRAIN_SOUL, EFFECT_INDEX_0) && !pTarget->HasAura(SEED_OF_CORRUPTION, EFFECT_INDEX_0) && !pTarget->HasAura(DRAIN_LIFE, EFFECT_INDEX_0) && !pTarget->HasAura(DRAIN_MANA, EFFECT_INDEX_0) && ai->GetHealthPercent() <= 70 && ai->GetManaPercent() >= 23)
{
ai->CastSpell(DRAIN_LIFE, *pTarget);
ai->SetIgnoreUpdateTime(5);
SpellSequence = SPELL_DESTRUCTION;
LastSpellAffliction = LastSpellAffliction +1;
break;
}
else if (DRAIN_MANA > 0 && pTarget->GetPower(POWER_MANA) > 0 && !pTarget->HasAura(DRAIN_SOUL, EFFECT_INDEX_0) && !pTarget->HasAura(DRAIN_MANA, EFFECT_INDEX_0) && !pTarget->HasAura(SEED_OF_CORRUPTION, EFFECT_INDEX_0) && !pTarget->HasAura(DRAIN_LIFE, EFFECT_INDEX_0) && LastSpellAffliction < 5 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 17)
//.........这里部分代码省略.........
示例14: DoNextCombatManeuver
void PlayerbotDeathKnightAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
ai->CastSpell(PLAGUE_STRIKE);
return;
}
// ------- Non Duel combat ----------
//ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob
// DK Attacks: Unholy, Frost & Blood
// damage spells
ai->SetInFront( pTarget );//<---
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
Pet *pet = m_bot->GetPet();
float dist = m_bot->GetDistance( pTarget );
std::ostringstream out;
switch (SpellSequence)
{
case SPELL_DK_UNHOLY:
if (UNHOLY_PRESENCE > 0)
(!m_bot->HasAura(UNHOLY_PRESENCE, 0) && !m_bot->HasAura(BLOOD_PRESENCE, 0) && !m_bot->HasAura(FROST_PRESENCE, 0) && ai->CastSpell (UNHOLY_PRESENCE, *m_bot));
// check for BONE_SHIELD in combat
if (BONE_SHIELD > 0)
(!m_bot->HasAura(BONE_SHIELD, 0) && !m_bot->HasAura(ARMY_OF_THE_DEAD, 0) && ai->CastSpell (BONE_SHIELD, *m_bot));
if (ARMY_OF_THE_DEAD > 0 && ai->GetAttackerCount()>=5 && LastSpellUnholyDK < 1)
{
ai->CastSpell(ARMY_OF_THE_DEAD);
out << " summoning Army of the Dead!";
if (ARMY_OF_THE_DEAD > 0 && m_bot->HasAura(ARMY_OF_THE_DEAD, 0))
ai->SetIgnoreUpdateTime(7);
SpellSequence = SPELL_DK_FROST;
LastSpellUnholyDK = LastSpellUnholyDK +1;
break;
}
else if (PLAGUE_STRIKE > 0 && !pTarget->HasAura(PLAGUE_STRIKE, 0) && LastSpellUnholyDK < 2)
{
ai->CastSpell(PLAGUE_STRIKE, *pTarget);
out << " Plague Strike";
SpellSequence = SPELL_DK_FROST;
LastSpellUnholyDK = LastSpellUnholyDK +1;
break;
}
else if (DEATH_GRIP > 0 && !pTarget->HasAura(DEATH_GRIP, 0) && LastSpellUnholyDK < 3)
{
ai->CastSpell(DEATH_GRIP, *pTarget);
out << " Death Grip";
SpellSequence = SPELL_DK_FROST;
LastSpellUnholyDK = LastSpellUnholyDK +1;
break;
}
else if (DEATH_COIL > 0 && LastSpellUnholyDK < 4 && ai->GetRunicPower() >= 40)
{
ai->CastSpell(DEATH_COIL, *pTarget);
out << " Death Coil";
SpellSequence = SPELL_DK_FROST;
LastSpellUnholyDK = LastSpellUnholyDK +1;
break;
}
else if (DEATH_STRIKE > 0 && !pTarget->HasAura(DEATH_STRIKE, 0) && LastSpellUnholyDK < 5)
{
ai->CastSpell(DEATH_STRIKE, *pTarget);
out << " Death Strike";
SpellSequence = SPELL_DK_FROST;
LastSpellUnholyDK = LastSpellUnholyDK +1;
break;
}
else if (UNHOLY_BLIGHT > 0 && !pTarget->HasAura(UNHOLY_BLIGHT, 0) && LastSpellUnholyDK < 6)
{
ai->CastSpell(UNHOLY_BLIGHT);
out << " Unholy Blight";
SpellSequence = SPELL_DK_FROST;
LastSpellUnholyDK = LastSpellUnholyDK +1;
break;
}
else if (SCOURGE_STRIKE > 0 && LastSpellUnholyDK < 7)
{
ai->CastSpell(SCOURGE_STRIKE, *pTarget);
out << " Scourge Strike";
SpellSequence = SPELL_DK_FROST;
LastSpellUnholyDK = LastSpellUnholyDK +1;
break;
}
else if (DEATH_AND_DECAY > 0 && ai->GetAttackerCount()>=3 && dist <= ATTACK_DISTANCE && !pTarget->HasAura(DEATH_AND_DECAY, 0) && LastSpellUnholyDK < 8)
{
ai->CastSpell(DEATH_AND_DECAY);
out << " Death and Decay";
ai->SetIgnoreUpdateTime(1);
//.........这里部分代码省略.........
示例15: DoNextCombatManeuver
void PlayerbotWarlockAI::DoNextCombatManeuver(Unit *pTarget)
{
PlayerbotAI* ai = GetAI();
if (!ai)
return;
switch (ai->GetScenarioType())
{
case PlayerbotAI::SCENARIO_DUEL:
{
if (SHADOW_BOLT > 0)
ai->CastSpell(SHADOW_BOLT);
return;
}
default:
break;
}
// ------- Non Duel combat ----------
//ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob
ai->SetInFront(pTarget);
Player *m_bot = GetPlayerBot();
Unit* pVictim = pTarget->getVictim();
Pet *pet = m_bot->GetPet();
// Empower demon
if (pet && DEMONIC_EMPOWERMENT && !m_bot->HasSpellCooldown(DEMONIC_EMPOWERMENT))
ai->CastSpell(DEMONIC_EMPOWERMENT);
// Use voidwalker sacrifice on low health if possible
if (ai->GetHealthPercent() < 50)
if (pet && pet->GetEntry() == DEMON_VOIDWALKER && SACRIFICE && !m_bot->HasAura(SACRIFICE))
ai->CastPetSpell(SACRIFICE);
// Use healthstone
if (ai->GetHealthPercent() < 30)
{
Item* healthStone = ai->FindConsumable(HEALTHSTONE_DISPLAYID);
if (healthStone)
ai->UseItem(healthStone);
}
// Damage Spells
switch (SpellSequence)
{
case SPELL_CURSES:
if (CURSE_OF_AGONY && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(SHADOWFLAME) && LastSpellCurse < 1)
{
ai->CastSpell(CURSE_OF_AGONY, *pTarget);
SpellSequence = SPELL_AFFLICTION;
++LastSpellCurse;
break;
}
else if (CURSE_OF_THE_ELEMENTS && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(CURSE_OF_WEAKNESS) && LastSpellCurse < 2)
{
ai->CastSpell(CURSE_OF_THE_ELEMENTS, *pTarget);
SpellSequence = SPELL_AFFLICTION;
++LastSpellCurse;
break;
}
else if (CURSE_OF_WEAKNESS && !pTarget->HasAura(CURSE_OF_WEAKNESS) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS) && LastSpellCurse < 3)
{
ai->CastSpell(CURSE_OF_WEAKNESS, *pTarget);
SpellSequence = SPELL_AFFLICTION;
++LastSpellCurse;
break;
}
else if (CURSE_OF_TONGUES && !pTarget->HasAura(CURSE_OF_TONGUES) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(CURSE_OF_WEAKNESS) && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS) && LastSpellCurse < 4)
{
ai->CastSpell(CURSE_OF_TONGUES, *pTarget);
SpellSequence = SPELL_AFFLICTION;
++LastSpellCurse;
break;
}
LastSpellCurse = 0;
//SpellSequence = SPELL_AFFLICTION;
//break;
case SPELL_AFFLICTION:
if (LIFE_TAP && LastSpellAffliction < 1 && ai->GetManaPercent() <= 50 && ai->GetHealthPercent() > 50)
{
ai->CastSpell(LIFE_TAP, *m_bot);
SpellSequence = SPELL_DESTRUCTION;
++LastSpellAffliction;
break;
}
else if (CORRUPTION && !pTarget->HasAura(CORRUPTION) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(SEED_OF_CORRUPTION) && LastSpellAffliction < 2)
{
ai->CastSpell(CORRUPTION, *pTarget);
SpellSequence = SPELL_DESTRUCTION;
++LastSpellAffliction;
break;
}
else if (DRAIN_SOUL && pTarget->GetHealth() < pTarget->GetMaxHealth() * 0.40 && !pTarget->HasAura(DRAIN_SOUL) && LastSpellAffliction < 3)
{
ai->CastSpell(DRAIN_SOUL, *pTarget);
//ai->SetIgnoreUpdateTime(15);
SpellSequence = SPELL_DESTRUCTION;
//.........这里部分代码省略.........