mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
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
|
||||
*/
|
||||
|
||||
class spell_dream_fog_sleep : public SpellScriptLoader
|
||||
class spell_dream_fog_sleep : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_dream_fog_sleep() : SpellScriptLoader("spell_dream_fog_sleep") { }
|
||||
PrepareSpellScript(spell_dream_fog_sleep);
|
||||
|
||||
class spell_dream_fog_sleep_SpellScript : public SpellScript
|
||||
void HandleEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
PrepareSpellScript(spell_dream_fog_sleep_SpellScript);
|
||||
|
||||
void HandleEffect(SpellEffIndex /*effIndex*/)
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
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);
|
||||
}
|
||||
};
|
||||
class spell_mark_of_nature : public SpellScriptLoader
|
||||
class spell_mark_of_nature : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_mark_of_nature() : SpellScriptLoader("spell_mark_of_nature") { }
|
||||
PrepareSpellScript(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
|
||||
{
|
||||
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
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
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();
|
||||
|
||||
// dragon spellscripts
|
||||
new spell_dream_fog_sleep();
|
||||
new spell_mark_of_nature();
|
||||
RegisterSpellScript(spell_dream_fog_sleep);
|
||||
RegisterSpellScript(spell_mark_of_nature);
|
||||
RegisterSpellScript(spell_shadow_bolt_whirl);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user