mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 13:46:24 +00:00
refactor(Scripts/Northrend): spell scripts use registry macros (#20401)
This commit is contained in:
@@ -254,39 +254,28 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
class spell_loken_pulsing_shockwave : public SpellScriptLoader
|
||||
class spell_loken_pulsing_shockwave : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_loken_pulsing_shockwave() : SpellScriptLoader("spell_loken_pulsing_shockwave") { }
|
||||
PrepareSpellScript(spell_loken_pulsing_shockwave);
|
||||
|
||||
class spell_loken_pulsing_shockwave_SpellScript : public SpellScript
|
||||
void CalculateDamage(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
PrepareSpellScript(spell_loken_pulsing_shockwave_SpellScript);
|
||||
if (!GetHitUnit())
|
||||
return;
|
||||
|
||||
void CalculateDamage(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (!GetHitUnit())
|
||||
return;
|
||||
float distance = GetCaster()->GetDistance2d(GetHitUnit());
|
||||
if (distance > 1.0f)
|
||||
SetHitDamage(int32(GetHitDamage() * distance));
|
||||
}
|
||||
|
||||
float distance = GetCaster()->GetDistance2d(GetHitUnit());
|
||||
if (distance > 1.0f)
|
||||
SetHitDamage(int32(GetHitDamage() * distance));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_loken_pulsing_shockwave_SpellScript::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void Register() override
|
||||
{
|
||||
return new spell_loken_pulsing_shockwave_SpellScript();
|
||||
OnEffectHitTarget += SpellEffectFn(spell_loken_pulsing_shockwave::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_loken()
|
||||
{
|
||||
new boss_loken();
|
||||
new spell_loken_pulsing_shockwave();
|
||||
RegisterSpellScript(spell_loken_pulsing_shockwave);
|
||||
}
|
||||
|
||||
@@ -180,74 +180,57 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
class spell_krystallus_shatter : public SpellScriptLoader
|
||||
class spell_krystallus_shatter : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_krystallus_shatter() : SpellScriptLoader("spell_krystallus_shatter") { }
|
||||
PrepareSpellScript(spell_krystallus_shatter);
|
||||
|
||||
class spell_krystallus_shatter_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareSpellScript(spell_krystallus_shatter_SpellScript);
|
||||
return ValidateSpellInfo({ SPELL_SHATTER_EFFECT });
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
target->RemoveAurasDueToSpell(GROUND_SLAM_STONED_EFFECT);
|
||||
target->CastSpell((Unit*)nullptr, SPELL_SHATTER_EFFECT, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_krystallus_shatter_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
return new spell_krystallus_shatter_SpellScript();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
target->RemoveAurasDueToSpell(GROUND_SLAM_STONED_EFFECT);
|
||||
target->CastSpell((Unit*)nullptr, SPELL_SHATTER_EFFECT, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_krystallus_shatter::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_krystallus_shatter_effect : public SpellScriptLoader
|
||||
class spell_krystallus_shatter_effect : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_krystallus_shatter_effect() : SpellScriptLoader("spell_krystallus_shatter_effect") { }
|
||||
PrepareSpellScript(spell_krystallus_shatter_effect);
|
||||
|
||||
class spell_krystallus_shatter_effect_SpellScript : public SpellScript
|
||||
void CalculateDamage()
|
||||
{
|
||||
PrepareSpellScript(spell_krystallus_shatter_effect_SpellScript);
|
||||
if (!GetHitUnit())
|
||||
return;
|
||||
|
||||
void CalculateDamage()
|
||||
{
|
||||
if (!GetHitUnit())
|
||||
return;
|
||||
float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster());
|
||||
if (!radius)
|
||||
return;
|
||||
|
||||
float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster());
|
||||
if (!radius)
|
||||
return;
|
||||
float distance = GetCaster()->GetDistance2d(GetHitUnit());
|
||||
if (distance > 1.0f)
|
||||
SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius)));
|
||||
}
|
||||
|
||||
float distance = GetCaster()->GetDistance2d(GetHitUnit());
|
||||
if (distance > 1.0f)
|
||||
SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius)));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnHit += SpellHitFn(spell_krystallus_shatter_effect_SpellScript::CalculateDamage);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void Register() override
|
||||
{
|
||||
return new spell_krystallus_shatter_effect_SpellScript();
|
||||
OnHit += SpellHitFn(spell_krystallus_shatter_effect::CalculateDamage);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_krystallus()
|
||||
{
|
||||
new boss_krystallus();
|
||||
new spell_krystallus_shatter();
|
||||
new spell_krystallus_shatter_effect();
|
||||
RegisterSpellScript(spell_krystallus_shatter);
|
||||
RegisterSpellScript(spell_krystallus_shatter_effect);
|
||||
}
|
||||
|
||||
@@ -864,30 +864,24 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
class spell_hos_dark_matter : public SpellScriptLoader
|
||||
class spell_hos_dark_matter_aura : public AuraScript
|
||||
{
|
||||
public:
|
||||
spell_hos_dark_matter() : SpellScriptLoader("spell_hos_dark_matter") { }
|
||||
PrepareAuraScript(spell_hos_dark_matter_aura);
|
||||
|
||||
class spell_hos_dark_matter_AuraScript : public AuraScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareAuraScript(spell_hos_dark_matter_AuraScript);
|
||||
return ValidateSpellInfo({ SPELL_DARK_MATTER_H, SPELL_DARK_MATTER });
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(caster, caster->GetMap()->IsHeroic() ? SPELL_DARK_MATTER_H : SPELL_DARK_MATTER, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_hos_dark_matter_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
return new spell_hos_dark_matter_AuraScript();
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(caster, caster->GetMap()->IsHeroic() ? SPELL_DARK_MATTER_H : SPELL_DARK_MATTER, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_hos_dark_matter_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -897,5 +891,5 @@ void AddSC_brann_bronzebeard()
|
||||
new dark_rune_protectors();
|
||||
new dark_rune_stormcaller();
|
||||
new iron_golem_custodian();
|
||||
new spell_hos_dark_matter();
|
||||
RegisterSpellScript(spell_hos_dark_matter_aura);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user