fix(Scripts/Naxxramas): Fix Gluth Decimate to leave targets at 5% health (#24489)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Andrew
2026-01-22 00:08:29 -03:00
committed by GitHub
parent 68be5c4b24
commit 9e574c2049
2 changed files with 36 additions and 1 deletions

View File

@@ -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');

View File

@@ -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);
}