diff --git a/zone/bot.cpp b/zone/bot.cpp index edb4a3ece..0d6ed5538 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -6216,16 +6216,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQ::spe } if (!noGroupSpell) { - std::vector v; - - if (RuleB(Bots, RaidBuffing)) { - v = GetSpellTargetList(); - } - else { - v = GatherSpellTargets(false, spellTarget); - } - - for (Mob* m : v) { + for (Mob* m : GetBuffTargets(spellTarget)) { if (IsEffectInSpell(thespell, SE_AbsorbMagicAtt) || IsEffectInSpell(thespell, SE_Rune)) { for (int i = 0; i < m->GetMaxTotalSlots(); i++) { uint32 buff_count = m->GetMaxTotalSlots(); @@ -6252,7 +6243,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQ::spe SpellOnTarget(thespell, m->GetPet()); } - SetMana(GetMana() - (GetActSpellCost(thespell, spells[thespell].mana) * (v.size() - 1))); + SetMana(GetMana() - (GetActSpellCost(thespell, spells[thespell].mana) * (GetBuffTargets(spellTarget).size() - 1))); } } @@ -6282,16 +6273,7 @@ bool Bot::DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, EQ::spel } if (spellTarget->IsOfClientBotMerc()) { - std::vector v; - - if (RuleB(Bots, RaidBuffing)) { - v = GetSpellTargetList(); - } - else { - v = GatherSpellTargets(false, spellTarget); - } - - for (Mob* m : v) { + for (Mob* m : GetBuffTargets(spellTarget)) { if (m == this && spellTarget != this) { continue; } @@ -10048,17 +10030,9 @@ bool Bot::IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spell_id) { return true; } - std::vector v; uint16 target_id = tar->GetID(); - if (RuleB(Bots, CrossRaidBuffingAndHealing)) { - v = GetSpellTargetList(); - } - else { - v = GetGroupSpellTargetList(); - } - - for (Mob* m : v) { + for (Mob* m : GetSpellTargetList()) { if ( m->IsBot() && m->IsCasting() && @@ -12381,3 +12355,11 @@ void Bot::AssignBotSpellsToTypes(std::vector& AIBot_spells, st AIBot_spells_by_type[spell.type].emplace_back(spell_with_index); } } + +std::vector Bot::GetBuffTargets(Mob* spellTarget) { + if (RuleB(Bots, RaidBuffing)) { + return GetSpellTargetList(); + } + + return GatherSpellTargets(false, spellTarget); +} diff --git a/zone/bot.h b/zone/bot.h index c6f43201d..ec9b764e8 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -517,6 +517,7 @@ public: void SetSpellTargetList(std::vector spell_target_list) { _spellTargetList = spell_target_list; } std::vector GetGroupSpellTargetList() { return _groupSpellTargetList; } void SetGroupSpellTargetList(std::vector spell_target_list) { _groupSpellTargetList = spell_target_list; } + std::vector GetBuffTargets(Mob* spellTarget); Raid* GetStoredRaid() { return _storedRaid; } void SetStoredRaid(Raid* stored_raid) { _storedRaid = stored_raid; } bool GetVerifiedRaid() { return _verifiedRaid; }