Add GetBuffTargets helper

This commit is contained in:
nytmyr
2025-01-24 12:23:46 -06:00
parent 8b863f4402
commit cec1dbda94
2 changed files with 13 additions and 30 deletions
+12 -30
View File
@@ -6216,16 +6216,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQ::spe
}
if (!noGroupSpell) {
std::vector<Mob*> 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<Mob*> 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<Mob*> 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<BotSpells_Struct>& AIBot_spells, st
AIBot_spells_by_type[spell.type].emplace_back(spell_with_index);
}
}
std::vector<Mob*> Bot::GetBuffTargets(Mob* spellTarget) {
if (RuleB(Bots, RaidBuffing)) {
return GetSpellTargetList();
}
return GatherSpellTargets(false, spellTarget);
}
+1
View File
@@ -517,6 +517,7 @@ public:
void SetSpellTargetList(std::vector<Mob*> spell_target_list) { _spellTargetList = spell_target_list; }
std::vector<Mob*> GetGroupSpellTargetList() { return _groupSpellTargetList; }
void SetGroupSpellTargetList(std::vector<Mob*> spell_target_list) { _groupSpellTargetList = spell_target_list; }
std::vector<Mob*> GetBuffTargets(Mob* spellTarget);
Raid* GetStoredRaid() { return _storedRaid; }
void SetStoredRaid(Raid* stored_raid) { _storedRaid = stored_raid; }
bool GetVerifiedRaid() { return _verifiedRaid; }