Scripts/Spells: Script 'Hate To' spells (#28129)

(cherry picked from commit d06842d42a0c140e76571fa30131a950be6d5faa)
This commit is contained in:
offl
2022-09-05 21:18:23 +02:00
committed by Shauren
parent 2102eced8f
commit 243efd378c
3 changed files with 96 additions and 30 deletions
@@ -0,0 +1,15 @@
--
UPDATE `spell_script_names` SET `ScriptName` = 'spell_gen_hate_to_zero_caster_target' WHERE `ScriptName` = 'spell_yogg_saron_hate_to_zero';
DELETE FROM `spell_script_names` WHERE `ScriptName` IN (
'spell_gen_hate_to_zero',
'spell_gen_hate_to_50',
'spell_gen_hate_to_75');
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(9204,'spell_gen_hate_to_zero'),
(20538,'spell_gen_hate_to_zero'),
(26569,'spell_gen_hate_to_zero'),
(26637,'spell_gen_hate_to_zero'),
(37326,'spell_gen_hate_to_zero'),
(19707,'spell_gen_hate_to_50'),
(26886,'spell_gen_hate_to_75');
@@ -3075,35 +3075,6 @@ class spell_yogg_saron_keeper_aura : public SpellScriptLoader // 62650, 6267
}
};
// 63984 - Hate to Zero
class spell_yogg_saron_hate_to_zero : public SpellScriptLoader // 63984
{
public:
spell_yogg_saron_hate_to_zero() : SpellScriptLoader("spell_yogg_saron_hate_to_zero") { }
class spell_yogg_saron_hate_to_zero_SpellScript : public SpellScript
{
PrepareSpellScript(spell_yogg_saron_hate_to_zero_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
if (target->CanHaveThreatList())
target->GetThreatManager().ModifyThreatByPercent(GetCaster(), -100);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_hate_to_zero_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_yogg_saron_hate_to_zero_SpellScript();
}
};
// 64184 - In the Maws of the Old God
class spell_yogg_saron_in_the_maws_of_the_old_god : public SpellScriptLoader // 64184
{
@@ -3267,7 +3238,6 @@ void AddSC_boss_yogg_saron()
new spell_yogg_saron_insane_periodic();
new spell_yogg_saron_lunatic_gaze();
new spell_yogg_saron_keeper_aura();
new spell_yogg_saron_hate_to_zero();
new spell_yogg_saron_in_the_maws_of_the_old_god();
new spell_yogg_saron_titanic_storm();
new spell_yogg_saron_hodirs_protective_gaze();
@@ -2058,6 +2058,83 @@ class spell_gen_gryphon_wyvern_mount_check : public AuraScript
}
};
/* 9204 - Hate to Zero (Melee)
20538 - Hate to Zero (AoE)
26569 - Hate to Zero (AoE)
26637 - Hate to Zero (AoE, Unique)
37326 - Hate to Zero (AoE)
40410 - Hate to Zero (Should be added, AoE)
40467 - Hate to Zero (Should be added, AoE)
41582 - Hate to Zero (Should be added, Melee) */
class spell_gen_hate_to_zero : public SpellScript
{
PrepareSpellScript(spell_gen_hate_to_zero);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (GetCaster()->CanHaveThreatList())
GetCaster()->GetThreatManager().ModifyThreatByPercent(GetHitUnit(), -100);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_hate_to_zero::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// This spell is used by both player and creature, but currently works only if used by player
// 63984 - Hate to Zero
class spell_gen_hate_to_zero_caster_target : public SpellScript
{
PrepareSpellScript(spell_gen_hate_to_zero_caster_target);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
if (target->CanHaveThreatList())
target->GetThreatManager().ModifyThreatByPercent(GetCaster(), -100);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_hate_to_zero_caster_target::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// 19707 - Hate to 50%
class spell_gen_hate_to_50 : public SpellScript
{
PrepareSpellScript(spell_gen_hate_to_50);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (GetCaster()->CanHaveThreatList())
GetCaster()->GetThreatManager().ModifyThreatByPercent(GetHitUnit(), -50);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_hate_to_50::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// 26886 - Hate to 75%
class spell_gen_hate_to_75 : public SpellScript
{
PrepareSpellScript(spell_gen_hate_to_75);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (GetCaster()->CanHaveThreatList())
GetCaster()->GetThreatManager().ModifyThreatByPercent(GetHitUnit(), -25);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_hate_to_75::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
enum Interrupt
{
SPELL_GEN_THROW_INTERRUPT = 32747
@@ -5094,6 +5171,10 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_gift_of_naaru);
RegisterSpellScript(spell_gen_gnomish_transporter);
RegisterSpellScript(spell_gen_gryphon_wyvern_mount_check);
RegisterSpellScript(spell_gen_hate_to_zero);
RegisterSpellScript(spell_gen_hate_to_zero_caster_target);
RegisterSpellScript(spell_gen_hate_to_50);
RegisterSpellScript(spell_gen_hate_to_75);
RegisterSpellScriptWithArgs(spell_gen_increase_stats_buff, "spell_pal_blessing_of_kings");
RegisterSpellScriptWithArgs(spell_gen_increase_stats_buff, "spell_pal_blessing_of_might");
RegisterSpellScriptWithArgs(spell_gen_increase_stats_buff, "spell_dru_mark_of_the_wild");