fix(Scripts/Underbog): Underbat's Tentacle Lash should be casted only … (#14566)

* fix(Scripts/Underbog: Underbat's Tentacle Lash should be casted only on targets behind the bat.

Fixes #13972

* buildfix.
This commit is contained in:
UltraNix
2023-05-12 14:15:02 +02:00
committed by GitHub
parent 81fb1e60b7
commit 2a1d706a2f
2 changed files with 54 additions and 0 deletions

View File

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