fix(Scripts/MoltenCore): Lava Spawn. (#13508)

Fixes #13107
This commit is contained in:
UltraNix
2022-10-29 12:14:38 +02:00
committed by GitHub
parent 670d5724cb
commit 751bc4ffe1
2 changed files with 67 additions and 0 deletions

View File

@@ -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;

View File

@@ -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<Creature*> 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();