diff options
author | offl <11556157+offl@users.noreply.github.com> | 2022-07-18 00:55:46 +0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-09-05 21:18:23 +0200 |
commit | 243efd378c383a42532f485b7dc9c2c3ae6cf3fd (patch) | |
tree | 508f2d4d9b1a399a80e3e129e3667da52be81280 | |
parent | 2102eced8f12d742a4c9c4c868393c44b7e4949f (diff) |
Scripts/Spells: Script 'Hate To' spells (#28129)
(cherry picked from commit d06842d42a0c140e76571fa30131a950be6d5faa)
3 files changed, 96 insertions, 30 deletions
diff --git a/sql/updates/world/master/2022_09_05_22_world_2022_07_17_00_world.sql b/sql/updates/world/master/2022_09_05_22_world_2022_07_17_00_world.sql new file mode 100644 index 00000000000..f40b8ec5f6e --- /dev/null +++ b/sql/updates/world/master/2022_09_05_22_world_2022_07_17_00_world.sql @@ -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'); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index c2c22702231..03a61fee5ea 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -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(); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 999e3282d8d..76ae0bfe3ad 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -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"); |