refactor(Scripts/World): Spell Scripts registry macros (#19224)
* boss_emerald_dragons spell:spell_dream_fog_sleep * boss_emerald_dragons spell:spell_mark_of_nature
This commit is contained in:
@@ -736,41 +736,30 @@ public:
|
|||||||
* --- Spell: Dream Fog
|
* --- Spell: Dream Fog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class spell_dream_fog_sleep : public SpellScriptLoader
|
class spell_dream_fog_sleep : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_dream_fog_sleep);
|
||||||
spell_dream_fog_sleep() : SpellScriptLoader("spell_dream_fog_sleep") { }
|
|
||||||
|
|
||||||
class spell_dream_fog_sleep_SpellScript : public SpellScript
|
void HandleEffect(SpellEffIndex /*effIndex*/)
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_dream_fog_sleep_SpellScript);
|
if (Unit* caster = GetCaster())
|
||||||
|
|
||||||
void HandleEffect(SpellEffIndex /*effIndex*/)
|
|
||||||
{
|
{
|
||||||
if (Unit* caster = GetCaster())
|
if (Unit* target = GetHitUnit())
|
||||||
{
|
{
|
||||||
if (Unit* target = GetHitUnit())
|
caster->GetAI()->SetGUID(target->GetGUID(), GUID_FOG_TARGET);
|
||||||
{
|
|
||||||
caster->GetAI()->SetGUID(target->GetGUID(), GUID_FOG_TARGET);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FilterTargets(std::list<WorldObject*>& targets)
|
void FilterTargets(std::list<WorldObject*>& targets)
|
||||||
{
|
|
||||||
targets.remove_if(Acore::UnitAuraCheck(true, SPELL_SLEEP));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
OnEffectHitTarget += SpellEffectFn(spell_dream_fog_sleep_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
|
||||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dream_fog_sleep_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_dream_fog_sleep_SpellScript();
|
targets.remove_if(Acore::UnitAuraCheck(true, SPELL_SLEEP));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_dream_fog_sleep::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
||||||
|
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dream_fog_sleep::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -827,41 +816,30 @@ class spell_shadow_bolt_whirl : public AuraScript
|
|||||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadow_bolt_whirl::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadow_bolt_whirl::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
class spell_mark_of_nature : public SpellScriptLoader
|
class spell_mark_of_nature : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_mark_of_nature);
|
||||||
spell_mark_of_nature() : SpellScriptLoader("spell_mark_of_nature") { }
|
|
||||||
|
|
||||||
class spell_mark_of_nature_SpellScript : public SpellScript
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_mark_of_nature_SpellScript);
|
return ValidateSpellInfo({ SPELL_MARK_OF_NATURE, SPELL_AURA_OF_NATURE });
|
||||||
|
}
|
||||||
|
|
||||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
void FilterTargets(std::list<WorldObject*>& targets)
|
||||||
{
|
|
||||||
return ValidateSpellInfo({ SPELL_MARK_OF_NATURE, SPELL_AURA_OF_NATURE });
|
|
||||||
}
|
|
||||||
|
|
||||||
void FilterTargets(std::list<WorldObject*>& targets)
|
|
||||||
{
|
|
||||||
targets.remove_if(MarkOfNatureTargetSelector());
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleEffect(SpellEffIndex effIndex)
|
|
||||||
{
|
|
||||||
PreventHitDefaultEffect(effIndex);
|
|
||||||
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_AURA_OF_NATURE, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_nature_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
|
||||||
OnEffectHitTarget += SpellEffectFn(spell_mark_of_nature_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_mark_of_nature_SpellScript();
|
targets.remove_if(MarkOfNatureTargetSelector());
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleEffect(SpellEffIndex effIndex)
|
||||||
|
{
|
||||||
|
PreventHitDefaultEffect(effIndex);
|
||||||
|
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_AURA_OF_NATURE, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_nature::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_mark_of_nature::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -878,8 +856,8 @@ void AddSC_emerald_dragons()
|
|||||||
new boss_lethon();
|
new boss_lethon();
|
||||||
|
|
||||||
// dragon spellscripts
|
// dragon spellscripts
|
||||||
new spell_dream_fog_sleep();
|
RegisterSpellScript(spell_dream_fog_sleep);
|
||||||
new spell_mark_of_nature();
|
RegisterSpellScript(spell_mark_of_nature);
|
||||||
RegisterSpellScript(spell_shadow_bolt_whirl);
|
RegisterSpellScript(spell_shadow_bolt_whirl);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user