From 9e574c2049c8007897c09cf605d035307e8e3afc Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Thu, 22 Jan 2026 00:08:29 -0300 Subject: [PATCH] fix(Scripts/Naxxramas): Fix Gluth Decimate to leave targets at 5% health (#24489) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../rev_1769046247414176200.sql | 4 +++ .../Northrend/Naxxramas/boss_gluth.cpp | 33 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 data/sql/updates/pending_db_world/rev_1769046247414176200.sql diff --git a/data/sql/updates/pending_db_world/rev_1769046247414176200.sql b/data/sql/updates/pending_db_world/rev_1769046247414176200.sql new file mode 100644 index 000000000..fd0cd8c6a --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1769046247414176200.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id` = 28375; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(28375, 'spell_gluth_decimate_damage'); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index 189b24880..7076ab750 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -255,7 +255,8 @@ class spell_gluth_decimate : public SpellScript Unit::DealDamage(GetCaster(), cTarget, damage); return; } - GetCaster()->CastCustomSpell(SPELL_DECIMATE_DAMAGE, SPELLVALUE_BASE_POINT0, damage, unitTarget); + + GetCaster()->CastSpell(unitTarget, SPELL_DECIMATE_DAMAGE); } } @@ -265,8 +266,38 @@ class spell_gluth_decimate : public SpellScript } }; +// 28375 - Decimate +class spell_gluth_decimate_damage : public SpellScript +{ + PrepareSpellScript(spell_gluth_decimate_damage) + + void RecalculateDamage() + { + Unit* target = GetHitUnit(); + if (!target) + return; + + int32 targetHealth = int32(target->GetHealth()); + int32 fivePctHealth = int32(target->CountPctFromMaxHealth(5)); + + // Damage needed to leave the target at exactly 5% + int32 damage = targetHealth - fivePctHealth; + + if (damage <= 0) + damage = 0; + + SetHitDamage(damage); + } + + void Register() override + { + OnHit += SpellHitFn(spell_gluth_decimate_damage::RecalculateDamage); + } +}; + void AddSC_boss_gluth() { new boss_gluth(); RegisterSpellScript(spell_gluth_decimate); + RegisterSpellScript(spell_gluth_decimate_damage); }