diff --git a/src/game/PlayerBots/PartyBotAI.cpp b/src/game/PlayerBots/PartyBotAI.cpp index 7ad920ce6fb..a07b86a1cf9 100644 --- a/src/game/PlayerBots/PartyBotAI.cpp +++ b/src/game/PlayerBots/PartyBotAI.cpp @@ -98,7 +98,7 @@ void PartyBotAI::CloneFromPlayer(Player const* pPlayer) { me->SatisfyItemRequirements(pItem->GetProto()); me->StoreNewItemInBestSlots(pItem->GetEntry(), 1, pItem->GetEnchantmentId(EnchantmentSlot(0))); - } + } } } @@ -137,7 +137,7 @@ bool PartyBotAI::IsValidDistancingTarget(Unit* pTarget, Unit* pEnemy) pTarget->GetDistance(pEnemy) >= 15.0f) return true; } - + return false; } @@ -299,7 +299,7 @@ bool PartyBotAI::CanTryToCastSpell(Unit const* pTarget, SpellEntry const* pSpell { float const myThreat = pEnemy->GetThreatManager().getThreat(me); float const victimThreat = pEnemy->GetThreatManager().getThreat(pEnemy->GetVictim()); - + if (victimThreat < (myThreat + me->GetMaxHealth())) return false; } @@ -543,7 +543,7 @@ void PartyBotAI::AddToPlayerGroup() me->RemoveFromGroup(); group->AddMember(me->GetObjectGuid(), me->GetName()); - } + } } void PartyBotAI::OnPacketReceived(WorldPacket const* packet) @@ -678,7 +678,7 @@ void PartyBotAI::UpdateAI(uint32 const diff) m_receivedBgInvite = false; return; } - + // Remain idle until we can join battleground. return; } @@ -720,7 +720,7 @@ void PartyBotAI::UpdateAI(uint32 const diff) me->CastSpell(me, PB_SPELL_HONORLESS_TARGET, true); } } - + return; } @@ -842,7 +842,7 @@ void PartyBotAI::UpdateAI(uint32 const diff) me->SetCheatOption(PLAYER_CHEAT_NO_CAST_TIME, true); me->CastSpell(me, (*auraList.begin())->GetId(), true); me->SetCheatOption(PLAYER_CHEAT_NO_CAST_TIME, oldState); - } + } } } else if (me->IsMounted()) @@ -1024,7 +1024,7 @@ void PartyBotAI::UpdateOutOfCombatAI_Paladin() me->ClearTarget(); return; } - } + } } } @@ -1227,7 +1227,7 @@ void PartyBotAI::UpdateInCombatAI_Paladin() if (DoCastSpell(me, m_spells.paladin.pBlessingOfFreedom) == SPELL_CAST_OK) return; } - + if (GetRole() != ROLE_HEALER && me->GetHealthPercent() < 30.0f) HealInjuredTarget(me); @@ -1563,13 +1563,16 @@ void PartyBotAI::UpdateOutOfCombatAI_Mage() { if (m_spells.mage.pArcaneBrilliance) { - if (CanTryToCastSpell(me, m_spells.mage.pArcaneBrilliance)) + if (Player* pTarget = SelectBuffTarget(m_spells.mage.pArcaneBrilliance)) { - if (DoCastSpell(me, m_spells.mage.pArcaneBrilliance) == SPELL_CAST_OK) + if (CanTryToCastSpell(pTarget, m_spells.mage.pArcaneBrilliance)) { - m_isBuffing = true; - me->ClearTarget(); - return; + if (DoCastSpell(pTarget, m_spells.mage.pArcaneBrilliance) == SPELL_CAST_OK) + { + m_isBuffing = true; + me->ClearTarget(); + return; + } } } } @@ -1782,7 +1785,7 @@ void PartyBotAI::UpdateInCombatAI_Mage() { if (DoCastSpell(me, m_spells.mage.pPresenceOfMind) == SPELL_CAST_OK) return; - } + } if (m_spells.mage.pScorch && (pVictim->GetHealthPercent() < 20.0f) && @@ -2790,7 +2793,7 @@ void PartyBotAI::UpdateInCombatAI_Rogue() if (m_spells.rogue.pRupture) vSpells.push_back(m_spells.rogue.pRupture); } - + if (!vSpells.empty()) { SpellEntry const* pComboSpell = SelectRandomContainerElement(vSpells); @@ -3039,7 +3042,7 @@ void PartyBotAI::UpdateInCombatAI_Druid() if (DoCastSpell(me, m_spells.druid.pBarkskin) == SPELL_CAST_OK) return; } - + if (form == FORM_NONE) { if (m_spells.druid.pHibernate && @@ -3112,7 +3115,7 @@ void PartyBotAI::UpdateInCombatAI_Druid() Unit* pVictim = me->GetVictim(); if (!pVictim) return; - + if (form != FORM_NONE && me->HasUnitState(UNIT_STATE_ROOT) && me->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT) && @@ -3121,7 +3124,7 @@ void PartyBotAI::UpdateInCombatAI_Druid() if (GetRole() == ROLE_HEALER) return; - + switch (form) { case FORM_CAT: @@ -3224,7 +3227,7 @@ void PartyBotAI::UpdateInCombatAI_Druid() if (DoCastSpell(pVictim, m_spells.druid.pClaw) == SPELL_CAST_OK) return; } - + break; } case FORM_BEAR: @@ -3369,4 +3372,4 @@ void PartyBotAI::UpdateInCombatAI_Druid() break; } } -} \ No newline at end of file +}