summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index ededde81eb..c388af6344 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<WorldObject*>& 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);
}