fix(Scripts/HellfireRamparts): Fix Nazan not casting abilities (#16598)
This commit is contained in:
+31
-27
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
|
#include "TaskScheduler.h"
|
||||||
#include "hellfire_ramparts.h"
|
#include "hellfire_ramparts.h"
|
||||||
|
|
||||||
enum Says
|
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
|
void MovementInform(uint32 type, uint32 id) override
|
||||||
{
|
{
|
||||||
if (type == POINT_MOTION_TYPE && id == POINT_MIDDLE)
|
if (type == POINT_MOTION_TYPE && id == POINT_MIDDLE)
|
||||||
@@ -105,7 +101,7 @@ struct boss_vazruden_the_herald : public BossAI
|
|||||||
{
|
{
|
||||||
Talk(SAY_INTRO);
|
Talk(SAY_INTRO);
|
||||||
me->GetMotionMaster()->MovePoint(POINT_MIDDLE, -1406.5f, 1746.5f, 85.0f, false);
|
me->GetMotionMaster()->MovePoint(POINT_MIDDLE, -1406.5f, 1746.5f, 85.0f, false);
|
||||||
me->setActive(true);
|
_JustEngagedWith();
|
||||||
}
|
}
|
||||||
else if (summons.size() == 0)
|
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);
|
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||||
});
|
});
|
||||||
@@ -162,11 +158,11 @@ struct boss_nazan : public BossAI
|
|||||||
|
|
||||||
void JustEngagedWith(Unit*) override
|
void JustEngagedWith(Unit*) override
|
||||||
{
|
{
|
||||||
scheduler.CancelGroup(GROUP_PHASE_2);
|
_scheduler.CancelAll();
|
||||||
scheduler.Schedule(5ms, GROUP_PHASE_1, [this](TaskContext context)
|
_scheduler.Schedule(5ms, GROUP_PHASE_1, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
me->GetMotionMaster()->MovePoint(POINT_FLIGHT, NazanPos[urand(0, 2)], false);
|
me->GetMotionMaster()->MovePoint(POINT_FLIGHT, NazanPos[urand(0, 2)], false);
|
||||||
scheduler.DelayAll(7s);
|
_scheduler.DelayAll(7s);
|
||||||
context.Repeat(30s);
|
context.Repeat(30s);
|
||||||
}).Schedule(5s, GROUP_PHASE_1, [this](TaskContext context)
|
}).Schedule(5s, GROUP_PHASE_1, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
@@ -191,6 +187,7 @@ struct boss_nazan : public BossAI
|
|||||||
{
|
{
|
||||||
if (param == ACTION_FLY_DOWN)
|
if (param == ACTION_FLY_DOWN)
|
||||||
{
|
{
|
||||||
|
_scheduler.CancelGroup(GROUP_PHASE_1);
|
||||||
Talk(EMOTE_NAZAN);
|
Talk(EMOTE_NAZAN);
|
||||||
me->SetReactState(REACT_PASSIVE);
|
me->SetReactState(REACT_PASSIVE);
|
||||||
me->InterruptNonMeleeSpells(true);
|
me->InterruptNonMeleeSpells(true);
|
||||||
@@ -205,9 +202,8 @@ struct boss_nazan : public BossAI
|
|||||||
me->SetCanFly(false);
|
me->SetCanFly(false);
|
||||||
me->SetDisableGravity(false);
|
me->SetDisableGravity(false);
|
||||||
me->SetReactState(REACT_AGGRESSIVE);
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
scheduler.CancelGroup(GROUP_PHASE_1);
|
|
||||||
me->GetMotionMaster()->MoveChase(me->GetVictim());
|
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);
|
DoCastVictim(SPELL_CONE_OF_FIRE);
|
||||||
context.Repeat(12s);
|
context.Repeat(12s);
|
||||||
@@ -216,9 +212,10 @@ struct boss_nazan : public BossAI
|
|||||||
DoCastRandomTarget(SPELL_FIREBALL);
|
DoCastRandomTarget(SPELL_FIREBALL);
|
||||||
context.Repeat(4s, 6s);
|
context.Repeat(4s, 6s);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (IsHeroic())
|
if (IsHeroic())
|
||||||
{
|
{
|
||||||
scheduler.Schedule(10s, GROUP_PHASE_2, [this](TaskContext context)
|
_scheduler.Schedule(10s, GROUP_PHASE_2, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
DoCastSelf(SPELL_BELLOWING_ROAR);
|
DoCastSelf(SPELL_BELLOWING_ROAR);
|
||||||
context.Repeat(30s);
|
context.Repeat(30s);
|
||||||
@@ -227,24 +224,28 @@ struct boss_nazan : public BossAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(uint32 /*diff*/) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
_scheduler.Update(diff, [this]
|
||||||
return;
|
{
|
||||||
|
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);
|
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||||
});
|
});
|
||||||
@@ -263,7 +264,7 @@ struct boss_vazruden : public BossAI
|
|||||||
|
|
||||||
void JustEngagedWith(Unit*) override
|
void JustEngagedWith(Unit*) override
|
||||||
{
|
{
|
||||||
scheduler.Schedule(5s, [this](TaskContext /*context*/)
|
_scheduler.Schedule(5s, [this](TaskContext /*context*/)
|
||||||
{
|
{
|
||||||
Talk(SAY_AGGRO);
|
Talk(SAY_AGGRO);
|
||||||
}).Schedule(4s, [this](TaskContext context)
|
}).Schedule(4s, [this](TaskContext context)
|
||||||
@@ -280,7 +281,7 @@ struct boss_vazruden : public BossAI
|
|||||||
_hasSpoken = true;
|
_hasSpoken = true;
|
||||||
Talk(SAY_KILL);
|
Talk(SAY_KILL);
|
||||||
}
|
}
|
||||||
scheduler.Schedule(6s, [this](TaskContext /*context*/)
|
_scheduler.Schedule(6s, [this](TaskContext /*context*/)
|
||||||
{
|
{
|
||||||
_hasSpoken = false;
|
_hasSpoken = false;
|
||||||
});
|
});
|
||||||
@@ -305,13 +306,16 @@ struct boss_vazruden : public BossAI
|
|||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scheduler.Update(diff);
|
_scheduler.Update(diff, [this]
|
||||||
DoMeleeAttackIfReady();
|
{
|
||||||
|
DoMeleeAttackIfReady();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _hasSpoken;
|
bool _hasSpoken;
|
||||||
bool _nazanCalled;
|
bool _nazanCalled;
|
||||||
|
TaskScheduler _scheduler;
|
||||||
};
|
};
|
||||||
|
|
||||||
class spell_vazruden_fireball : public SpellScript
|
class spell_vazruden_fireball : public SpellScript
|
||||||
|
|||||||
Reference in New Issue
Block a user