chore(Scripts/ZulAman): Update Akilzon to new register method (#20556)
This commit is contained in:
@@ -57,217 +57,206 @@ enum Misc
|
|||||||
|
|
||||||
constexpr auto NPC_SOARING_EAGLE = 24858;
|
constexpr auto NPC_SOARING_EAGLE = 24858;
|
||||||
|
|
||||||
class boss_akilzon : public CreatureScript
|
struct boss_akilzon : public BossAI
|
||||||
{
|
{
|
||||||
public:
|
boss_akilzon(Creature* creature) : BossAI(creature, DATA_AKILZON), _stormCount(0), _isRaining(false) { }
|
||||||
boss_akilzon() : CreatureScript("boss_akilzon") { }
|
|
||||||
|
|
||||||
struct boss_akilzonAI : public BossAI
|
void Reset() override
|
||||||
{
|
{
|
||||||
boss_akilzonAI(Creature* creature) : BossAI(creature, DATA_AKILZON) { }
|
_Reset();
|
||||||
|
|
||||||
void Reset() override
|
_targetGUID.Clear();
|
||||||
{
|
_cloudGUID.Clear();
|
||||||
_Reset();
|
_cycloneGUID.Clear();
|
||||||
|
|
||||||
_targetGUID.Clear();
|
_stormCount = 0;
|
||||||
_cloudGUID.Clear();
|
_isRaining = false;
|
||||||
_cycloneGUID.Clear();
|
|
||||||
|
|
||||||
_stormCount = 0;
|
SetWeather(WEATHER_STATE_FINE, 0.0f);
|
||||||
_isRaining = false;
|
|
||||||
|
|
||||||
SetWeather(WEATHER_STATE_FINE, 0.0f);
|
me->m_Events.KillAllEvents(false);
|
||||||
|
}
|
||||||
|
|
||||||
me->m_Events.KillAllEvents(false);
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
}
|
{
|
||||||
|
_JustEngagedWith();
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
ScheduleTimedEvent(10s, 20s, [&] {
|
||||||
{
|
Unit* target = SelectTarget(SelectTargetMethod::Random, 1);
|
||||||
_JustEngagedWith();
|
if (!target)
|
||||||
|
target = me->GetVictim();
|
||||||
|
if (target)
|
||||||
|
{
|
||||||
|
_targetGUID = target->GetGUID();
|
||||||
|
DoCast(target, SPELL_STATIC_DISRUPTION, false);
|
||||||
|
me->SetInFront(me->GetVictim());
|
||||||
|
}
|
||||||
|
}, 10s, 18s);
|
||||||
|
|
||||||
ScheduleTimedEvent(10s, 20s, [&]{
|
ScheduleTimedEvent(20s, 30s, [&] {
|
||||||
Unit* target = SelectTarget(SelectTargetMethod::Random, 1);
|
Unit* target = SelectTarget(SelectTargetMethod::Random, 1);
|
||||||
if (!target)
|
if (!target)
|
||||||
target = me->GetVictim();
|
target = me->GetVictim();
|
||||||
if (target)
|
if (target)
|
||||||
{
|
DoCast(target, SPELL_GUST_OF_WIND);
|
||||||
_targetGUID = target->GetGUID();
|
}, 20s, 30s);
|
||||||
DoCast(target, SPELL_STATIC_DISRUPTION, false);
|
|
||||||
me->SetInFront(me->GetVictim());
|
|
||||||
}
|
|
||||||
}, 10s, 18s);
|
|
||||||
|
|
||||||
ScheduleTimedEvent(20s, 30s, [&] {
|
ScheduleTimedEvent(10s, 20s, [&] {
|
||||||
Unit* target = SelectTarget(SelectTargetMethod::Random, 1);
|
DoCastVictim(SPELL_CALL_LIGHTNING);
|
||||||
if (!target)
|
}, 12s, 17s);
|
||||||
target = me->GetVictim();
|
|
||||||
if (target)
|
|
||||||
DoCast(target, SPELL_GUST_OF_WIND);
|
|
||||||
}, 20s, 30s);
|
|
||||||
|
|
||||||
ScheduleTimedEvent(10s, 20s, [&] {
|
ScheduleTimedEvent(1min, [&] {
|
||||||
DoCastVictim(SPELL_CALL_LIGHTNING);
|
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50, true);
|
||||||
}, 12s, 17s);
|
if (!target)
|
||||||
|
{
|
||||||
|
EnterEvadeMode();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
target->CastSpell(target, SPELL_ELECTRICAL_STORM_AREA, true); // cloud visual
|
||||||
|
DoCast(target, SPELL_ELECTRICAL_STORM); // storm cyclon + visual
|
||||||
|
float x, y, z;
|
||||||
|
target->GetPosition(x, y, z);
|
||||||
|
|
||||||
ScheduleTimedEvent(1min, [&] {
|
Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ() + 16, 0, 15000);
|
||||||
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50, true);
|
if (Cloud)
|
||||||
if (!target)
|
{
|
||||||
{
|
target->GetMotionMaster()->MoveJump(Cloud->GetPosition(), 1.0f, 1.0f);
|
||||||
EnterEvadeMode();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
target->CastSpell(target, SPELL_ELECTRICAL_STORM_AREA, true); // cloud visual
|
|
||||||
DoCast(target, SPELL_ELECTRICAL_STORM); // storm cyclon + visual
|
|
||||||
float x, y, z;
|
|
||||||
target->GetPosition(x, y, z);
|
|
||||||
|
|
||||||
Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ() + 16, 0, 15000);
|
_cloudGUID = Cloud->GetGUID();
|
||||||
if (Cloud)
|
Cloud->SetDisableGravity(true);
|
||||||
{
|
Cloud->StopMoving();
|
||||||
target->GetMotionMaster()->MoveJump(Cloud->GetPosition(), 1.0f, 1.0f);
|
Cloud->SetObjectScale(1.0f);
|
||||||
|
Cloud->SetFaction(FACTION_FRIENDLY);
|
||||||
_cloudGUID = Cloud->GetGUID();
|
Cloud->SetMaxHealth(9999999);
|
||||||
Cloud->SetDisableGravity(true);
|
Cloud->SetHealth(9999999);
|
||||||
Cloud->StopMoving();
|
Cloud->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||||
Cloud->SetObjectScale(1.0f);
|
|
||||||
Cloud->SetFaction(FACTION_FRIENDLY);
|
|
||||||
Cloud->SetMaxHealth(9999999);
|
|
||||||
Cloud->SetHealth(9999999);
|
|
||||||
Cloud->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
|
||||||
|
|
||||||
me->m_Events.AddEventAtOffset([&] {
|
|
||||||
HandleStormSequence();
|
|
||||||
}, 3s);
|
|
||||||
}
|
|
||||||
|
|
||||||
_stormCount = 1;
|
|
||||||
|
|
||||||
me->m_Events.AddEventAtOffset([&] {
|
me->m_Events.AddEventAtOffset([&] {
|
||||||
if (!_isRaining)
|
HandleStormSequence();
|
||||||
{
|
}, 3s);
|
||||||
SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f);
|
}
|
||||||
_isRaining = true;
|
|
||||||
}
|
|
||||||
}, Seconds(urand(47, 52)));
|
|
||||||
}, 1min);
|
|
||||||
|
|
||||||
ScheduleTimedEvent(47s, 52s, [&] {
|
_stormCount = 1;
|
||||||
|
|
||||||
|
me->m_Events.AddEventAtOffset([&] {
|
||||||
if (!_isRaining)
|
if (!_isRaining)
|
||||||
{
|
{
|
||||||
SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f);
|
SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f);
|
||||||
_isRaining = true;
|
_isRaining = true;
|
||||||
}
|
}
|
||||||
}, 47s, 52s);
|
}, Seconds(urand(47, 52)));
|
||||||
|
}, 1min);
|
||||||
|
|
||||||
me->m_Events.AddEventAtOffset([&] {
|
ScheduleTimedEvent(47s, 52s, [&] {
|
||||||
Talk(SAY_ENRAGE);
|
if (!_isRaining)
|
||||||
DoCastSelf(SPELL_BERSERK, true);
|
|
||||||
}, 10min);
|
|
||||||
|
|
||||||
Talk(SAY_AGGRO);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JustDied(Unit* /*killer*/) override
|
|
||||||
{
|
|
||||||
Talk(SAY_DEATH);
|
|
||||||
_JustDied();
|
|
||||||
me->m_Events.KillAllEvents(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KilledUnit(Unit* who) override
|
|
||||||
{
|
|
||||||
if (who->IsPlayer())
|
|
||||||
Talk(SAY_KILL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetWeather(uint32 weather, float grade)
|
|
||||||
{
|
|
||||||
me->GetMap()->SetZoneWeather(me->GetZoneId(), WeatherState(weather), grade);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleStormSequence() // 1: begin, 2-9: tick, 10: end
|
|
||||||
{
|
|
||||||
Creature* Cloud = ObjectAccessor::GetCreature(*me, _cloudGUID);
|
|
||||||
if (!Cloud)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_stormCount > 10)
|
|
||||||
{
|
{
|
||||||
_stormCount = 0; // finish
|
SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f);
|
||||||
|
_isRaining = true;
|
||||||
me->m_Events.AddEventAtOffset([&] {
|
|
||||||
SummonEagles();
|
|
||||||
}, 5s);
|
|
||||||
|
|
||||||
me->InterruptNonMeleeSpells(false);
|
|
||||||
_cloudGUID.Clear();
|
|
||||||
if (Cloud)
|
|
||||||
Cloud->KillSelf();
|
|
||||||
SetWeather(WEATHER_STATE_FINE, 0.0f);
|
|
||||||
_isRaining = false;
|
|
||||||
}
|
}
|
||||||
|
}, 47s, 52s);
|
||||||
|
|
||||||
|
me->m_Events.AddEventAtOffset([&] {
|
||||||
|
Talk(SAY_ENRAGE);
|
||||||
|
DoCastSelf(SPELL_BERSERK, true);
|
||||||
|
}, 10min);
|
||||||
|
|
||||||
|
Talk(SAY_AGGRO);
|
||||||
|
}
|
||||||
|
|
||||||
|
void JustDied(Unit* /*killer*/) override
|
||||||
|
{
|
||||||
|
Talk(SAY_DEATH);
|
||||||
|
_JustDied();
|
||||||
|
me->m_Events.KillAllEvents(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KilledUnit(Unit* who) override
|
||||||
|
{
|
||||||
|
if (who->IsPlayer())
|
||||||
|
Talk(SAY_KILL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetWeather(uint32 weather, float grade)
|
||||||
|
{
|
||||||
|
me->GetMap()->SetZoneWeather(me->GetZoneId(), WeatherState(weather), grade);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleStormSequence() // 1: begin, 2-9: tick, 10: end
|
||||||
|
{
|
||||||
|
Creature* Cloud = ObjectAccessor::GetCreature(*me, _cloudGUID);
|
||||||
|
if (!Cloud)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_stormCount > 10)
|
||||||
|
{
|
||||||
|
_stormCount = 0; // finish
|
||||||
|
|
||||||
me->m_Events.AddEventAtOffset([&] {
|
me->m_Events.AddEventAtOffset([&] {
|
||||||
Unit* target = ObjectAccessor::GetUnit(*me, _cloudGUID);
|
SummonEagles();
|
||||||
if (!target || !target->IsAlive())
|
}, 5s);
|
||||||
return;
|
|
||||||
else if (Unit* Cyclone = ObjectAccessor::GetUnit(*me, _cycloneGUID))
|
me->InterruptNonMeleeSpells(false);
|
||||||
Cyclone->CastSpell(target, SPELL_SAND_STORM, true); // keep casting or...
|
_cloudGUID.Clear();
|
||||||
HandleStormSequence();
|
if (Cloud)
|
||||||
}, 1s);
|
Cloud->KillSelf();
|
||||||
|
SetWeather(WEATHER_STATE_FINE, 0.0f);
|
||||||
|
_isRaining = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoAction(int32 actionId) override
|
me->m_Events.AddEventAtOffset([&] {
|
||||||
|
Unit* target = ObjectAccessor::GetUnit(*me, _cloudGUID);
|
||||||
|
if (!target || !target->IsAlive())
|
||||||
|
return;
|
||||||
|
else if (Unit* Cyclone = ObjectAccessor::GetUnit(*me, _cycloneGUID))
|
||||||
|
Cyclone->CastSpell(target, SPELL_SAND_STORM, true); // keep casting or...
|
||||||
|
HandleStormSequence();
|
||||||
|
}, 1s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoAction(int32 actionId) override
|
||||||
|
{
|
||||||
|
if (actionId == ACTION_INCREASE_STORM_COUNT)
|
||||||
|
++_stormCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SummonEagles()
|
||||||
|
{
|
||||||
|
Talk(SAY_SUMMON);
|
||||||
|
|
||||||
|
float x, y, z;
|
||||||
|
me->GetPosition(x, y, z);
|
||||||
|
|
||||||
|
for (uint8 i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
if (actionId == ACTION_INCREASE_STORM_COUNT)
|
Unit* bird = ObjectAccessor::GetUnit(*me, _birdGUIDs[i]);
|
||||||
++_stormCount;
|
if (!bird) //they despawned on die
|
||||||
}
|
|
||||||
|
|
||||||
void SummonEagles()
|
|
||||||
{
|
|
||||||
Talk(SAY_SUMMON);
|
|
||||||
|
|
||||||
float x, y, z;
|
|
||||||
me->GetPosition(x, y, z);
|
|
||||||
|
|
||||||
for (uint8 i = 0; i < 8; ++i)
|
|
||||||
{
|
{
|
||||||
Unit* bird = ObjectAccessor::GetUnit(*me, _birdGUIDs[i]);
|
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
|
||||||
if (!bird) //they despawned on die
|
|
||||||
{
|
{
|
||||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
|
x = target->GetPositionX() + irand(-10, 10);
|
||||||
{
|
y = target->GetPositionY() + irand(-10, 10);
|
||||||
x = target->GetPositionX() + irand(-10, 10);
|
z = target->GetPositionZ() + urand(16, 20);
|
||||||
y = target->GetPositionY() + irand(-10, 10);
|
if (z > 95)
|
||||||
z = target->GetPositionZ() + urand(16, 20);
|
z = 95.0f - urand(0, 5);
|
||||||
if (z > 95)
|
}
|
||||||
z = 95.0f - urand(0, 5);
|
;
|
||||||
}
|
if (Creature* creature = me->SummonCreature(NPC_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0))
|
||||||
;
|
{
|
||||||
if (Creature* creature = me->SummonCreature(NPC_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0))
|
creature->AddThreat(me->GetVictim(), 1.0f);
|
||||||
{
|
creature->AI()->AttackStart(me->GetVictim());
|
||||||
creature->AddThreat(me->GetVictim(), 1.0f);
|
_birdGUIDs[i] = creature->GetGUID();
|
||||||
creature->AI()->AttackStart(me->GetVictim());
|
|
||||||
_birdGUIDs[i] = creature->GetGUID();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
ObjectGuid _birdGUIDs[8];
|
|
||||||
ObjectGuid _targetGUID;
|
|
||||||
ObjectGuid _cycloneGUID;
|
|
||||||
ObjectGuid _cloudGUID;
|
|
||||||
uint8 _stormCount;
|
|
||||||
bool _isRaining;
|
|
||||||
};
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
|
||||||
return GetZulAmanAI<boss_akilzonAI>(creature);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ObjectGuid _birdGUIDs[8];
|
||||||
|
ObjectGuid _targetGUID;
|
||||||
|
ObjectGuid _cycloneGUID;
|
||||||
|
ObjectGuid _cloudGUID;
|
||||||
|
uint8 _stormCount;
|
||||||
|
bool _isRaining;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct npc_akilzon_eagle : public ScriptedAI
|
struct npc_akilzon_eagle : public ScriptedAI
|
||||||
@@ -364,7 +353,7 @@ class spell_electrial_storm : public AuraScript
|
|||||||
|
|
||||||
void AddSC_boss_akilzon()
|
void AddSC_boss_akilzon()
|
||||||
{
|
{
|
||||||
new boss_akilzon();
|
RegisterZulAmanCreatureAI(boss_akilzon);
|
||||||
RegisterZulAmanCreatureAI(npc_akilzon_eagle);
|
RegisterZulAmanCreatureAI(npc_akilzon_eagle);
|
||||||
RegisterSpellScript(spell_electrial_storm);
|
RegisterSpellScript(spell_electrial_storm);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user