diff --git a/data/sql/updates/pending_db_world/rev_1666516880898803000.sql b/data/sql/updates/pending_db_world/rev_1666516880898803000.sql new file mode 100644 index 000000000..7a7995ed4 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1666516880898803000.sql @@ -0,0 +1,9 @@ +-- +-- Lava Spawn (12265) +DELETE FROM `creature_text` WHERE `CreatureID`=12265; +INSERT INTO `creature_text` (`CreatureID`, `Text`, `Type`, `Probability`, `BroadcastTextId`, `comment`) VALUES +(12265, '%s splits into two new Lava Spawns!', 16, 100, 7570, 'Lava Spawn'); + +UPDATE `creature_template` SET `AiName`='', `ScriptName`='npc_lava_spawn' WHERE `entry`=12265; + +DELETE FROM `smart_scripts` WHERE `entryorguid`=12265 AND `source_type`=0; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.cpp index 7e215ad55..ea6eb193e 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" +#include "TaskScheduler.h" enum Texts { @@ -34,6 +35,13 @@ enum Spells SPELL_FULL_HEALTH = 17683, SPELL_FIRE_NOVA_VISUAL = 19823, SPELL_PLAY_DEAD_PACIFY = 19951, // Server side spell + + // Lava Spawn + SPELL_FIREBALL = 19391, + SPELL_SPLIT_1 = 19569, + SPELL_SPLIT_2 = 19570, + + TALK_0 = 0 }; // Serrated Bites timer may be wrong @@ -207,10 +215,60 @@ public: } }; +struct npc_lava_spawn : public ScriptedAI +{ + npc_lava_spawn(Creature* creature) : ScriptedAI(creature) + { + } + + void Reset() override + { + _scheduler.CancelAll(); + } + + void EnterCombat(Unit* /*who*/) override + { + _scheduler.Schedule(15s, [this](TaskContext context) + { + std::list lavaSpawns; + me->GetCreatureListWithEntryInGrid(lavaSpawns, me->GetEntry(), 100.f); + if (lavaSpawns.size() < 16) + { + Talk(TALK_0); + + DoCastSelf(SPELL_SPLIT_1, true); + DoCastSelf(SPELL_SPLIT_2, true); + + me->DespawnOrUnsummon(); + } + else + { + context.Repeat(15s); + } + }); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + { + return; + } + + _scheduler.Update(diff); + + DoSpellAttackIfReady(SPELL_FIREBALL); + } + +private: + TaskScheduler _scheduler; +}; + void AddSC_molten_core() { // Creatures new npc_mc_core_hound(); + RegisterCreatureAI(npc_lava_spawn); // Spells new spell_mc_play_dead();