diff options
author | offl <11556157+offl@users.noreply.github.com> | 2022-02-13 22:33:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-13 22:33:23 +0200 |
commit | 93735ae3bd926d13cff43ffce1f0640a2693649f (patch) | |
tree | a6e755d9d40f5f059006cb3f56002ec5c170d207 /src | |
parent | 5e3b76bf25eb88021f7a79c2ecfe7f768926c110 (diff) |
Scripts/TK: Update remaining scripts to new register model 2 (#27768)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp | 758 | ||||
-rw-r--r-- | src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp | 717 |
2 files changed, 703 insertions, 772 deletions
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 601073bc051..d65918dc117 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -104,483 +104,449 @@ uint32 const flameQuillsSpells[] = 34316 }; -class boss_alar : public CreatureScript +struct boss_alar : public BossAI { - public: - boss_alar() : CreatureScript("boss_alar") { } + boss_alar(Creature* creature) : BossAI(creature, DATA_ALAR) + { + Initialize(); + DefaultMoveSpeedRate = creature->GetSpeedRate(MOVE_RUN); + DiveBomb_Timer = 0; + MeltArmor_Timer = 0; + Charge_Timer = 0; + FlamePatch_Timer = 0; + } - struct boss_alarAI : public BossAI - { - boss_alarAI(Creature* creature) : BossAI(creature, DATA_ALAR) - { - Initialize(); - DefaultMoveSpeedRate = creature->GetSpeedRate(MOVE_RUN); - DiveBomb_Timer = 0; - MeltArmor_Timer = 0; - Charge_Timer = 0; - FlamePatch_Timer = 0; - } + void Initialize() + { + Berserk_Timer = 1200000; + Platforms_Move_Timer = 0; - void Initialize() - { - Berserk_Timer = 1200000; - Platforms_Move_Timer = 0; + Phase1 = true; + WaitEvent = WE_NONE; + WaitTimer = 0; + AfterMoving = false; + ForceMove = false; + ForceTimer = 5000; - Phase1 = true; - WaitEvent = WE_NONE; - WaitTimer = 0; - AfterMoving = false; - ForceMove = false; - ForceTimer = 5000; + cur_wp = 4; + } - cur_wp = 4; - } + WaitEventType WaitEvent; + uint32 WaitTimer; - WaitEventType WaitEvent; - uint32 WaitTimer; + bool AfterMoving; - bool AfterMoving; + uint32 Platforms_Move_Timer; + uint32 DiveBomb_Timer; + uint32 MeltArmor_Timer; + uint32 Charge_Timer; + uint32 FlamePatch_Timer; + uint32 Berserk_Timer; - uint32 Platforms_Move_Timer; - uint32 DiveBomb_Timer; - uint32 MeltArmor_Timer; - uint32 Charge_Timer; - uint32 FlamePatch_Timer; - uint32 Berserk_Timer; + float DefaultMoveSpeedRate; - float DefaultMoveSpeedRate; + bool Phase1; + bool ForceMove; + uint32 ForceTimer; - bool Phase1; - bool ForceMove; - uint32 ForceTimer; + int8 cur_wp; - int8 cur_wp; + void Reset() override + { + Initialize(); + _Reset(); + + me->SetDisplayId(me->GetNativeDisplayId()); + me->SetSpeedRate(MOVE_RUN, DefaultMoveSpeedRate); + //me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); + //me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); + me->SetDisableGravity(true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setActive(false); + } - void Reset() override - { - Initialize(); - _Reset(); - - me->SetDisplayId(me->GetNativeDisplayId()); - me->SetSpeedRate(MOVE_RUN, DefaultMoveSpeedRate); - //me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); - //me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); - me->SetDisableGravity(true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setActive(false); - } + void JustEngagedWith(Unit* who) override + { + BossAI::JustEngagedWith(who); + me->SetDisableGravity(true); // after enterevademode will be set walk movement + me->setActive(true); + } - void JustEngagedWith(Unit* who) override - { - BossAI::JustEngagedWith(who); - me->SetDisableGravity(true); // after enterevademode will be set walk movement - me->setActive(true); - } + void JustSummoned(Creature* summon) override + { + if (summon->GetEntry() == CREATURE_EMBER_OF_ALAR) + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) + summon->AI()->AttackStart(target); + } - void JustSummoned(Creature* summon) override - { - if (summon->GetEntry() == CREATURE_EMBER_OF_ALAR) - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - summon->AI()->AttackStart(target); - } + void MoveInLineOfSight(Unit* /*who*/) override { } - void MoveInLineOfSight(Unit* /*who*/) override { } + void AttackStart(Unit* who) override + { + if (Phase1) + AttackStartNoMove(who); + else + ScriptedAI::AttackStart(who); + } - void AttackStart(Unit* who) override + void DamageTaken(Unit* /*killer*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override + { + if (damage >= me->GetHealth() && Phase1) + { + damage = 0; + if (!WaitEvent) { - if (Phase1) - AttackStartNoMove(who); - else - ScriptedAI::AttackStart(who); + WaitEvent = WE_DIE; + WaitTimer = 0; + me->SetHealth(0); + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->AttackStop(); + me->SetTarget(ObjectGuid::Empty); + me->SetSpeedRate(MOVE_RUN, 5.0f); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(0, waypoint[5][0], waypoint[5][1], waypoint[5][2]); } + } + } - void DamageTaken(Unit* /*killer*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override - { - if (damage >= me->GetHealth() && Phase1) - { - damage = 0; - if (!WaitEvent) - { - WaitEvent = WE_DIE; - WaitTimer = 0; - me->SetHealth(0); - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->AttackStop(); - me->SetTarget(ObjectGuid::Empty); - me->SetSpeedRate(MOVE_RUN, 5.0f); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0, waypoint[5][0], waypoint[5][1], waypoint[5][2]); - } - } - } + void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override + { + if (spellInfo->Id == SPELL_DIVE_BOMB_VISUAL) + { + me->SetDisplayId(11686); + //me->SendUpdateObjectToAllExcept(nullptr); + } + } - void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override - { - if (spellInfo->Id == SPELL_DIVE_BOMB_VISUAL) - { - me->SetDisplayId(11686); - //me->SendUpdateObjectToAllExcept(nullptr); - } - } + void MovementInform(uint32 type, uint32 /*id*/) override + { + if (type == POINT_MOTION_TYPE) + { + WaitTimer = 1; + AfterMoving = true; + ForceMove = false; + } + } + + void UpdateAI(uint32 diff) override + { + if (!me->IsEngaged()) + return; + + if (Berserk_Timer <= diff) + { + DoCast(me, SPELL_BERSERK, true); + Berserk_Timer = 60000; + } + else + Berserk_Timer -= diff; - void MovementInform(uint32 type, uint32 /*id*/) override + if (ForceMove) + { + if (ForceTimer <= diff) { - if (type == POINT_MOTION_TYPE) - { - WaitTimer = 1; - AfterMoving = true; - ForceMove = false; - } + me->GetMotionMaster()->MovePoint(0, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]); + ForceTimer = 5000; } + else + ForceTimer -= diff; - void UpdateAI(uint32 diff) override + } + if (WaitEvent) + { + if (WaitTimer) { - if (!me->IsEngaged()) - return; - - if (Berserk_Timer <= diff) - { - DoCast(me, SPELL_BERSERK, true); - Berserk_Timer = 60000; - } - else - Berserk_Timer -= diff; - - if (ForceMove) - { - if (ForceTimer <= diff) - { - me->GetMotionMaster()->MovePoint(0, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]); - ForceTimer = 5000; - } - else - ForceTimer -= diff; - - } - if (WaitEvent) + if (WaitTimer <= diff) { - if (WaitTimer) + if (AfterMoving) { - if (WaitTimer <= diff) - { - if (AfterMoving) - { - me->GetMotionMaster()->MoveIdle(); - AfterMoving = false; - } - - switch (WaitEvent) - { - case WE_PLATFORM: - Platforms_Move_Timer = 30000 + rand32() % 5000; - break; - case WE_QUILL: - DoCast(me, SPELL_FLAME_QUILLS, true); - Platforms_Move_Timer = 1; - WaitTimer = 10000; - WaitEvent = WE_DUMMY; - return; - case WE_DIE: - ForceMove = false; - me->SetStandState(UNIT_STAND_STATE_DEAD); - WaitTimer = 5000; - WaitEvent = WE_REVIVE; - return; - case WE_REVIVE: - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetFullHealth(); - me->SetSpeedRate(MOVE_RUN, DefaultMoveSpeedRate); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - DoZoneInCombat(); - DoCast(me, SPELL_REBIRTH, true); - MeltArmor_Timer = 60000; - Charge_Timer = 7000; - DiveBomb_Timer = 40000 + rand32() % 5000; - FlamePatch_Timer = 30000; - Phase1 = false; - break; - case WE_METEOR: - DoCast(me, SPELL_DIVE_BOMB_VISUAL, false); - WaitEvent = WE_DIVE; - WaitTimer = 4000; - return; - case WE_DIVE: - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - { - me->RemoveAurasDueToSpell(SPELL_DIVE_BOMB_VISUAL); - DoCast(target, SPELL_DIVE_BOMB, true); - float dist = 3.0f; - if (me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f)) - dist = 5.0f; - WaitTimer = 1000 + uint32(floor(dist / 80 * 1000.0f)); - me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f); - me->StopMoving(); - WaitEvent = WE_LAND; - return; - } - else - { - EnterEvadeMode(); - return; - } - case WE_LAND: - WaitEvent = WE_SUMMON; - WaitTimer = 2000; - return; - case WE_SUMMON: - for (uint8 i = 0; i < 2; ++i) - DoSpawnCreature(CREATURE_EMBER_OF_ALAR, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5s); - me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); - me->SetDisplayId(me->GetNativeDisplayId()); - DoCast(me, SPELL_REBIRTH_2, true); - break; - case WE_DUMMY: - default: - break; - } - - WaitEvent = WE_NONE; - WaitTimer = 0; - } - else - WaitTimer -= diff; + me->GetMotionMaster()->MoveIdle(); + AfterMoving = false; } - return; - } - if (Phase1) - { - if (!me->IsThreatened()) + switch (WaitEvent) { - EnterEvadeMode(); + case WE_PLATFORM: + Platforms_Move_Timer = 30000 + rand32() % 5000; + break; + case WE_QUILL: + DoCast(me, SPELL_FLAME_QUILLS, true); + Platforms_Move_Timer = 1; + WaitTimer = 10000; + WaitEvent = WE_DUMMY; return; - } - - if (Platforms_Move_Timer <= diff) - { - if (cur_wp == 4) - { - cur_wp = 0; - WaitEvent = WE_PLATFORM; - } - else - { - if (urand(0, 4)) // next platform - { - DoSpawnCreature(CREATURE_EMBER_OF_ALAR, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5s); - if (cur_wp == 3) - cur_wp = 0; - else - ++cur_wp; - WaitEvent = WE_PLATFORM; - } - else // flame quill - { - cur_wp = 4; - WaitEvent = WE_QUILL; - } - } - ForceMove = true; - ForceTimer = 5000; - me->GetMotionMaster()->MovePoint(0, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]); - WaitTimer = 0; + case WE_DIE: + ForceMove = false; + me->SetStandState(UNIT_STAND_STATE_DEAD); + WaitTimer = 5000; + WaitEvent = WE_REVIVE; return; - } - else - Platforms_Move_Timer -= diff; - } - else - { - if (Charge_Timer <= diff) - { - Unit* target= SelectTarget(SelectTargetMethod::Random, 1, 100, true); - if (target) - DoCast(target, SPELL_CHARGE); - Charge_Timer = 30000; - } - else - Charge_Timer -= diff; - - if (MeltArmor_Timer <= diff) - { - DoCastVictim(SPELL_MELT_ARMOR); + case WE_REVIVE: + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetFullHealth(); + me->SetSpeedRate(MOVE_RUN, DefaultMoveSpeedRate); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + DoZoneInCombat(); + DoCast(me, SPELL_REBIRTH, true); MeltArmor_Timer = 60000; - } - else - MeltArmor_Timer -= diff; - - if (DiveBomb_Timer <= diff) - { - me->AttackStop(); - me->GetMotionMaster()->MovePoint(6, waypoint[4][0], waypoint[4][1], waypoint[4][2]); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); - me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 50); - WaitEvent = WE_METEOR; - WaitTimer = 0; + Charge_Timer = 7000; DiveBomb_Timer = 40000 + rand32() % 5000; + FlamePatch_Timer = 30000; + Phase1 = false; + break; + case WE_METEOR: + DoCast(me, SPELL_DIVE_BOMB_VISUAL, false); + WaitEvent = WE_DIVE; + WaitTimer = 4000; return; - } - else - DiveBomb_Timer -= diff; - - if (FlamePatch_Timer <= diff) - { + case WE_DIVE: if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) { - Creature* Summoned = me->SummonCreature(CREATURE_FLAME_PATCH_ALAR, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2min); - if (Summoned) - { - Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); - Summoned->SetObjectScale(Summoned->GetObjectScale() * 2.5f); - Summoned->SetDisplayId(11686); - Summoned->SetFaction(me->GetFaction()); - Summoned->SetLevel(me->GetLevel()); - Summoned->CastSpell(Summoned, SPELL_FLAME_PATCH, false); - } + me->RemoveAurasDueToSpell(SPELL_DIVE_BOMB_VISUAL); + DoCast(target, SPELL_DIVE_BOMB, true); + float dist = 3.0f; + if (me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f)) + dist = 5.0f; + WaitTimer = 1000 + uint32(floor(dist / 80 * 1000.0f)); + me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f); + me->StopMoving(); + WaitEvent = WE_LAND; + return; } - FlamePatch_Timer = 30000; + else + { + EnterEvadeMode(); + return; + } + case WE_LAND: + WaitEvent = WE_SUMMON; + WaitTimer = 2000; + return; + case WE_SUMMON: + for (uint8 i = 0; i < 2; ++i) + DoSpawnCreature(CREATURE_EMBER_OF_ALAR, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5s); + me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); + me->SetDisplayId(me->GetNativeDisplayId()); + DoCast(me, SPELL_REBIRTH_2, true); + break; + case WE_DUMMY: + default: + break; } - else - FlamePatch_Timer -= diff; + + WaitEvent = WE_NONE; + WaitTimer = 0; } + else + WaitTimer -= diff; + } + return; + } - DoMeleeAttackIfReady(); + if (Phase1) + { + if (!me->IsThreatened()) + { + EnterEvadeMode(); + return; } - void DoMeleeAttackIfReady() + if (Platforms_Move_Timer <= diff) { - if (me->isAttackReady() && !me->IsNonMeleeSpellCast(false)) + if (cur_wp == 4) { - if (me->IsWithinMeleeRange(me->GetVictim())) + cur_wp = 0; + WaitEvent = WE_PLATFORM; + } + else + { + if (urand(0, 4)) // next platform { - me->AttackerStateUpdate(me->GetVictim()); - me->resetAttackTimer(); + DoSpawnCreature(CREATURE_EMBER_OF_ALAR, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5s); + if (cur_wp == 3) + cur_wp = 0; + else + ++cur_wp; + WaitEvent = WE_PLATFORM; } - else + else // flame quill { - if (Unit* target = me->SelectNearestTargetInAttackDistance(5)) - AttackStart(target); - else - { - DoCast(me, SPELL_FLAME_BUFFET, true); - me->setAttackTimer(BASE_ATTACK, 1500); - } + cur_wp = 4; + WaitEvent = WE_QUILL; } } + ForceMove = true; + ForceTimer = 5000; + me->GetMotionMaster()->MovePoint(0, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]); + WaitTimer = 0; + return; } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return GetTheEyeAI<boss_alarAI>(creature); + else + Platforms_Move_Timer -= diff; } -}; - -class npc_ember_of_alar : public CreatureScript -{ - public: - npc_ember_of_alar() : CreatureScript("npc_ember_of_alar") { } - - struct npc_ember_of_alarAI : public ScriptedAI + else { - npc_ember_of_alarAI(Creature* creature) : ScriptedAI(creature) + if (Charge_Timer <= diff) { - Initialize(); - instance = creature->GetInstanceScript(); - creature->SetDisableGravity(true); + Unit* target= SelectTarget(SelectTargetMethod::Random, 1, 100, true); + if (target) + DoCast(target, SPELL_CHARGE); + Charge_Timer = 30000; } + else + Charge_Timer -= diff; - void Initialize() + if (MeltArmor_Timer <= diff) { - toDie = false; + DoCastVictim(SPELL_MELT_ARMOR); + MeltArmor_Timer = 60000; } + else + MeltArmor_Timer -= diff; - InstanceScript* instance; - bool toDie; - - void Reset() override + if (DiveBomb_Timer <= diff) { - Initialize(); + me->AttackStop(); + me->GetMotionMaster()->MovePoint(6, waypoint[4][0], waypoint[4][1], waypoint[4][2]); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); + me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 50); + WaitEvent = WE_METEOR; + WaitTimer = 0; + DiveBomb_Timer = 40000 + rand32() % 5000; + return; } + else + DiveBomb_Timer -= diff; - void JustEngagedWith(Unit* /*who*/) override + if (FlamePatch_Timer <= diff) { - DoZoneInCombat(); + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) + { + Creature* Summoned = me->SummonCreature(CREATURE_FLAME_PATCH_ALAR, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2min); + if (Summoned) + { + Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); + Summoned->SetObjectScale(Summoned->GetObjectScale() * 2.5f); + Summoned->SetDisplayId(11686); + Summoned->SetFaction(me->GetFaction()); + Summoned->SetLevel(me->GetLevel()); + Summoned->CastSpell(Summoned, SPELL_FLAME_PATCH, false); + } + } + FlamePatch_Timer = 30000; } + else + FlamePatch_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } - void EnterEvadeMode(EvadeReason /*why*/) override + void DoMeleeAttackIfReady() + { + if (me->isAttackReady() && !me->IsNonMeleeSpellCast(false)) + { + if (me->IsWithinMeleeRange(me->GetVictim())) { - me->setDeathState(JUST_DIED); + me->AttackerStateUpdate(me->GetVictim()); + me->resetAttackTimer(); } - - void DamageTaken(Unit* killer, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override + else { - if (damage >= me->GetHealth() && killer != me && !toDie) + if (Unit* target = me->SelectNearestTargetInAttackDistance(5)) + AttackStart(target); + else { - damage = 0; - DoCast(me, SPELL_EMBER_BLAST, true); - me->SetDisplayId(11686); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); - if (instance->GetBossState(DATA_ALAR) == IN_PROGRESS) - { - if (Unit* Alar = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ALAR))) - { - int32 AlarHealth = int32(Alar->GetHealth()) - int32(Alar->CountPctFromMaxHealth(3)); - if (AlarHealth > 0) - Alar->SetHealth(AlarHealth); - else - Alar->SetHealth(1); - } - } - toDie = true; + DoCast(me, SPELL_FLAME_BUFFET, true); + me->setAttackTimer(BASE_ATTACK, 1500); } } + } + } +}; - void UpdateAI(uint32 /*diff*/) override - { - if (!UpdateVictim()) - return; +struct npc_ember_of_alar : public ScriptedAI +{ + npc_ember_of_alar(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + instance = creature->GetInstanceScript(); + creature->SetDisableGravity(true); + } + + void Initialize() + { + toDie = false; + } + + InstanceScript* instance; + bool toDie; + + void Reset() override + { + Initialize(); + } + + void JustEngagedWith(Unit* /*who*/) override + { + DoZoneInCombat(); + } + + void EnterEvadeMode(EvadeReason /*why*/) override + { + me->setDeathState(JUST_DIED); + } - if (toDie) + void DamageTaken(Unit* killer, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override + { + if (damage >= me->GetHealth() && killer != me && !toDie) + { + damage = 0; + DoCast(me, SPELL_EMBER_BLAST, true); + me->SetDisplayId(11686); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); + if (instance->GetBossState(DATA_ALAR) == IN_PROGRESS) + { + if (Unit* Alar = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ALAR))) { - me->KillSelf(); - //me->SetVisibility(VISIBILITY_OFF); + int32 AlarHealth = int32(Alar->GetHealth()) - int32(Alar->CountPctFromMaxHealth(3)); + if (AlarHealth > 0) + Alar->SetHealth(AlarHealth); + else + Alar->SetHealth(1); } - - DoMeleeAttackIfReady(); } + toDie = true; + } + } - }; + void UpdateAI(uint32 /*diff*/) override + { + if (!UpdateVictim()) + return; - CreatureAI* GetAI(Creature* creature) const override + if (toDie) { - return GetTheEyeAI<npc_ember_of_alarAI>(creature); + me->KillSelf(); + //me->SetVisibility(VISIBILITY_OFF); } + + DoMeleeAttackIfReady(); + } }; -class npc_flame_patch_alar : public CreatureScript +struct npc_flame_patch_alar : public ScriptedAI { - public: - npc_flame_patch_alar() : CreatureScript("npc_flame_patch_alar") { } + npc_flame_patch_alar(Creature* creature) : ScriptedAI(creature) { } + void Reset() override { } + void JustEngagedWith(Unit* /*who*/) override { } + void AttackStart(Unit* /*who*/) override { } + void MoveInLineOfSight(Unit* /*who*/) override { } - struct npc_flame_patch_alarAI : public ScriptedAI - { - npc_flame_patch_alarAI(Creature* creature) : ScriptedAI(creature) { } - void Reset() override { } - void JustEngagedWith(Unit* /*who*/) override { } - void AttackStart(Unit* /*who*/) override { } - void MoveInLineOfSight(Unit* /*who*/) override { } - - void UpdateAI(uint32 /*diff*/) override { } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return GetTheEyeAI<npc_flame_patch_alarAI>(creature); - } + void UpdateAI(uint32 /*diff*/) override { } }; // 34229 - Flame Quills @@ -615,8 +581,8 @@ class spell_alar_flame_quills : public AuraScript void AddSC_boss_alar() { - new boss_alar(); - new npc_ember_of_alar(); - new npc_flame_patch_alar(); + RegisterTheEyeCreatureAI(boss_alar); + RegisterTheEyeCreatureAI(npc_ember_of_alar); + RegisterTheEyeCreatureAI(npc_flame_patch_alar); RegisterSpellScript(spell_alar_flame_quills); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index db689398271..a1ef60e417f 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -90,455 +90,420 @@ const float PORTAL_Z = 17.005f; static float SolarianPos[4] = {432.909f, -373.424f, 17.9608f, 1.06421f}; */ -class boss_high_astromancer_solarian : public CreatureScript +struct boss_high_astromancer_solarian : public BossAI { - public: - - boss_high_astromancer_solarian() : CreatureScript("boss_high_astromancer_solarian") { } - - struct boss_high_astromancer_solarianAI : public BossAI + boss_high_astromancer_solarian(Creature* creature) : BossAI(creature, DATA_SOLARIAN) + { + Initialize(); + + defaultarmor = creature->GetArmor(); + memset(Portals, 0, sizeof(Portals)); + } + + void Initialize() + { + ArcaneMissiles_Timer = 2000; + m_uiWrathOfTheAstromancer_Timer = 15000; + BlindingLight_Timer = 41000; + Fear_Timer = 20000; + VoidBolt_Timer = 10000; + Phase1_Timer = 50000; + Phase2_Timer = 10s; + Phase3_Timer = 15s; + AppearDelay_Timer = 2s; + BlindingLight = false; + AppearDelay = false; + Wrath_Timer = 20000 + rand32() % 5000;//twice in phase one + Phase = 1; + } + + uint8 Phase; + + uint32 ArcaneMissiles_Timer; + uint32 m_uiWrathOfTheAstromancer_Timer; + uint32 BlindingLight_Timer; + uint32 Fear_Timer; + uint32 VoidBolt_Timer; + uint32 Phase1_Timer; + Milliseconds Phase2_Timer; + Milliseconds Phase3_Timer; + Milliseconds AppearDelay_Timer; + uint32 defaultarmor; + uint32 Wrath_Timer; + + float Portals[3][3]; + + bool AppearDelay; + bool BlindingLight; + + void Reset() override + { + Initialize(); + _Reset(); + me->SetArmor(defaultarmor); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); + me->SetVisible(true); + me->SetDisplayId(MODEL_HUMAN); + + } + + void KilledUnit(Unit* /*victim*/) override + { + Talk(SAY_KILL); + } + + void JustDied(Unit* /*killer*/) override + { + me->SetDisplayId(MODEL_HUMAN); + Talk(SAY_DEATH); + _JustDied(); + } + + void JustEngagedWith(Unit* who) override + { + Talk(SAY_AGGRO); + BossAI::JustEngagedWith(who); + me->CallForHelp(120.0f); + } + + void SummonMinion(uint32 entry, float x, float y, float z) + { + Creature* Summoned = me->SummonCreature(entry, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5s); + if (Summoned) { - boss_high_astromancer_solarianAI(Creature* creature) : BossAI(creature, DATA_SOLARIAN) - { - Initialize(); - - defaultarmor = creature->GetArmor(); - memset(Portals, 0, sizeof(Portals)); - } - - void Initialize() - { - ArcaneMissiles_Timer = 2000; - m_uiWrathOfTheAstromancer_Timer = 15000; - BlindingLight_Timer = 41000; - Fear_Timer = 20000; - VoidBolt_Timer = 10000; - Phase1_Timer = 50000; - Phase2_Timer = 10s; - Phase3_Timer = 15s; - AppearDelay_Timer = 2s; - BlindingLight = false; - AppearDelay = false; - Wrath_Timer = 20000 + rand32() % 5000;//twice in phase one - Phase = 1; - } - - uint8 Phase; - - uint32 ArcaneMissiles_Timer; - uint32 m_uiWrathOfTheAstromancer_Timer; - uint32 BlindingLight_Timer; - uint32 Fear_Timer; - uint32 VoidBolt_Timer; - uint32 Phase1_Timer; - Milliseconds Phase2_Timer; - Milliseconds Phase3_Timer; - Milliseconds AppearDelay_Timer; - uint32 defaultarmor; - uint32 Wrath_Timer; + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) + Summoned->AI()->AttackStart(target); - float Portals[3][3]; + summons.Summon(Summoned); + } + } - bool AppearDelay; - bool BlindingLight; + float Portal_X(float radius) + { + if (urand(0, 1)) + radius = -radius; - void Reset() override - { - Initialize(); - _Reset(); - me->SetArmor(defaultarmor); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); - me->SetVisible(true); - me->SetDisplayId(MODEL_HUMAN); + return radius * (float)(rand32() % 100) / 100.0f + CENTER_X; + } - } + float Portal_Y(float x, float radius) + { + float z = RAND(1.0f, -1.0f); - void KilledUnit(Unit* /*victim*/) override - { - Talk(SAY_KILL); - } + return (z*std::sqrt(radius*radius - (x - CENTER_X)*(x - CENTER_X)) + CENTER_Y); + } - void JustDied(Unit* /*killer*/) override - { - me->SetDisplayId(MODEL_HUMAN); - Talk(SAY_DEATH); - _JustDied(); - } - - void JustEngagedWith(Unit* who) override - { - Talk(SAY_AGGRO); - BossAI::JustEngagedWith(who); - me->CallForHelp(120.0f); - } - - void SummonMinion(uint32 entry, float x, float y, float z) + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + if (AppearDelay) + { + me->StopMoving(); + me->AttackStop(); + if (AppearDelay_Timer <= Milliseconds(diff)) { - Creature* Summoned = me->SummonCreature(entry, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5s); - if (Summoned) + AppearDelay = false; + if (Phase == 2) { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - Summoned->AI()->AttackStart(target); - - summons.Summon(Summoned); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); + me->SetVisible(false); } + AppearDelay_Timer = 2s; } - - float Portal_X(float radius) + else + AppearDelay_Timer -= Milliseconds(diff); + } + if (Phase == 1) + { + if (BlindingLight_Timer <= diff) { - if (urand(0, 1)) - radius = -radius; - - return radius * (float)(rand32() % 100) / 100.0f + CENTER_X; + BlindingLight = true; + BlindingLight_Timer = 45000; } + else + BlindingLight_Timer -= diff; - float Portal_Y(float x, float radius) + if (Wrath_Timer <= diff) { - float z = RAND(1.0f, -1.0f); - - return (z*std::sqrt(radius*radius - (x - CENTER_X)*(x - CENTER_X)) + CENTER_Y); + me->InterruptNonMeleeSpells(false); + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true)) + DoCast(target, SPELL_WRATH_OF_THE_ASTROMANCER, true); + Wrath_Timer = 20000 + rand32() % 5000; } + else + Wrath_Timer -= diff; - void UpdateAI(uint32 diff) override + if (ArcaneMissiles_Timer <= diff) { - if (!UpdateVictim()) - return; - if (AppearDelay) + if (BlindingLight) { - me->StopMoving(); - me->AttackStop(); - if (AppearDelay_Timer <= Milliseconds(diff)) - { - AppearDelay = false; - if (Phase == 2) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); - me->SetVisible(false); - } - AppearDelay_Timer = 2s; - } - else - AppearDelay_Timer -= Milliseconds(diff); + DoCastVictim(SPELL_BLINDING_LIGHT); + BlindingLight = false; } - if (Phase == 1) + else { - if (BlindingLight_Timer <= diff) - { - BlindingLight = true; - BlindingLight_Timer = 45000; - } - else - BlindingLight_Timer -= diff; - - if (Wrath_Timer <= diff) + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) { - me->InterruptNonMeleeSpells(false); - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100, true)) - DoCast(target, SPELL_WRATH_OF_THE_ASTROMANCER, true); - Wrath_Timer = 20000 + rand32() % 5000; - } - else - Wrath_Timer -= diff; + if (!me->HasInArc(2.5f, target)) + target = me->GetVictim(); - if (ArcaneMissiles_Timer <= diff) - { - if (BlindingLight) - { - DoCastVictim(SPELL_BLINDING_LIGHT); - BlindingLight = false; - } - else - { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - { - if (!me->HasInArc(2.5f, target)) - target = me->GetVictim(); - - DoCast(target, SPELL_ARCANE_MISSILES); - } - } - ArcaneMissiles_Timer = 3000; + DoCast(target, SPELL_ARCANE_MISSILES); } - else - ArcaneMissiles_Timer -= diff; + } + ArcaneMissiles_Timer = 3000; + } + else + ArcaneMissiles_Timer -= diff; - if (m_uiWrathOfTheAstromancer_Timer <= diff) + if (m_uiWrathOfTheAstromancer_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + //Target the tank ? + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1)) + { + if (target->GetTypeId() == TYPEID_PLAYER) { - me->InterruptNonMeleeSpells(false); - //Target the tank ? - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1)) - { - if (target->GetTypeId() == TYPEID_PLAYER) - { - DoCast(target, SPELL_WRATH_OF_THE_ASTROMANCER); - m_uiWrathOfTheAstromancer_Timer = 25000; - } - else - m_uiWrathOfTheAstromancer_Timer = 1000; - } + DoCast(target, SPELL_WRATH_OF_THE_ASTROMANCER); + m_uiWrathOfTheAstromancer_Timer = 25000; } else - m_uiWrathOfTheAstromancer_Timer -= diff; + m_uiWrathOfTheAstromancer_Timer = 1000; + } + } + else + m_uiWrathOfTheAstromancer_Timer -= diff; - //Phase1_Timer - if (Phase1_Timer <= diff) + //Phase1_Timer + if (Phase1_Timer <= diff) + { + Phase = 2; + Phase1_Timer = 50000; + //After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind. + me->GetMotionMaster()->Clear(); + me->UpdatePosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O); + for (uint8 i = 0; i <= 2; ++i) + { + if (!i) { - Phase = 2; - Phase1_Timer = 50000; - //After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind. - me->GetMotionMaster()->Clear(); - me->UpdatePosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O); - for (uint8 i = 0; i <= 2; ++i) - { - if (!i) - { - Portals[i][0] = Portal_X(SMALL_PORTAL_RADIUS); - Portals[i][1] = Portal_Y(Portals[i][0], SMALL_PORTAL_RADIUS); - Portals[i][2] = CENTER_Z; - } - else - { - Portals[i][0] = Portal_X(LARGE_PORTAL_RADIUS); - Portals[i][1] = Portal_Y(Portals[i][0], LARGE_PORTAL_RADIUS); - Portals[i][2] = PORTAL_Z; - } - } - if ((std::abs(Portals[2][0] - Portals[1][0]) < 7) && (std::abs(Portals[2][1] - Portals[1][1]) < 7)) - { - int i = 1; - if (std::abs(CENTER_X + 26.0f - Portals[2][0]) < 7) - i = -1; - Portals[2][0] = Portals[2][0] + 7 * i; - Portals[2][1] = Portal_Y(Portals[2][0], LARGE_PORTAL_RADIUS); - } - for (int i = 0; i <= 2; ++i) - { - if (Creature* Summoned = me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O, TEMPSUMMON_TIMED_DESPAWN, Phase2_Timer + Phase3_Timer + AppearDelay_Timer + 1700ms)) - { - Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); - Summoned->CastSpell(Summoned, SPELL_SPOTLIGHT, false); - } - } - AppearDelay = true; + Portals[i][0] = Portal_X(SMALL_PORTAL_RADIUS); + Portals[i][1] = Portal_Y(Portals[i][0], SMALL_PORTAL_RADIUS); + Portals[i][2] = CENTER_Z; } else - Phase1_Timer -= diff; - } - else if (Phase == 2) - { - //10 seconds after Solarian disappears, 12 mobs spawn out of the three portals. - me->AttackStop(); - me->StopMoving(); - if (Phase2_Timer <= Milliseconds(diff)) { - Phase = 3; - for (int i=0; i <= 2; ++i) - for (int j=1; j <= 4; j++) - SummonMinion(NPC_SOLARIUM_AGENT, Portals[i][0], Portals[i][1], Portals[i][2]); - - Talk(SAY_SUMMON1); - Phase2_Timer = 10s; + Portals[i][0] = Portal_X(LARGE_PORTAL_RADIUS); + Portals[i][1] = Portal_Y(Portals[i][0], LARGE_PORTAL_RADIUS); + Portals[i][2] = PORTAL_Z; } - else - Phase2_Timer -= Milliseconds(diff); } - else if (Phase == 3) + if ((std::abs(Portals[2][0] - Portals[1][0]) < 7) && (std::abs(Portals[2][1] - Portals[1][1]) < 7)) { - me->AttackStop(); - me->StopMoving(); - //Check Phase3_Timer - if (Phase3_Timer <= Milliseconds(diff)) - { - Phase = 1; - //15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals. - int i = rand32() % 3; - me->GetMotionMaster()->Clear(); - me->UpdatePosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O); - - for (int j=0; j <= 2; j++) - if (j != i) - SummonMinion(NPC_SOLARIUM_PRIEST, Portals[j][0], Portals[j][1], Portals[j][2]); - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); - me->SetVisible(true); - - Talk(SAY_SUMMON2); - AppearDelay = true; - Phase3_Timer = 15s; - } - else - Phase3_Timer -= Milliseconds(diff); + int i = 1; + if (std::abs(CENTER_X + 26.0f - Portals[2][0]) < 7) + i = -1; + Portals[2][0] = Portals[2][0] + 7 * i; + Portals[2][1] = Portal_Y(Portals[2][0], LARGE_PORTAL_RADIUS); } - else if (Phase == 4) + for (int i = 0; i <= 2; ++i) { - //Fear_Timer - if (Fear_Timer <= diff) + if (Creature* Summoned = me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O, TEMPSUMMON_TIMED_DESPAWN, Phase2_Timer + Phase3_Timer + AppearDelay_Timer + 1700ms)) { - DoCast(me, SPELL_FEAR); - Fear_Timer = 20000; + Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); + Summoned->CastSpell(Summoned, SPELL_SPOTLIGHT, false); } - else - Fear_Timer -= diff; - //VoidBolt_Timer - if (VoidBolt_Timer <= diff) - { - DoCastVictim(SPELL_VOID_BOLT); - VoidBolt_Timer = 10000; - } - else - VoidBolt_Timer -= diff; } - - //When Solarian reaches 20% she will transform into a huge void walker. - if (Phase != 4 && me->HealthBelowPct(20)) - { - Phase = 4; - //To make sure she wont be invisible or not selecatble - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); - me->SetVisible(true); - Talk(SAY_VOIDA); - Talk(SAY_VOIDB); - me->SetArmor(WV_ARMOR); - me->SetDisplayId(MODEL_VOIDWALKER); - } - - DoMeleeAttackIfReady(); + AppearDelay = true; } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return GetTheEyeAI<boss_high_astromancer_solarianAI>(creature); + else + Phase1_Timer -= diff; } -}; - -class npc_solarium_priest : public CreatureScript -{ - public: - - npc_solarium_priest() : CreatureScript("npc_solarium_priest") { } - - struct npc_solarium_priestAI : public ScriptedAI + else if (Phase == 2) { - npc_solarium_priestAI(Creature* creature) : ScriptedAI(creature) + //10 seconds after Solarian disappears, 12 mobs spawn out of the three portals. + me->AttackStop(); + me->StopMoving(); + if (Phase2_Timer <= Milliseconds(diff)) { - Initialize(); - instance = creature->GetInstanceScript(); - } + Phase = 3; + for (int i=0; i <= 2; ++i) + for (int j=1; j <= 4; j++) + SummonMinion(NPC_SOLARIUM_AGENT, Portals[i][0], Portals[i][1], Portals[i][2]); - void Initialize() - { - healTimer = 9000; - holysmiteTimer = 1; - aoesilenceTimer = 15000; + Talk(SAY_SUMMON1); + Phase2_Timer = 10s; } + else + Phase2_Timer -= Milliseconds(diff); + } + else if (Phase == 3) + { + me->AttackStop(); + me->StopMoving(); + //Check Phase3_Timer + if (Phase3_Timer <= Milliseconds(diff)) + { + Phase = 1; + //15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals. + int i = rand32() % 3; + me->GetMotionMaster()->Clear(); + me->UpdatePosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O); - InstanceScript* instance; + for (int j=0; j <= 2; j++) + if (j != i) + SummonMinion(NPC_SOLARIUM_PRIEST, Portals[j][0], Portals[j][1], Portals[j][2]); - uint32 healTimer; - uint32 holysmiteTimer; - uint32 aoesilenceTimer; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); + me->SetVisible(true); - void Reset() override + Talk(SAY_SUMMON2); + AppearDelay = true; + Phase3_Timer = 15s; + } + else + Phase3_Timer -= Milliseconds(diff); + } + else if (Phase == 4) + { + //Fear_Timer + if (Fear_Timer <= diff) { - Initialize(); + DoCast(me, SPELL_FEAR); + Fear_Timer = 20000; } - - void JustEngagedWith(Unit* /*who*/) override { } - - void UpdateAI(uint32 diff) override + else + Fear_Timer -= diff; + //VoidBolt_Timer + if (VoidBolt_Timer <= diff) { - if (!UpdateVictim()) - return; - - if (healTimer <= diff) - { - Unit* target = nullptr; - switch (urand(0, 1)) - { - case 0: - target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SOLARIAN)); - break; - case 1: - target = me; - break; - } - - if (target) - { - DoCast(target, SPELL_SOLARIUM_GREAT_HEAL); - healTimer = 9000; - } - } - else - healTimer -= diff; - - if (holysmiteTimer <= diff) - { - DoCastVictim(SPELL_SOLARIUM_HOLY_SMITE); - holysmiteTimer = 4000; - } - else - holysmiteTimer -= diff; - - if (aoesilenceTimer <= diff) - { - DoCastVictim(SPELL_SOLARIUM_ARCANE_TORRENT); - aoesilenceTimer = 13000; - } - else - aoesilenceTimer -= diff; - - DoMeleeAttackIfReady(); + DoCastVictim(SPELL_VOID_BOLT); + VoidBolt_Timer = 10000; } - }; + else + VoidBolt_Timer -= diff; + } - CreatureAI* GetAI(Creature* creature) const override + //When Solarian reaches 20% she will transform into a huge void walker. + if (Phase != 4 && me->HealthBelowPct(20)) { - return GetTheEyeAI<npc_solarium_priestAI>(creature); + Phase = 4; + //To make sure she wont be invisible or not selecatble + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE); + me->SetVisible(true); + Talk(SAY_VOIDA); + Talk(SAY_VOIDB); + me->SetArmor(WV_ARMOR); + me->SetDisplayId(MODEL_VOIDWALKER); } + + DoMeleeAttackIfReady(); + } }; -// 42783 - Wrath of the Astromancer -class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader +struct npc_solarium_priest : public ScriptedAI { - public: - spell_astromancer_wrath_of_the_astromancer() : SpellScriptLoader("spell_astromancer_wrath_of_the_astromancer") { } - - class spell_astromancer_wrath_of_the_astromancer_AuraScript : public AuraScript + npc_solarium_priest(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + instance = creature->GetInstanceScript(); + } + + void Initialize() + { + healTimer = 9000; + holysmiteTimer = 1; + aoesilenceTimer = 15000; + } + + InstanceScript* instance; + + uint32 healTimer; + uint32 holysmiteTimer; + uint32 aoesilenceTimer; + + void Reset() override + { + Initialize(); + } + + void JustEngagedWith(Unit* /*who*/) override { } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + if (healTimer <= diff) { - PrepareAuraScript(spell_astromancer_wrath_of_the_astromancer_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override + Unit* target = nullptr; + switch (urand(0, 1)) { - return ValidateSpellInfo({ SPELL_WRATH_OF_THE_ASTROMANCER_DOT }); + case 0: + target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SOLARIAN)); + break; + case 1: + target = me; + break; } - void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + if (target) { - // Final heal only on duration end - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) - return; - - Unit* target = GetUnitOwner(); - target->CastSpell(target, GetEffectInfo(EFFECT_1).CalcValue(), false); + DoCast(target, SPELL_SOLARIUM_GREAT_HEAL); + healTimer = 9000; } + } + else + healTimer -= diff; - void Register() override - { - AfterEffectRemove += AuraEffectRemoveFn(spell_astromancer_wrath_of_the_astromancer_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } - }; + if (holysmiteTimer <= diff) + { + DoCastVictim(SPELL_SOLARIUM_HOLY_SMITE); + holysmiteTimer = 4000; + } + else + holysmiteTimer -= diff; - AuraScript* GetAuraScript() const override + if (aoesilenceTimer <= diff) { - return new spell_astromancer_wrath_of_the_astromancer_AuraScript(); + DoCastVictim(SPELL_SOLARIUM_ARCANE_TORRENT); + aoesilenceTimer = 13000; } + else + aoesilenceTimer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +// 42783 - Wrath of the Astromancer +class spell_astromancer_wrath_of_the_astromancer : public AuraScript +{ + PrepareAuraScript(spell_astromancer_wrath_of_the_astromancer); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_WRATH_OF_THE_ASTROMANCER_DOT }); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + // Final heal only on duration end + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; + + Unit* target = GetUnitOwner(); + target->CastSpell(target, GetEffectInfo(EFFECT_1).CalcValue(), false); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_astromancer_wrath_of_the_astromancer::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } }; void AddSC_boss_high_astromancer_solarian() { - new boss_high_astromancer_solarian(); - new npc_solarium_priest(); - new spell_astromancer_wrath_of_the_astromancer(); + RegisterTheEyeCreatureAI(boss_high_astromancer_solarian); + RegisterTheEyeCreatureAI(npc_solarium_priest); + RegisterSpellScript(spell_astromancer_wrath_of_the_astromancer); } |