fix(Scripts/Spells): Druid ability Starfall now will no longer try to hit outside line of sight targets (#22422)
Co-authored-by: Tereneckla <Tereneckla@pm.me>
This commit is contained in:
parent
f334a38c5e
commit
110fd070f2
1 changed files with 15 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue