diff options
| author | Gildor <gildor55@gmail.com> | 2021-02-06 19:17:54 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-06 19:17:54 +0100 | 
| commit | 770a4499df02aa0daf08decc510e12c75d4dcf25 (patch) | |
| tree | 18ce48e4208e09457fe423fea3a8dbbc0bbe24bc /src/server/scripts/Spells | |
| parent | b84b92506354fc37017cb687aac263218265cf06 (diff) | |
Core/Spells: Fix Seed of Corruption (Warlock) target selection (#26019)
* Core/Spells: Fix Seed of Corruption (Warlock) target selection
* unneeded things
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 38 | 
1 files changed, 17 insertions, 21 deletions
| diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index f4d1f25003c..9f74999e9ef 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -1147,31 +1147,27 @@ class spell_warl_seduction : public SpellScriptLoader  };  // -27285 - Seed of Corruption -class spell_warl_seed_of_corruption : public SpellScriptLoader +class spell_warl_seed_of_corruption : public SpellScript  { -    public: -        spell_warl_seed_of_corruption() : SpellScriptLoader("spell_warl_seed_of_corruption") { } +    PrepareSpellScript(spell_warl_seed_of_corruption); -        class spell_warl_seed_of_corruption_SpellScript : public SpellScript +    void FilterTargets(std::list<WorldObject*>& targets) +    { +        targets.remove_if([&](WorldObject const* target)          { -            PrepareSpellScript(spell_warl_seed_of_corruption_SpellScript); - -            void FilterTargets(std::list<WorldObject*>& targets) -            { -                if (GetExplTargetUnit()) -                    targets.remove(GetExplTargetUnit()); -            } +            if (Unit const* unitTarget = target->ToUnit()) +                if (WorldLocation const* dest = GetExplTargetDest()) +                    if (!unitTarget->IsWithinLOS(dest->GetPositionX(), dest->GetPositionY(), dest->GetPositionZ())) +                        return true; -            void Register() override -            { -                OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); -            } -        }; +            return false; +        }); +    } -        SpellScript* GetSpellScript() const override -        { -            return new spell_warl_seed_of_corruption_SpellScript(); -        } +    void Register() override +    { +        OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warl_seed_of_corruption::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); +    }  };  // -27243 - Seed of Corruption @@ -1595,7 +1591,7 @@ void AddSC_warlock_spell_scripts()      new spell_warl_nether_protection();      new spell_warl_ritual_of_doom_effect();      new spell_warl_seduction(); -    new spell_warl_seed_of_corruption(); +    RegisterSpellScript(spell_warl_seed_of_corruption);      new spell_warl_seed_of_corruption_dummy();      new spell_warl_seed_of_corruption_generic();      new spell_warl_shadow_ward(); | 
