fix(Scripts/TheEye): make sure Al'ar does not melee during transitions (#18479)

* init

* Update boss_alar.cpp
This commit is contained in:
Dan
2024-03-04 13:13:33 +01:00
committed by GitHub
parent 1c8644b3bc
commit 2f2a4be72f

View File

@@ -109,6 +109,7 @@ struct boss_alar : public BossAI
_baseAttackOverride = false;
_spawnPhoenixes = false;
_platform = 0;
_noMelee = false;
_platformRoll = 0;
_noQuillTimes = 0;
_platformMoveRepeatTimer = 16s;
@@ -191,6 +192,7 @@ struct boss_alar : public BossAI
ScheduleUniqueTimedEvent(16001ms, [&]{
me->SetHealth(me->GetMaxHealth());
me->SetReactState(REACT_AGGRESSIVE);
_noMelee = false;
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
_platform = POINT_MIDDLE;
me->GetMotionMaster()->MoveChase(me->GetVictim());
@@ -201,6 +203,7 @@ struct boss_alar : public BossAI
void PretendToDie(Creature* creature)
{
_noMelee = true;
scheduler.CancelAll();
creature->InterruptNonMeleeSpells(true);
creature->RemoveAllAuras();
@@ -254,6 +257,7 @@ struct boss_alar : public BossAI
void DoDiveBomb()
{
_noMelee = true;
scheduler.Schedule(2s, [this](TaskContext)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 10.0f, true))
@@ -267,6 +271,7 @@ struct boss_alar : public BossAI
}).Schedule(10s, [this](TaskContext)
{
me->GetMotionMaster()->MoveChase(me->GetVictim());
_noMelee = false;
});
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 90.0f, true))
{
@@ -341,10 +346,31 @@ struct boss_alar : public BossAI
}
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
{
return;
}
scheduler.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
{
return;
}
if (!_noMelee)
{
DoMeleeAttackIfReady();
}
}
private:
bool _canAttackCooldown;
bool _baseAttackOverride;
bool _spawnPhoenixes;
bool _noMelee;
uint8 _platform;
uint8 _platformRoll;
uint8 _noQuillTimes;