refactor(Scripts/Naxxramas): Spell Scripts use registry macros (#19034)

* ktz frost blast

* ktz detonate mana

* thaddius pos_neg_charge

* thaddius polarity shift

* sapph frost explosion

* grobbulus poison

* grobbulus mutating injection

* gothik shadow bolt volley

* gluth decimate

* horsemen mark

* add sql

* trigger ci

* Revert "trigger ci"

This reverts commit d8b18d5c5c37d12da1deab0be50941bfe96641a6.

* add validate horsemen mark

* add validate gluth decimate

* add validate gothik shadow mark

* add validate ktz frost blast

* add validate thaddius pos_neg_charge
This commit is contained in:
Jelle Meeus
2024-06-09 13:39:16 +02:00
committed by GitHub
parent d77b3ac110
commit 415f52d662
8 changed files with 241 additions and 321 deletions
@@ -0,0 +1,4 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_four_horsemen_mark_aura' WHERE `spell_id` IN (28832, 28833, 28834, 28835);
UPDATE `spell_script_names` SET `ScriptName`='spell_grobbulus_mutating_injection_aura' WHERE `spell_id`=28169;
UPDATE `spell_script_names` SET `ScriptName`='spell_kelthuzad_detonate_mana_aura' WHERE `spell_id`=27819;
@@ -380,14 +380,14 @@ public:
}; };
}; };
class spell_four_horsemen_mark : public SpellScriptLoader class spell_four_horsemen_mark_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_four_horsemen_mark_aura);
spell_four_horsemen_mark() : SpellScriptLoader("spell_four_horsemen_mark") { }
class spell_four_horsemen_mark_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_four_horsemen_mark_AuraScript); return ValidateSpellInfo({ SPELL_MARK_DAMAGE });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
@@ -427,19 +427,13 @@ public:
void Register() override void Register() override
{ {
AfterEffectApply += AuraEffectApplyFn(spell_four_horsemen_mark_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); AfterEffectApply += AuraEffectApplyFn(spell_four_horsemen_mark_aura::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_four_horsemen_mark_AuraScript();
} }
}; };
void AddSC_boss_four_horsemen() void AddSC_boss_four_horsemen()
{ {
new boss_four_horsemen(); new boss_four_horsemen();
new spell_four_horsemen_mark(); RegisterSpellScript(spell_four_horsemen_mark_aura);
} }
@@ -29,6 +29,7 @@ enum Spells
SPELL_ENRAGE_25 = 54427, SPELL_ENRAGE_25 = 54427,
SPELL_DECIMATE_10 = 28374, SPELL_DECIMATE_10 = 28374,
SPELL_DECIMATE_25 = 54426, SPELL_DECIMATE_25 = 54426,
SPELL_DECIMATE_DAMAGE = 28375,
SPELL_BERSERK = 26662, SPELL_BERSERK = 26662,
SPELL_INFECTED_WOUND = 29306, SPELL_INFECTED_WOUND = 29306,
SPELL_CHOW_SEARCHER = 28404 SPELL_CHOW_SEARCHER = 28404
@@ -237,14 +238,14 @@ public:
}; };
}; };
class spell_gluth_decimate : public SpellScriptLoader class spell_gluth_decimate : public SpellScript
{ {
public: PrepareSpellScript(spell_gluth_decimate);
spell_gluth_decimate() : SpellScriptLoader("spell_gluth_decimate") { }
class spell_gluth_decimate_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_gluth_decimate_SpellScript); return ValidateSpellInfo({ SPELL_DECIMATE_DAMAGE });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/) void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{ {
@@ -262,25 +263,19 @@ public:
Unit::DealDamage(GetCaster(), cTarget, damage); Unit::DealDamage(GetCaster(), cTarget, damage);
return; return;
} }
GetCaster()->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget); GetCaster()->CastCustomSpell(SPELL_DECIMATE_DAMAGE, SPELLVALUE_BASE_POINT0, damage, unitTarget);
} }
} }
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_gluth_decimate_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); OnEffectHitTarget += SpellEffectFn(spell_gluth_decimate::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_gluth_decimate_SpellScript();
} }
}; };
void AddSC_boss_gluth() void AddSC_boss_gluth()
{ {
new boss_gluth(); new boss_gluth();
new spell_gluth_decimate(); RegisterSpellScript(spell_gluth_decimate);
} }
@@ -688,14 +688,14 @@ public:
}; };
}; };
class spell_gothik_shadow_bolt_volley : public SpellScriptLoader class spell_gothik_shadow_bolt_volley : public SpellScript
{ {
public: PrepareSpellScript(spell_gothik_shadow_bolt_volley);
spell_gothik_shadow_bolt_volley() : SpellScriptLoader("spell_gothik_shadow_bolt_volley") { }
class spell_gothik_shadow_bolt_volley_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_gothik_shadow_bolt_volley_SpellScript); return ValidateSpellInfo({ SPELL_SHADOW_MARK });
}
void FilterTargets(std::list<WorldObject*>& targets) void FilterTargets(std::list<WorldObject*>& targets)
{ {
@@ -704,13 +704,7 @@ public:
void Register() override void Register() override
{ {
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gothik_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gothik_shadow_bolt_volley::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_gothik_shadow_bolt_volley_SpellScript();
} }
}; };
@@ -718,6 +712,6 @@ void AddSC_boss_gothik()
{ {
new boss_gothik(); new boss_gothik();
new npc_boss_gothik_minion(); new npc_boss_gothik_minion();
new spell_gothik_shadow_bolt_volley(); RegisterSpellScript(spell_gothik_shadow_bolt_volley);
} }
@@ -240,14 +240,9 @@ public:
}; };
}; };
class spell_grobbulus_poison : public SpellScriptLoader class spell_grobbulus_poison : public SpellScript
{ {
public: PrepareSpellScript(spell_grobbulus_poison);
spell_grobbulus_poison() : SpellScriptLoader("spell_grobbulus_poison") { }
class spell_grobbulus_poison_SpellScript : public SpellScript
{
PrepareSpellScript(spell_grobbulus_poison_SpellScript);
void FilterTargets(std::list<WorldObject*>& targets) void FilterTargets(std::list<WorldObject*>& targets)
{ {
@@ -268,24 +263,13 @@ public:
void Register() override void Register() override
{ {
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_grobbulus_poison_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_grobbulus_poison::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
} }
}; };
SpellScript* GetSpellScript() const override class spell_grobbulus_mutating_injection_aura : public AuraScript
{ {
return new spell_grobbulus_poison_SpellScript(); PrepareAuraScript(spell_grobbulus_mutating_injection_aura);
}
};
class spell_grobbulus_mutating_injection : public SpellScriptLoader
{
public:
spell_grobbulus_mutating_injection() : SpellScriptLoader("spell_grobbulus_mutating_injection") { }
class spell_grobbulus_mutating_injection_AuraScript : public AuraScript
{
PrepareAuraScript(spell_grobbulus_mutating_injection_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
@@ -310,13 +294,7 @@ class spell_grobbulus_mutating_injection : public SpellScriptLoader
void Register() override void Register() override
{ {
AfterEffectRemove += AuraEffectRemoveFn(spell_grobbulus_mutating_injection_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); AfterEffectRemove += AuraEffectRemoveFn(spell_grobbulus_mutating_injection_aura::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_grobbulus_mutating_injection_AuraScript();
} }
}; };
@@ -324,7 +302,7 @@ void AddSC_boss_grobbulus()
{ {
new boss_grobbulus(); new boss_grobbulus();
new boss_grobbulus_poison_cloud(); new boss_grobbulus_poison_cloud();
new spell_grobbulus_mutating_injection(); RegisterSpellScript(spell_grobbulus_mutating_injection_aura);
new spell_grobbulus_poison(); RegisterSpellScript(spell_grobbulus_poison);
} }
@@ -665,14 +665,14 @@ public:
}; };
}; };
class spell_kelthuzad_frost_blast : public SpellScriptLoader class spell_kelthuzad_frost_blast : public SpellScript
{ {
public: PrepareSpellScript(spell_kelthuzad_frost_blast);
spell_kelthuzad_frost_blast() : SpellScriptLoader("spell_kelthuzad_frost_blast") { }
class spell_kelthuzad_frost_blast_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spell*/) override
{ {
PrepareSpellScript(spell_kelthuzad_frost_blast_SpellScript); return ValidateSpellInfo({ SPELL_FROST_BLAST });
}
void FilterTargets(std::list<WorldObject*>& targets) void FilterTargets(std::list<WorldObject*>& targets)
{ {
@@ -697,24 +697,13 @@ public:
void Register() override void Register() override
{ {
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kelthuzad_frost_blast_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kelthuzad_frost_blast::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
} }
}; };
SpellScript* GetSpellScript() const override class spell_kelthuzad_detonate_mana_aura : public AuraScript
{ {
return new spell_kelthuzad_frost_blast_SpellScript(); PrepareAuraScript(spell_kelthuzad_detonate_mana_aura);
}
};
class spell_kelthuzad_detonate_mana : public SpellScriptLoader
{
public:
spell_kelthuzad_detonate_mana() : SpellScriptLoader("spell_kelthuzad_detonate_mana") { }
class spell_kelthuzad_detonate_mana_AuraScript : public AuraScript
{
PrepareAuraScript(spell_kelthuzad_detonate_mana_AuraScript);
bool Validate(SpellInfo const* /*spell*/) override bool Validate(SpellInfo const* /*spell*/) override
{ {
@@ -734,13 +723,7 @@ public:
void Register() override void Register() override
{ {
OnEffectPeriodic += AuraEffectPeriodicFn(spell_kelthuzad_detonate_mana_AuraScript::HandleScript, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); OnEffectPeriodic += AuraEffectPeriodicFn(spell_kelthuzad_detonate_mana_aura::HandleScript, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_kelthuzad_detonate_mana_AuraScript();
} }
}; };
@@ -748,7 +731,7 @@ void AddSC_boss_kelthuzad()
{ {
new boss_kelthuzad(); new boss_kelthuzad();
new boss_kelthuzad_minion(); new boss_kelthuzad_minion();
new spell_kelthuzad_frost_blast(); RegisterSpellScript(spell_kelthuzad_frost_blast);
new spell_kelthuzad_detonate_mana(); RegisterSpellScript(spell_kelthuzad_detonate_mana_aura);
} }
@@ -417,14 +417,9 @@ public:
}; };
}; };
class spell_sapphiron_frost_explosion : public SpellScriptLoader class spell_sapphiron_frost_explosion : public SpellScript
{ {
public: PrepareSpellScript(spell_sapphiron_frost_explosion);
spell_sapphiron_frost_explosion() : SpellScriptLoader("spell_sapphiron_frost_explosion") { }
class spell_sapphiron_frost_explosion_SpellScript : public SpellScript
{
PrepareSpellScript(spell_sapphiron_frost_explosion_SpellScript);
void FilterTargets(std::list<WorldObject*>& targets) void FilterTargets(std::list<WorldObject*>& targets)
{ {
@@ -449,19 +444,13 @@ public:
void Register() override void Register() override
{ {
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sapphiron_frost_explosion_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sapphiron_frost_explosion::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_sapphiron_frost_explosion_SpellScript();
} }
}; };
void AddSC_boss_sapphiron() void AddSC_boss_sapphiron()
{ {
new boss_sapphiron(); new boss_sapphiron();
new spell_sapphiron_frost_explosion(); RegisterSpellScript(spell_sapphiron_frost_explosion);
} }
@@ -606,14 +606,14 @@ public:
}; };
}; };
class spell_thaddius_pos_neg_charge : public SpellScriptLoader class spell_thaddius_pos_neg_charge : public SpellScript
{ {
public: PrepareSpellScript(spell_thaddius_pos_neg_charge);
spell_thaddius_pos_neg_charge() : SpellScriptLoader("spell_thaddius_pos_neg_charge") { }
class spell_thaddius_pos_neg_charge_SpellScript : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareSpellScript(spell_thaddius_pos_neg_charge_SpellScript); return ValidateSpellInfo({ SPELL_POSITIVE_CHARGE, SPELL_POSITIVE_CHARGE_STACK });
}
void HandleTargets(std::list<WorldObject*>& targets) void HandleTargets(std::list<WorldObject*>& targets)
{ {
@@ -660,25 +660,14 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); OnEffectHitTarget += SpellEffectFn(spell_thaddius_pos_neg_charge::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thaddius_pos_neg_charge::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
} }
}; };
SpellScript* GetSpellScript() const override class spell_thaddius_polarity_shift : public SpellScript
{ {
return new spell_thaddius_pos_neg_charge_SpellScript(); PrepareSpellScript(spell_thaddius_polarity_shift);
}
};
class spell_thaddius_polarity_shift : public SpellScriptLoader
{
public:
spell_thaddius_polarity_shift() : SpellScriptLoader("spell_thaddius_polarity_shift") { }
class spell_thaddius_polarity_shift_SpellScript : public SpellScript
{
PrepareSpellScript(spell_thaddius_polarity_shift_SpellScript);
bool Validate(SpellInfo const* /*spell*/) override bool Validate(SpellInfo const* /*spell*/) override
{ {
@@ -713,14 +702,8 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_thaddius_polarity_shift_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); OnEffectHitTarget += SpellEffectFn(spell_thaddius_polarity_shift::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
AfterCast += SpellCastFn(spell_thaddius_polarity_shift_SpellScript::HandleAfterCast); AfterCast += SpellCastFn(spell_thaddius_polarity_shift::HandleAfterCast);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_thaddius_polarity_shift_SpellScript();
} }
}; };
@@ -771,7 +754,7 @@ void AddSC_boss_thaddius()
new boss_thaddius(); new boss_thaddius();
new boss_thaddius_summon(); new boss_thaddius_summon();
new npc_tesla(); new npc_tesla();
new spell_thaddius_pos_neg_charge(); RegisterSpellScript(spell_thaddius_pos_neg_charge);
new spell_thaddius_polarity_shift(); RegisterSpellScript(spell_thaddius_polarity_shift);
new at_thaddius_entrance(); new at_thaddius_entrance();
} }