From 37e9fac5f6a2a00b2d15e670dfc9acf4c9a885a5 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Sun, 14 Aug 2022 15:17:57 +0200 Subject: [PATCH] fix(Scripts/AhnQiraj): Anubisath Sentinel - added missing spells. (#12726) Fixes #12630 --- .../rev_1660401908463646700.sql | 4 ++ .../mob_anubisath_sentinel.cpp | 41 +++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1660401908463646700.sql diff --git a/data/sql/updates/pending_db_world/rev_1660401908463646700.sql b/data/sql/updates/pending_db_world/rev_1660401908463646700.sql new file mode 100644 index 000000000..6f872c92a --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1660401908463646700.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `creature_text` WHERE `CreatureID`=15264; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(15264,0,0,'%s becomes enraged!',16,0,100,0,0,0,24144,0,'Anubisath Sentinel'); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index 6db2ba06f..6d1e21635 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -54,7 +54,13 @@ enum Spells SPELL_STORM_BUFF = 2148, SPELL_STORM = 26546, - SPELL_SUMMON_SMALL_OBSIDIAN_CHUNK = 27627 // Server-side + SPELL_SUMMON_SMALL_OBSIDIAN_CHUNK = 27627, // Server-side + + SPELL_TRANSFER_POWER = 2400, + SPELL_HEAL_BRETHEN = 26565, + SPELL_ENRAGE = 8599, + + TALK_ENRAGE = 0 }; class npc_anubisath_sentinel : public CreatureScript @@ -247,6 +253,7 @@ public: } ClearBuddyList(); gatherOthersWhenAggro = true; + _enraged = false; } void GainSentinelAbility(uint32 id) @@ -263,6 +270,20 @@ public: DoZoneInCombat(); } + void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override + { + if (spellInfo->Id == SPELL_TRANSFER_POWER) + { + if (Creature* sentinel = target->ToCreature()) + { + if (sentinel->IsAIEnabled) + { + CAST_AI(aqsentinelAI, sentinel->AI())->GainSentinelAbility(ability); + } + } + } + } + void JustDied(Unit* /*killer*/) override { for (int ni = 0; ni < 3; ++ni) @@ -272,12 +293,26 @@ public: continue; if (sent->isDead()) continue; - sent->ModifyHealth(int32(sent->CountPctFromMaxHealth(50))); - CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability); + DoCast(sent, SPELL_HEAL_BRETHEN, true); + DoCast(sent, SPELL_TRANSFER_POWER, true); } DoCastSelf(SPELL_SUMMON_SMALL_OBSIDIAN_CHUNK, true); } + + void DamageTaken(Unit* /*doneBy*/, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) override + { + if (!_enraged && me->HealthBelowPctDamaged(50, damage)) + { + _enraged = true; + damage = 0; + DoCastSelf(SPELL_ENRAGE, true); + Talk(TALK_ENRAGE); + } + } + + private: + bool _enraged; }; };