From a957b4a5b740407794f5f6fbe4d06b5ac1378b8d Mon Sep 17 00:00:00 2001 From: Jelle Meeus Date: Wed, 27 Aug 2025 15:32:59 -0700 Subject: [PATCH] fix(DB/SmartAI): port Shadow of Doom script to SmartAI (#22735) --- .../rev_1756307808923704438.sql | 13 ++++ src/server/scripts/World/scourge_invasion.cpp | 64 ------------------- src/server/scripts/World/scourge_invasion.h | 4 -- 3 files changed, 13 insertions(+), 68 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1756307808923704438.sql diff --git a/data/sql/updates/pending_db_world/rev_1756307808923704438.sql b/data/sql/updates/pending_db_world/rev_1756307808923704438.sql new file mode 100644 index 000000000..1b638115a --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1756307808923704438.sql @@ -0,0 +1,13 @@ +-- +UPDATE `creature_template` SET `ScriptName` = '', `AIName` = 'SmartAI' WHERE (`entry` = 16143); + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 16143) AND (`source_type` = 0); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(16143, 0, 0, 1, 54, 0, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5000, 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadow of Doom - On Just Summoned - Say Line 0'), +(16143, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 10389, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadow of Doom - On Just Summoned - Cast \'Spawn Smoke\''), +(16143, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 256, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadow of Doom - On Just Summoned - Set Flags Immune To Players'), +(16143, 0, 3, 0, 52, 0, 100, 0, 0, 0, 0, 0, 0, 0, 19, 256, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadow of Doom - On Text 0 Over - Remove Flags Immune To Players'), +(16143, 0, 4, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 28056, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadow of Doom - On Just Died - Cast \'Zap Crystal Corpse\''), +(16143, 0, 5, 0, 8, 0, 100, 0, 17680, 0, 0, 0, 0, 0, 41, 3000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadow of Doom - On Spellhit \'Spirit Spawn-out\' - Despawn In 3000 ms'), +(16143, 0, 6, 0, 0, 0, 100, 0, 2000, 2000, 6500, 13000, 0, 0, 11, 16568, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadow of Doom - In Combat - Cast \'Mind Flay\''), +(16143, 0, 7, 0, 0, 0, 100, 0, 2000, 2000, 14500, 14500, 0, 0, 11, 12542, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadow of Doom - In Combat - Cast \'Fear\''); diff --git a/src/server/scripts/World/scourge_invasion.cpp b/src/server/scripts/World/scourge_invasion.cpp index eac52f705..a53075309 100644 --- a/src/server/scripts/World/scourge_invasion.cpp +++ b/src/server/scripts/World/scourge_invasion.cpp @@ -802,69 +802,6 @@ struct npc_cultist_engineer : public ScriptedAI } }; -struct npc_shadow_of_doom : public CombatAI -{ - npc_shadow_of_doom(Creature* creature) : CombatAI(creature) { } - - void JustEngagedWith(Unit* /*who*/) override - { - scheduler.Schedule(2s, [&](TaskContext context) - { - DoCastVictim(SPELL_MINDFLAY); - context.Repeat(6500ms, 13s); - }).Schedule(2s, [&](TaskContext context) - { - DoCastVictim(SPELL_FEAR); - context.Repeat(14500ms, 14500ms); - }); - } - - void Reset() override - { - scheduler.CancelAll(); - me->SetImmuneToPC(false); - } - - void IsSummonedBy(WorldObject* summoner) override - { - if (!summoner) - return; - - if (Player* player = summoner->ToPlayer()) - { - me->SetImmuneToPC(true); - me->SetFacingToObject(player); - - Talk(SHADOW_OF_DOOM_SAY_AGGRO, player); - DoCastSelf(SPELL_SPAWN_SMOKE, true); - - scheduler.Schedule(5s, [this, player](TaskContext const& /*context*/) - { - me->SetImmuneToPC(false); - if (me->CanStartAttack(player)) - AttackStart(player); - }); - } - } - - void JustDied(Unit* /*pKiller*/) override - { - DoCastSelf(SPELL_ZAP_CRYSTAL_CORPSE, true); - } - - void SpellHit(Unit* /* caster */, SpellInfo const* spell) override - { - if (spell->Id == SPELL_SPIRIT_SPAWN_OUT) - me->DespawnOrUnsummon(3000); - } - - void UpdateAI(uint32 const diff) override - { - scheduler.Update(diff); - DoMeleeAttackIfReady(); - } -}; - struct npc_flameshocker : public CombatAI { npc_flameshocker(Creature* creature) : CombatAI(creature) { } @@ -1121,7 +1058,6 @@ void AddSC_scourge_invasion() RegisterCreatureAI(npc_minion_spawner); RegisterCreatureAI(npc_pallid_horror); RegisterCreatureAI(npc_cultist_engineer); - RegisterCreatureAI(npc_shadow_of_doom); RegisterCreatureAI(npc_flameshocker); RegisterSpellScript(spell_communique_trigger); RegisterSpellScript(spell_despawner_self); diff --git a/src/server/scripts/World/scourge_invasion.h b/src/server/scripts/World/scourge_invasion.h index fa927340a..0bc511ace 100644 --- a/src/server/scripts/World/scourge_invasion.h +++ b/src/server/scripts/World/scourge_invasion.h @@ -137,10 +137,7 @@ enum ScourgeInvasionSpells */ // Shadow of Doom - SPELL_SPAWN_SMOKE = 10389, // Spawning Visual. SPELL_ZAP_CRYSTAL_CORPSE = 28056, // Casted on Shard if Shadow of Doom dies. - SPELL_MINDFLAY = 16568, - SPELL_FEAR = 12542, // Pallid Horror - Patchwerk Terror (also uses: 28315) SPELL_SUMMON_CRACKED_NECROTIC_CRYSTAL = 28424, // Alliance. @@ -336,7 +333,6 @@ enum ScourgeInvasionTalk HERALD_OF_THE_LICH_KING_SAY_ATTACK_END = 1, HERALD_OF_THE_LICH_KING_SAY_ATTACK_RANDOM = 2, PALLID_HORROR_SAY_RANDOM_YELL = 0, - SHADOW_OF_DOOM_SAY_AGGRO = 0, SYLVANAS_SAY_ATTACK_END = 3, VARIAN_SAY_ATTACK_END = 3 };