refactor(Scripts/World): Clean up script files (#17728)
* refactor(Scripts/World): Clean up script files * Update boss_azuregos.cpp
This commit is contained in:
@@ -54,15 +54,15 @@ public:
|
|||||||
{
|
{
|
||||||
boss_azuregosAI(Creature* creature) : ScriptedAI(creature)
|
boss_azuregosAI(Creature* creature) : ScriptedAI(creature)
|
||||||
{
|
{
|
||||||
_scheduler.SetValidator([this]
|
scheduler.SetValidator([this]
|
||||||
{
|
{
|
||||||
return !me->HasUnitState(UNIT_STATE_CASTING);
|
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
_scheduler.CancelAll();
|
scheduler.CancelAll();
|
||||||
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||||
me->RestoreFaction();
|
me->RestoreFaction();
|
||||||
me->GetMap()->DoForAllPlayers([&](Player* p)
|
me->GetMap()->DoForAllPlayers([&](Player* p)
|
||||||
@@ -89,7 +89,7 @@ public:
|
|||||||
DoCastSelf(SPELL_MARK_OF_FROST_AURA);
|
DoCastSelf(SPELL_MARK_OF_FROST_AURA);
|
||||||
Talk(SAY_AGGRO);
|
Talk(SAY_AGGRO);
|
||||||
|
|
||||||
_scheduler
|
scheduler
|
||||||
.Schedule(7s, [this](TaskContext context)
|
.Schedule(7s, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
DoCastVictim(SPELL_CLEAVE);
|
DoCastVictim(SPELL_CLEAVE);
|
||||||
@@ -149,14 +149,11 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_scheduler.Update(diff, [this]
|
scheduler.Update(diff, [this]
|
||||||
{
|
{
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
TaskScheduler _scheduler;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/) override
|
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/) override
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
_scheduler.CancelAll();
|
scheduler.CancelAll();
|
||||||
_inBerserk = false;
|
_inBerserk = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
void JustEngagedWith(Unit* /*who*/) override
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
{
|
{
|
||||||
Talk(SAY_AGGRO);
|
Talk(SAY_AGGRO);
|
||||||
_scheduler.Schedule(6s, 10s, [this](TaskContext context)
|
scheduler.Schedule(6s, 10s, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
DoCastVictim(SPELL_SHADOW_VOLLEY);
|
DoCastVictim(SPELL_SHADOW_VOLLEY);
|
||||||
context.Repeat(4s, 6s);
|
context.Repeat(4s, 6s);
|
||||||
@@ -132,7 +132,7 @@ public:
|
|||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_scheduler.Update(diff);
|
scheduler.Update(diff);
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -140,7 +140,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskScheduler _scheduler;
|
|
||||||
bool _inBerserk;
|
bool _inBerserk;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
_inEnrage = false;
|
_inEnrage = false;
|
||||||
_scheduler.CancelAll();
|
scheduler.CancelAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KilledUnit(Unit* victim) override
|
void KilledUnit(Unit* victim) override
|
||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
void JustEngagedWith(Unit* /*who*/) override
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
{
|
{
|
||||||
Talk(SAY_AGGRO);
|
Talk(SAY_AGGRO);
|
||||||
_scheduler.Schedule(1ms, [this](TaskContext context)
|
scheduler.Schedule(1ms, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
if (!HealthAbovePct(20))
|
if (!HealthAbovePct(20))
|
||||||
{
|
{
|
||||||
@@ -129,7 +129,7 @@ public:
|
|||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_scheduler.Update(diff);
|
scheduler.Update(diff);
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -137,7 +137,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskScheduler _scheduler;
|
|
||||||
bool _inEnrage;
|
bool _inEnrage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -193,9 +193,9 @@ public:
|
|||||||
|
|
||||||
void ScheduleEvents()
|
void ScheduleEvents()
|
||||||
{
|
{
|
||||||
_scheduler.CancelAll();
|
scheduler.CancelAll();
|
||||||
|
|
||||||
_scheduler.Schedule(1s, [this](TaskContext context)
|
scheduler.Schedule(1s, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
// Chase target, but don't attack - otherwise just roam around
|
// Chase target, but don't attack - otherwise just roam around
|
||||||
if (Unit* chaseTarget = GetRandomUnitFromDragonThreatList())
|
if (Unit* chaseTarget = GetRandomUnitFromDragonThreatList())
|
||||||
@@ -251,13 +251,12 @@ public:
|
|||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_scheduler.Update(diff);
|
scheduler.Update(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ObjectGuid _targetGUID;
|
ObjectGuid _targetGUID;
|
||||||
ObjectGuid _dragonGUID;
|
ObjectGuid _dragonGUID;
|
||||||
TaskScheduler _scheduler;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
CreatureAI* GetAI(Creature* creature) const override
|
||||||
|
|||||||
Reference in New Issue
Block a user