fix(Scripts/BlackTemple): Remove Naj'entus Spines from players on engage. (#20176)

This commit is contained in:
Benjamin Jackson
2024-10-11 08:29:00 -04:00
committed by GitHub
parent a9080bef60
commit 94a03c629b
2 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
DELETE FROM `spell_script_names` WHERE `spell_id` = 40354;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (40354, 'spell_najentus_remove_spines');

View File

@@ -19,6 +19,7 @@
#include "ScriptedCreature.h"
#include "SpellScriptLoader.h"
#include "black_temple.h"
#include "Player.h"
#include "SpellScript.h"
enum Yells
@@ -39,7 +40,8 @@ enum Spells
SPELL_TIDAL_SHIELD = 39872,
SPELL_IMPALING_SPINE = 39837,
SPELL_SUMMON_IMPALING_SPINE = 39929,
SPELL_BERSERK = 26662
SPELL_BERSERK = 26662,
SPELL_REMOVE_SPINES = 40354
};
enum Events
@@ -48,6 +50,11 @@ enum Events
EVENT_ENRAGE = 2
};
enum Misc
{
ITEM_NAJENTUS_SPINE = 32408
};
struct boss_najentus : public BossAI
{
boss_najentus(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS), _canTalk(true) { }
@@ -56,6 +63,7 @@ struct boss_najentus : public BossAI
{
_Reset();
me->m_Events.CancelEventGroup(EVENT_ENRAGE);
DoCastSelf(SPELL_REMOVE_SPINES);
}
void JustEngagedWith(Unit* who) override
@@ -64,6 +72,7 @@ struct boss_najentus : public BossAI
BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO);
DoCastSelf(SPELL_REMOVE_SPINES);
me->m_Events.AddEventAtOffset([this] {
Talk(SAY_ENRAGE);
@@ -157,9 +166,31 @@ class spell_najentus_hurl_spine : public SpellScript
}
};
class spell_najentus_remove_spines : public SpellScript
{
PrepareSpellScript(spell_najentus_remove_spines);
void RemoveSpines()
{
if (Unit* caster = GetCaster())
{
caster->GetMap()->DoForAllPlayers([&](Player* player)
{
player->DestroyItemCount(ITEM_NAJENTUS_SPINE, 5, true);
});
}
}
void Register() override
{
OnCast += SpellCastFn(spell_najentus_remove_spines::RemoveSpines);
}
};
void AddSC_boss_najentus()
{
RegisterBlackTempleCreatureAI(boss_najentus);
RegisterSpellScript(spell_najentus_needle_spine);
RegisterSpellScript(spell_najentus_hurl_spine);
RegisterSpellScript(spell_najentus_remove_spines);
}