mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
refactor(Scripts/RubySanctum): Spell Scripts registry macros (#19487)
This commit is contained in:
@@ -334,34 +334,28 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class spell_baltharus_enervating_brand_trigger : public SpellScriptLoader
|
||||
class spell_baltharus_enervating_brand_trigger : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_baltharus_enervating_brand_trigger() : SpellScriptLoader("spell_baltharus_enervating_brand_trigger") { }
|
||||
PrepareSpellScript(spell_baltharus_enervating_brand_trigger);
|
||||
|
||||
class spell_baltharus_enervating_brand_trigger_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareSpellScript(spell_baltharus_enervating_brand_trigger_SpellScript);
|
||||
return ValidateSpellInfo({ SPELL_SIPHONED_MIGHT });
|
||||
}
|
||||
|
||||
void CheckDistance()
|
||||
{
|
||||
if (Unit* caster = GetOriginalCaster())
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (target == GetCaster()
|
||||
// the spell has an unlimited range, so we need this check
|
||||
&& target->GetDistance2d(caster) <= 12.0f)
|
||||
target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnHit += SpellHitFn(spell_baltharus_enervating_brand_trigger_SpellScript::CheckDistance);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void CheckDistance()
|
||||
{
|
||||
return new spell_baltharus_enervating_brand_trigger_SpellScript();
|
||||
if (Unit* caster = GetOriginalCaster())
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (target == GetCaster()
|
||||
// the spell has an unlimited range, so we need this check
|
||||
&& target->GetDistance2d(caster) <= 12.0f)
|
||||
target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnHit += SpellHitFn(spell_baltharus_enervating_brand_trigger::CheckDistance);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -486,7 +480,7 @@ void AddSC_boss_baltharus_the_warborn()
|
||||
{
|
||||
new boss_baltharus_the_warborn();
|
||||
new npc_baltharus_the_warborn_clone();
|
||||
new spell_baltharus_enervating_brand_trigger();
|
||||
RegisterSpellScript(spell_baltharus_enervating_brand_trigger);
|
||||
new npc_xerestrasza();
|
||||
new at_baltharus_plateau();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -185,65 +185,48 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class spell_saviana_conflagration_init : public SpellScriptLoader
|
||||
class spell_saviana_conflagration_init : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_saviana_conflagration_init() : SpellScriptLoader("spell_saviana_conflagration_init") { }
|
||||
PrepareSpellScript(spell_saviana_conflagration_init);
|
||||
|
||||
class spell_saviana_conflagration_init_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareSpellScript(spell_saviana_conflagration_init_SpellScript);
|
||||
return ValidateSpellInfo({ SPELL_FLAME_BEACON, SPELL_CONFLAGRATION_MISSLE });
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetCaster()->CastSpell(GetHitUnit(), SPELL_FLAME_BEACON, true);
|
||||
GetCaster()->CastSpell(GetHitUnit(), SPELL_CONFLAGRATION_MISSLE, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_saviana_conflagration_init_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
return new spell_saviana_conflagration_init_SpellScript();
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetCaster()->CastSpell(GetHitUnit(), SPELL_FLAME_BEACON, true);
|
||||
GetCaster()->CastSpell(GetHitUnit(), SPELL_CONFLAGRATION_MISSLE, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_saviana_conflagration_init::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_saviana_conflagration_throwback : public SpellScriptLoader
|
||||
class spell_saviana_conflagration_throwback : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_saviana_conflagration_throwback() : SpellScriptLoader("spell_saviana_conflagration_throwback") { }
|
||||
PrepareSpellScript(spell_saviana_conflagration_throwback);
|
||||
|
||||
class spell_saviana_conflagration_throwback_SpellScript : public SpellScript
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PrepareSpellScript(spell_saviana_conflagration_throwback_SpellScript);
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_saviana_conflagration_throwback_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void Register() override
|
||||
{
|
||||
return new spell_saviana_conflagration_throwback_SpellScript();
|
||||
OnEffectHitTarget += SpellEffectFn(spell_saviana_conflagration_throwback::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_saviana_ragefire()
|
||||
{
|
||||
new boss_saviana_ragefire();
|
||||
new spell_saviana_conflagration_init();
|
||||
new spell_saviana_conflagration_throwback();
|
||||
RegisterSpellScript(spell_saviana_conflagration_init);
|
||||
RegisterSpellScript(spell_saviana_conflagration_throwback);
|
||||
}
|
||||
|
||||
|
||||
@@ -245,41 +245,35 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class spell_ruby_sanctum_rallying_shout : public SpellScriptLoader
|
||||
class spell_ruby_sanctum_rallying_shout : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_ruby_sanctum_rallying_shout() : SpellScriptLoader("spell_ruby_sanctum_rallying_shout") { }
|
||||
PrepareSpellScript(spell_ruby_sanctum_rallying_shout);
|
||||
|
||||
class spell_ruby_sanctum_rallying_shout_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareSpellScript(spell_ruby_sanctum_rallying_shout_SpellScript);
|
||||
return ValidateSpellInfo({ SPELL_RALLY });
|
||||
}
|
||||
|
||||
void CountAllies()
|
||||
{
|
||||
uint32 count = GetSpell()->GetUniqueTargetInfo()->size();
|
||||
if (count == GetCaster()->GetAuraCount(SPELL_RALLY))
|
||||
return;
|
||||
|
||||
GetCaster()->RemoveAurasDueToSpell(SPELL_RALLY);
|
||||
if (count > 0)
|
||||
GetCaster()->CastCustomSpell(SPELL_RALLY, SPELLVALUE_AURA_STACK, count, GetCaster(), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterHit += SpellHitFn(spell_ruby_sanctum_rallying_shout_SpellScript::CountAllies);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void CountAllies()
|
||||
{
|
||||
return new spell_ruby_sanctum_rallying_shout_SpellScript();
|
||||
uint32 count = GetSpell()->GetUniqueTargetInfo()->size();
|
||||
if (count == GetCaster()->GetAuraCount(SPELL_RALLY))
|
||||
return;
|
||||
|
||||
GetCaster()->RemoveAurasDueToSpell(SPELL_RALLY);
|
||||
if (count > 0)
|
||||
GetCaster()->CastCustomSpell(SPELL_RALLY, SPELLVALUE_AURA_STACK, count, GetCaster(), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterHit += SpellHitFn(spell_ruby_sanctum_rallying_shout::CountAllies);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_instance_ruby_sanctum()
|
||||
{
|
||||
new instance_ruby_sanctum();
|
||||
new spell_ruby_sanctum_rallying_shout();
|
||||
RegisterSpellScript(spell_ruby_sanctum_rallying_shout);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user