diff --git a/data/sql/updates/pending_db_world/rev_1673176236867407100.sql b/data/sql/updates/pending_db_world/rev_1673176236867407100.sql new file mode 100644 index 000000000..73a95444b --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1673176236867407100.sql @@ -0,0 +1,7 @@ +-- +UPDATE `creature_template` SET `AiName`='', `ScriptName`='npc_underbat' WHERE `entry`=17724; +DELETE FROM `smart_scripts` WHERE `entryorguid`=17724 AND `source_type`=0; + +DELETE FROM `spelldifficulty_dbc` WHERE `ID`=34171; +INSERT INTO `spelldifficulty_dbc` VALUES +(34171,34171,37956,0,0); diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/underbog.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/underbog.cpp index 6f68fcd74..04880735e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/underbog/underbog.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/underbog.cpp @@ -16,9 +16,55 @@ */ #include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "SpellScript.h" +#include "TaskScheduler.h" #include "the_underbog.h" +enum UnderbatSpells +{ + SPELL_TENTACLE_LASH = 34171 +}; + +struct npc_underbat : public ScriptedAI +{ + npc_underbat(Creature* c) : ScriptedAI(c) {} + + void Reset() override + { + _scheduler.CancelAll(); + } + + void JustEngagedWith(Unit* /*who*/) override + { + _scheduler.Schedule(2200ms, 6900ms, [this](TaskContext context) + { + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [&](Unit* u) + { + return u->IsAlive() && !u->IsPet() && me->IsWithinCombatRange(u, 20.f) && !me->HasInArc(M_PI, u); + })) + { + DoCast(target, SPELL_TENTACLE_LASH); + } + context.Repeat(5700ms, 9700ms); + }); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + _scheduler.Update(diff, [this] + { + DoMeleeAttackIfReady(); + }); + } + +private: + TaskScheduler _scheduler; +}; + class spell_fungal_decay : public AuraScript { PrepareAuraScript(spell_fungal_decay); @@ -72,6 +118,7 @@ class spell_allergies : public AuraScript void AddSC_underbog() { + RegisterUnderbogCreatureAI(npc_underbat); RegisterSpellScript(spell_fungal_decay); RegisterSpellScript(spell_allergies); }