mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user