aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp38
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();