Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(Scripts/BlackrockMountain): Spell Scripts registry macros #19186

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/sql/updates/pending_db_world/rev_1719389897107886822.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_garr_separation_anxiety_aura' WHERE `spell_id`=23487;
UPDATE `spell_script_names` SET `ScriptName`='spell_mc_play_dead_aura' WHERE `spell_id`=19822;
UPDATE `spell_script_names` SET `ScriptName`='spell_majordomo_separation_anxiety_aura' WHERE `spell_id`=21094;
UPDATE `spell_script_names` SET `ScriptName`='spell_geddon_inferno_aura' WHERE `spell_id`=19695;
UPDATE `spell_script_names` SET `ScriptName`='spell_geddon_armageddon_aura' WHERE `spell_id`=20478;
Original file line number Diff line number Diff line change
Expand Up @@ -303,50 +303,39 @@ class go_orb_of_domination : public GameObjectScript
}
};

class spell_egg_event : public SpellScriptLoader
class spell_egg_event : public SpellScript
{
public:
spell_egg_event() : SpellScriptLoader("spell_egg_event") { }
PrepareSpellScript(spell_egg_event);

class spell_egg_eventSpellScript : public SpellScript
void HandleOnHit()
{
PrepareSpellScript(spell_egg_eventSpellScript);

void HandleOnHit()
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
instance->SetData(DATA_EGG_EVENT, SPECIAL);
}

if (Creature* razorgore = GetCaster()->ToCreature())
{
if (GameObject* egg = GetHitGObj())
{
razorgore->AI()->DoAction(TALK_EGG_BROKEN_RAND);
egg->SetLootState(GO_READY);
egg->UseDoorOrButton(10000);
egg->SetRespawnTime(WEEK);
}
}
instance->SetData(DATA_EGG_EVENT, SPECIAL);
}

void Register() override
if (Creature* razorgore = GetCaster()->ToCreature())
{
OnHit += SpellHitFn(spell_egg_eventSpellScript::HandleOnHit);
if (GameObject* egg = GetHitGObj())
{
razorgore->AI()->DoAction(TALK_EGG_BROKEN_RAND);
egg->SetLootState(GO_READY);
egg->UseDoorOrButton(10000);
egg->SetRespawnTime(WEEK);
}
}
};
}

SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_egg_eventSpellScript();
OnHit += SpellHitFn(spell_egg_event::HandleOnHit);
}
};

void AddSC_boss_razorgore()
{
new boss_razorgore();
new go_orb_of_domination();
new spell_egg_event();
RegisterSpellScript(spell_egg_event);
}

Original file line number Diff line number Diff line change
Expand Up @@ -478,37 +478,26 @@ enum ShadowFlame
};

// 22539 - Shadowflame (used in Blackwing Lair)
class spell_bwl_shadowflame : public SpellScriptLoader
class spell_bwl_shadowflame : public SpellScript
{
public:
spell_bwl_shadowflame() : SpellScriptLoader("spell_bwl_shadowflame") { }
PrepareSpellScript(spell_bwl_shadowflame);

class spell_bwl_shadowflame_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_bwl_shadowflame_SpellScript);

bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_ONYXIA_SCALE_CLOAK, SPELL_SHADOW_FLAME_DOT });
}

void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/)
{
// If the victim of the spell does not have "Onyxia Scale Cloak" - add the Shadow Flame DoT (22682)
if (Unit* victim = GetHitUnit())
if (!victim->HasAura(SPELL_ONYXIA_SCALE_CLOAK))
victim->AddAura(SPELL_SHADOW_FLAME_DOT, victim);
}
return ValidateSpellInfo({ SPELL_ONYXIA_SCALE_CLOAK, SPELL_SHADOW_FLAME_DOT });
}

void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_bwl_shadowflame_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/)
{
// If the victim of the spell does not have "Onyxia Scale Cloak" - add the Shadow Flame DoT (22682)
if (Unit* victim = GetHitUnit())
if (!victim->HasAura(SPELL_ONYXIA_SCALE_CLOAK))
victim->AddAura(SPELL_SHADOW_FLAME_DOT, victim);
}

SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_bwl_shadowflame_SpellScript;
OnEffectHitTarget += SpellEffectFn(spell_bwl_shadowflame::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};

Expand Down Expand Up @@ -539,7 +528,7 @@ class at_orb_of_command : public AreaTriggerScript
void AddSC_instance_blackwing_lair()
{
new instance_blackwing_lair();
new spell_bwl_shadowflame();
RegisterSpellScript(spell_bwl_shadowflame);
new at_orb_of_command();
}

Original file line number Diff line number Diff line change
Expand Up @@ -128,118 +128,96 @@ class boss_baron_geddon : public CreatureScript
};

// 19695 Inferno
class spell_geddon_inferno : public SpellScriptLoader
class spell_geddon_inferno_aura : public AuraScript
{
public:
spell_geddon_inferno() : SpellScriptLoader("spell_geddon_inferno") { }
PrepareAuraScript(spell_geddon_inferno_aura);

class spell_geddon_inferno_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_geddon_inferno_AuraScript);
return ValidateSpellInfo({ SPELL_INFERNO_DUMMY_EFFECT });
}

bool Validate(SpellInfo const* /*spell*/) override
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
return ValidateSpellInfo({ SPELL_INFERNO_DUMMY_EFFECT });
pCreatureTarget->SetReactState(REACT_PASSIVE);
pCreatureTarget->AttackStop();
}
}

void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_PASSIVE);
pCreatureTarget->AttackStop();
}
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
}
}

void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
}
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();

void PeriodicTick(AuraEffect const* aurEff)
if (Unit* caster = GetUnitOwner())
{
PreventDefaultAction();

if (Unit* caster = GetUnitOwner())
//The pulses come about 1 second apart and last for 10 seconds. Damage starts at 500 damage per pulse and increases by 500 every other pulse (500, 500, 1000, 1000, 1500, etc.). (Source: Wowwiki)
int32 multiplier = 1;
switch (aurEff->GetTickNumber())
{
//The pulses come about 1 second apart and last for 10 seconds. Damage starts at 500 damage per pulse and increases by 500 every other pulse (500, 500, 1000, 1000, 1500, etc.). (Source: Wowwiki)
int32 multiplier = 1;
switch (aurEff->GetTickNumber())
{
case 3:
case 4:
multiplier = 2;
break;
case 5:
case 6:
multiplier = 4;
break;
case 7:
multiplier = 6;
break;
case 8:
multiplier = 10;
break;
}

caster->CastCustomSpell(SPELL_INFERNO_DUMMY_EFFECT, SPELLVALUE_BASE_POINT0, 500 * multiplier, (Unit*)nullptr, TRIGGERED_NONE, nullptr, aurEff);
case 3:
case 4:
multiplier = 2;
break;
case 5:
case 6:
multiplier = 4;
break;
case 7:
multiplier = 6;
break;
case 8:
multiplier = 10;
break;
}
}

void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_geddon_inferno_AuraScript::HandleAfterApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_inferno_AuraScript::HandleAfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_geddon_inferno_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
caster->CastCustomSpell(SPELL_INFERNO_DUMMY_EFFECT, SPELLVALUE_BASE_POINT0, 500 * multiplier, (Unit*)nullptr, TRIGGERED_NONE, nullptr, aurEff);
}
};
}

AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_geddon_inferno_AuraScript();
AfterEffectApply += AuraEffectApplyFn(spell_geddon_inferno_aura::HandleAfterApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_inferno_aura::HandleAfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_geddon_inferno_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};

// 20478 Armageddon
class spell_geddon_armageddon : public SpellScriptLoader
class spell_geddon_armageddon_aura : public AuraScript
{
public:
spell_geddon_armageddon() : SpellScriptLoader("spell_geddon_armageddon") { }
PrepareAuraScript(spell_geddon_armageddon_aura);

class spell_geddon_armageddon_AuraScript : public AuraScript
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_geddon_armageddon_AuraScript);

void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_PASSIVE);
pCreatureTarget->AttackStop();
}
}

void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
}
pCreatureTarget->SetReactState(REACT_PASSIVE);
pCreatureTarget->AttackStop();
}
}

void Register() override
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
{
AfterEffectApply += AuraEffectApplyFn(spell_geddon_armageddon_AuraScript::HandleAfterApply, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_armageddon_AuraScript::HandleAfterRemove, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
}
};
}

AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_geddon_armageddon_AuraScript();
AfterEffectApply += AuraEffectApplyFn(spell_geddon_armageddon_aura::HandleAfterApply, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_armageddon_aura::HandleAfterRemove, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
}
};

Expand All @@ -248,7 +226,7 @@ void AddSC_boss_baron_geddon()
new boss_baron_geddon();

// Spells
new spell_geddon_inferno();
new spell_geddon_armageddon();
RegisterSpellScript(spell_geddon_inferno_aura);
RegisterSpellScript(spell_geddon_armageddon_aura);
}

Loading