From 110fd070f2f6fe5926b7330c5f33b89e59f2c69c Mon Sep 17 00:00:00 2001 From: ekekekkekkek <96571151+eusss@users.noreply.github.com> Date: Thu, 11 Sep 2025 15:46:34 +0200 Subject: [PATCH] fix(Scripts/Spells): Druid ability Starfall now will no longer try to hit outside line of sight targets (#22422) Co-authored-by: Tereneckla --- src/server/scripts/Spells/spell_druid.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index ededde81e..c388af634 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -923,6 +923,21 @@ class spell_dru_starfall_dummy : public SpellScript void FilterTargets(std::list& targets) { + // Get caster object + Unit* caster = GetCaster(); + + // Remove targets if they are outside line of sight with respect to caster + targets.remove_if([caster](WorldObject const* target) + { + if (target) + { + if (!caster->IsWithinLOS(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ())) + return true; + } + return false; + }); + + // Take 2 random targets from remaining within line of sight targets Acore::Containers::RandomResize(targets, 2); }