From 388e31fd6d2e1e1309d6c9a3dea92b65dadb6a78 Mon Sep 17 00:00:00 2001 From: Jelle Meeus Date: Sat, 8 Jun 2024 17:51:24 +0200 Subject: [PATCH] gluth decimate --- .../Northrend/Naxxramas/boss_gluth.cpp | 49 +++++++------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index 9f98655d04..9faf9952a7 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -237,50 +237,39 @@ public: }; }; -class spell_gluth_decimate : public SpellScriptLoader +class spell_gluth_decimate : public SpellScript { -public: - spell_gluth_decimate() : SpellScriptLoader("spell_gluth_decimate") { } + PrepareSpellScript(spell_gluth_decimate); - class spell_gluth_decimate_SpellScript : public SpellScript + void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - PrepareSpellScript(spell_gluth_decimate_SpellScript); - - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + if (Unit* unitTarget = GetHitUnit()) { - if (Unit* unitTarget = GetHitUnit()) + int32 damage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5)); + if (damage <= 0) + return; + + if (Creature* cTarget = unitTarget->ToCreature()) { - int32 damage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5)); - if (damage <= 0) - return; - - if (Creature* cTarget = unitTarget->ToCreature()) - { - cTarget->SetWalk(true); - cTarget->GetMotionMaster()->MoveFollow(GetCaster(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); - cTarget->SetReactState(REACT_PASSIVE); - Unit::DealDamage(GetCaster(), cTarget, damage); - return; - } - GetCaster()->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget); + cTarget->SetWalk(true); + cTarget->GetMotionMaster()->MoveFollow(GetCaster(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); + cTarget->SetReactState(REACT_PASSIVE); + Unit::DealDamage(GetCaster(), cTarget, damage); + return; } + GetCaster()->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget); } + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_gluth_decimate_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_gluth_decimate_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_gluth_decimate::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; void AddSC_boss_gluth() { new boss_gluth(); - new spell_gluth_decimate(); + RegisterSpellScript(spell_gluth_decimate); }