From 3e8ad56b07ea78ffc45c7e3783c9a01559b88369 Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Sun, 2 Feb 2025 12:02:19 -0600 Subject: [PATCH] Fix DetermineSpellTargets for group spells (this also wasn't properly checking the rule Character:EnableTGB in master) --- zone/spells.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index ebe0b82ba..feaf38bcd 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2169,21 +2169,22 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce case ST_Group: case ST_GroupNoPets: { - spell_target = this; // Default to self - - bool tgb_enabled = (IsClient() && CastToClient()->TGB()) || - (IsBot() && RuleB(Bots, EnableBotTGB)); + bool tgb_enabled = (IsClient() && RuleB(Character, EnableTGB) && CastToClient()->TGB()) || + (IsBot() && RuleB(Bots, EnableBotTGB)); bool tgb_compatible = IsTGBCompatibleSpell(spell_id); bool item_tgb_allowed = (slot != CastingSlot::Item || RuleB(Spells, AllowItemTGB)); if (tgb_enabled && tgb_compatible && item_tgb_allowed) { - bool valid_target = target && !target->IsCorpse() && - (!target->IsNPC() || - (target->GetOwner() && target->GetOwner()->IsOfClientBot())); + bool valid_target = spell_target && + !spell_target->IsCorpse() && + (!spell_target->IsNPC() || + (spell_target->GetOwner() && spell_target->IsPetOwnerOfClientBot())); - if (valid_target) { - spell_target = target; + if (!valid_target) { + spell_target = this; } + } else { + spell_target = this; } if (spell_target && spell_target->IsPet() && spells[spell_id].target_type == ST_GroupNoPets) {