From 7943bfb4839b294f06b76a560caa556e4e5bf181 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 2 Apr 2022 18:59:47 +0200 Subject: [PATCH] Core/Spells: Blood and Thunder will now only trigger with Rend effects applied by the caster *optimized the checks while at it --- src/server/scripts/Spells/spell_warrior.cpp | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 6b8bacb783d..947e48e5d30 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -856,18 +856,21 @@ class spell_warr_thunder_clap : public SpellScript bool Load() override { _allowRendSpread = false; - if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_WARRIOR, WARRIOR_ICON_ID_BLOOD_AND_THUNDER, EFFECT_0)) - return roll_chance_i(aurEff->GetAmount()); - - return false; } - void FilterTargets(std::list& unitList) + void FilterTargets(std::list& targets) { - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if (Unit* target = (*itr)->ToUnit()) - if (target->HasAura(SPELL_WARRIOR_REND)) - _allowRendSpread = true; + AuraEffect const* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_WARRIOR, WARRIOR_ICON_ID_BLOOD_AND_THUNDER, EFFECT_0); + if (!aurEff || !roll_chance_i(aurEff->GetAmount())) + return; + + for (WorldObject const* target : targets) + { + if (!target->IsUnit() || !target->ToUnit()->HasAura(SPELL_WARRIOR_REND, GetCaster()->GetGUID())) + continue; + + _allowRendSpread = true; + } } void HandleHit(SpellEffIndex /*effIndex*/) @@ -881,7 +884,6 @@ class spell_warr_thunder_clap : public SpellScript OnObjectAreaTargetSelect.Register(&spell_warr_thunder_clap::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget.Register(&spell_warr_thunder_clap::HandleHit, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } - private: bool _allowRendSpread; };