fix(Scripts/HellfireRamparts): Fix Nazan not casting abilities (#16598)

This commit is contained in:
Angelo Venturini
2023-06-21 23:26:11 -03:00
committed by GitHub
parent 2a9493bd76
commit fb7164be05

View File

@@ -17,6 +17,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "TaskScheduler.h"
#include "hellfire_ramparts.h"
enum Says
@@ -83,11 +84,6 @@ struct boss_vazruden_the_herald : public BossAI
}
}
void JustDied(Unit*) override
{
instance->SetBossState(DATA_VAZRUDEN, DONE);
}
void MovementInform(uint32 type, uint32 id) override
{
if (type == POINT_MOTION_TYPE && id == POINT_MIDDLE)
@@ -105,7 +101,7 @@ struct boss_vazruden_the_herald : public BossAI
{
Talk(SAY_INTRO);
me->GetMotionMaster()->MovePoint(POINT_MIDDLE, -1406.5f, 1746.5f, 85.0f, false);
me->setActive(true);
_JustEngagedWith();
}
else if (summons.size() == 0)
{
@@ -139,11 +135,11 @@ struct boss_vazruden_the_herald : public BossAI
}
};
struct boss_nazan : public BossAI
struct boss_nazan : public ScriptedAI
{
boss_nazan(Creature* creature) : BossAI(creature, DATA_VAZRUDEN)
boss_nazan(Creature* creature) : ScriptedAI(creature)
{
scheduler.SetValidator([this]
_scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
@@ -162,11 +158,11 @@ struct boss_nazan : public BossAI
void JustEngagedWith(Unit*) override
{
scheduler.CancelGroup(GROUP_PHASE_2);
scheduler.Schedule(5ms, GROUP_PHASE_1, [this](TaskContext context)
_scheduler.CancelAll();
_scheduler.Schedule(5ms, GROUP_PHASE_1, [this](TaskContext context)
{
me->GetMotionMaster()->MovePoint(POINT_FLIGHT, NazanPos[urand(0, 2)], false);
scheduler.DelayAll(7s);
_scheduler.DelayAll(7s);
context.Repeat(30s);
}).Schedule(5s, GROUP_PHASE_1, [this](TaskContext context)
{
@@ -191,6 +187,7 @@ struct boss_nazan : public BossAI
{
if (param == ACTION_FLY_DOWN)
{
_scheduler.CancelGroup(GROUP_PHASE_1);
Talk(EMOTE_NAZAN);
me->SetReactState(REACT_PASSIVE);
me->InterruptNonMeleeSpells(true);
@@ -205,9 +202,8 @@ struct boss_nazan : public BossAI
me->SetCanFly(false);
me->SetDisableGravity(false);
me->SetReactState(REACT_AGGRESSIVE);
scheduler.CancelGroup(GROUP_PHASE_1);
me->GetMotionMaster()->MoveChase(me->GetVictim());
scheduler.Schedule(5s, GROUP_PHASE_2, [this](TaskContext context)
_scheduler.Schedule(5s, GROUP_PHASE_2, [this](TaskContext context)
{
DoCastVictim(SPELL_CONE_OF_FIRE);
context.Repeat(12s);
@@ -216,9 +212,10 @@ struct boss_nazan : public BossAI
DoCastRandomTarget(SPELL_FIREBALL);
context.Repeat(4s, 6s);
});
if (IsHeroic())
{
scheduler.Schedule(10s, GROUP_PHASE_2, [this](TaskContext context)
_scheduler.Schedule(10s, GROUP_PHASE_2, [this](TaskContext context)
{
DoCastSelf(SPELL_BELLOWING_ROAR);
context.Repeat(30s);
@@ -227,24 +224,28 @@ struct boss_nazan : public BossAI
}
}
void UpdateAI(uint32 /*diff*/) override
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
_scheduler.Update(diff, [this]
{
if (!me->IsLevitating())
DoMeleeAttackIfReady();
});
if (!me->IsLevitating())
DoMeleeAttackIfReady();
}
private:
TaskScheduler _scheduler;
};
struct boss_vazruden : public BossAI
struct boss_vazruden : public ScriptedAI
{
boss_vazruden(Creature* creature) : BossAI(creature, DATA_VAZRUDEN)
boss_vazruden(Creature* creature) : ScriptedAI(creature)
{
scheduler.SetValidator([this]
_scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
@@ -263,7 +264,7 @@ struct boss_vazruden : public BossAI
void JustEngagedWith(Unit*) override
{
scheduler.Schedule(5s, [this](TaskContext /*context*/)
_scheduler.Schedule(5s, [this](TaskContext /*context*/)
{
Talk(SAY_AGGRO);
}).Schedule(4s, [this](TaskContext context)
@@ -280,7 +281,7 @@ struct boss_vazruden : public BossAI
_hasSpoken = true;
Talk(SAY_KILL);
}
scheduler.Schedule(6s, [this](TaskContext /*context*/)
_scheduler.Schedule(6s, [this](TaskContext /*context*/)
{
_hasSpoken = false;
});
@@ -305,13 +306,16 @@ struct boss_vazruden : public BossAI
if (!UpdateVictim())
return;
scheduler.Update(diff);
DoMeleeAttackIfReady();
_scheduler.Update(diff, [this]
{
DoMeleeAttackIfReady();
});
}
private:
bool _hasSpoken;
bool _nazanCalled;
TaskScheduler _scheduler;
};
class spell_vazruden_fireball : public SpellScript