diff options
Diffstat (limited to 'src')
5 files changed, 614 insertions, 691 deletions
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp index 48b821a4954..f66208e6fb7 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp @@ -50,190 +50,178 @@ enum Spells SPELL_SUMMON_FIENDISH_HOUND = 30707 }; -class boss_omor_the_unscarred : public CreatureScript +struct boss_omor_the_unscarred : public BossAI { - public: - - boss_omor_the_unscarred() : CreatureScript("boss_omor_the_unscarred") { } - - struct boss_omor_the_unscarredAI : public BossAI + boss_omor_the_unscarred(Creature* creature) : BossAI(creature, DATA_OMOR_THE_UNSCARRED) + { + Initialize(); + SetCombatMovement(false); + } + + void Initialize() + { + OrbitalStrike_Timer = 25000; + ShadowWhip_Timer = 2000; + Aura_Timer = 10000; + DemonicShield_Timer = 1000; + Shadowbolt_Timer = 2000; + Summon_Timer = 10000; + SummonedCount = 0; + PlayerGUID.Clear(); + CanPullBack = false; + } + + void Reset() override + { + Talk(SAY_WIPE); + + Initialize(); + + _Reset(); + } + + void JustEngagedWith(Unit* who) override + { + BossAI::JustEngagedWith(who); + Talk(SAY_AGGRO); + } + + void KilledUnit(Unit* /*victim*/) override + { + if (rand32() % 2) + return; + + Talk(SAY_KILL_1); + } + + void JustSummoned(Creature* summoned) override + { + Talk(SAY_SUMMON); + + if (Unit* random = SelectTarget(SelectTargetMethod::Random, 0)) + summoned->AI()->AttackStart(random); + + ++SummonedCount; + } + + void JustDied(Unit* /*killer*/) override + { + Talk(SAY_DIE); + _JustDied(); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + //only two may be wrong, perhaps increase timer and spawn periodically instead. + if (SummonedCount < 2) { - boss_omor_the_unscarredAI(Creature* creature) : BossAI(creature, DATA_OMOR_THE_UNSCARRED) + if (Summon_Timer <= diff) { - Initialize(); - SetCombatMovement(false); + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_SUMMON_FIENDISH_HOUND); + Summon_Timer = 15000 + rand32() % 15000; } + else + Summon_Timer -= diff; + } - void Initialize() + if (CanPullBack) + { + if (ShadowWhip_Timer <= diff) { - OrbitalStrike_Timer = 25000; - ShadowWhip_Timer = 2000; - Aura_Timer = 10000; - DemonicShield_Timer = 1000; - Shadowbolt_Timer = 2000; - Summon_Timer = 10000; - SummonedCount = 0; + if (Player* temp = ObjectAccessor::GetPlayer(*me, PlayerGUID)) + { + //if unit dosen't have this flag, then no pulling back (script will attempt cast, even if orbital strike was resisted) + if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR)) + { + me->InterruptNonMeleeSpells(false); + DoCast(temp, SPELL_SHADOW_WHIP); + } + } PlayerGUID.Clear(); + ShadowWhip_Timer = 2000; CanPullBack = false; } - - void Reset() override + else + ShadowWhip_Timer -= diff; + } + else + if (OrbitalStrike_Timer <= diff) { - Talk(SAY_WIPE); - - Initialize(); + Unit* temp = nullptr; + if (me->IsWithinMeleeRange(me->GetVictim())) + temp = me->GetVictim(); + else temp = SelectTarget(SelectTargetMethod::Random, 0); - _Reset(); - } + if (temp && temp->GetTypeId() == TYPEID_PLAYER) + { + DoCast(temp, SPELL_ORBITAL_STRIKE); + OrbitalStrike_Timer = 14000 + rand32() % 2000; + PlayerGUID = temp->GetGUID(); - void JustEngagedWith(Unit* who) override - { - BossAI::JustEngagedWith(who); - Talk(SAY_AGGRO); + if (PlayerGUID) + CanPullBack = true; + } } + else + OrbitalStrike_Timer -= diff; - void KilledUnit(Unit* /*victim*/) override + if (HealthBelowPct(20)) + { + if (DemonicShield_Timer <= diff) { - if (rand32() % 2) - return; - - Talk(SAY_KILL_1); + DoCast(me, SPELL_DEMONIC_SHIELD); + DemonicShield_Timer = 15000; } + else + DemonicShield_Timer -= diff; + } - void JustSummoned(Creature* summoned) override - { - Talk(SAY_SUMMON); - - if (Unit* random = SelectTarget(SelectTargetMethod::Random, 0)) - summoned->AI()->AttackStart(random); - - ++SummonedCount; - } + if (Aura_Timer <= diff) + { + Talk(SAY_CURSE); - void JustDied(Unit* /*killer*/) override + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) { - Talk(SAY_DIE); - _JustDied(); + DoCast(target, SPELL_TREACHEROUS_AURA); + Aura_Timer = 8000 + rand32() % 8000; } + } + else + Aura_Timer -= diff; - void UpdateAI(uint32 diff) override + if (Shadowbolt_Timer <= diff) + { + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) { - if (!UpdateVictim()) - return; - - //only two may be wrong, perhaps increase timer and spawn periodically instead. - if (SummonedCount < 2) - { - if (Summon_Timer <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_SUMMON_FIENDISH_HOUND); - Summon_Timer = 15000 + rand32() % 15000; - } - else - Summon_Timer -= diff; - } - - if (CanPullBack) - { - if (ShadowWhip_Timer <= diff) - { - if (Player* temp = ObjectAccessor::GetPlayer(*me, PlayerGUID)) - { - //if unit dosen't have this flag, then no pulling back (script will attempt cast, even if orbital strike was resisted) - if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR)) - { - me->InterruptNonMeleeSpells(false); - DoCast(temp, SPELL_SHADOW_WHIP); - } - } - PlayerGUID.Clear(); - ShadowWhip_Timer = 2000; - CanPullBack = false; - } - else - ShadowWhip_Timer -= diff; - } - else - if (OrbitalStrike_Timer <= diff) - { - Unit* temp = nullptr; - if (me->IsWithinMeleeRange(me->GetVictim())) - temp = me->GetVictim(); - else temp = SelectTarget(SelectTargetMethod::Random, 0); - - if (temp && temp->GetTypeId() == TYPEID_PLAYER) - { - DoCast(temp, SPELL_ORBITAL_STRIKE); - OrbitalStrike_Timer = 14000 + rand32() % 2000; - PlayerGUID = temp->GetGUID(); - - if (PlayerGUID) - CanPullBack = true; - } - } - else - OrbitalStrike_Timer -= diff; - - if (HealthBelowPct(20)) - { - if (DemonicShield_Timer <= diff) - { - DoCast(me, SPELL_DEMONIC_SHIELD); - DemonicShield_Timer = 15000; - } - else - DemonicShield_Timer -= diff; - } - - if (Aura_Timer <= diff) - { - Talk(SAY_CURSE); - - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - { - DoCast(target, SPELL_TREACHEROUS_AURA); - Aura_Timer = 8000 + rand32() % 8000; - } - } - else - Aura_Timer -= diff; + target = me->GetVictim(); - if (Shadowbolt_Timer <= diff) - { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - { - target = me->GetVictim(); - - DoCast(target, SPELL_SHADOW_BOLT); - Shadowbolt_Timer = 4000 + rand32() % 2500; - } - } - else - Shadowbolt_Timer -= diff; - - DoMeleeAttackIfReady(); + DoCast(target, SPELL_SHADOW_BOLT); + Shadowbolt_Timer = 4000 + rand32() % 2500; } - - private: - uint32 OrbitalStrike_Timer; - uint32 ShadowWhip_Timer; - uint32 Aura_Timer; - uint32 DemonicShield_Timer; - uint32 Shadowbolt_Timer; - uint32 Summon_Timer; - uint32 SummonedCount; - ObjectGuid PlayerGUID; - bool CanPullBack; - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return GetHellfireRampartsAI<boss_omor_the_unscarredAI>(creature); } + else + Shadowbolt_Timer -= diff; + + DoMeleeAttackIfReady(); + } + + private: + uint32 OrbitalStrike_Timer; + uint32 ShadowWhip_Timer; + uint32 Aura_Timer; + uint32 DemonicShield_Timer; + uint32 Shadowbolt_Timer; + uint32 Summon_Timer; + uint32 SummonedCount; + ObjectGuid PlayerGUID; + bool CanPullBack; }; void AddSC_boss_omor_the_unscarred() { - new boss_omor_the_unscarred(); + RegisterHellfireRampartsCreatureAI(boss_omor_the_unscarred); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index 02f5fb96ccd..51caba9b87e 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -64,474 +64,431 @@ const float VazrudenRing[2][3] = { -1377.0f, 1760.0f, 112.0f } }; -class boss_nazan : public CreatureScript +struct boss_nazan : public BossAI { - public: - boss_nazan() : CreatureScript("boss_nazan") { } - - struct boss_nazanAI : public BossAI + boss_nazan(Creature* creature) : BossAI(creature, DATA_NAZAN) + { + Initialize(); + flight = true; + BellowingRoar_Timer = 0; + ConeOfFire_Timer = 0; + } + + void Initialize() + { + Fireball_Timer = 4000; + Fly_Timer = 45000; + Turn_Timer = 0; + } + + void Reset() override + { + Initialize(); + _Reset(); + } + + void JustEngagedWith(Unit* /*who*/) override { } + + void IsSummonedBy(WorldObject* summoner) override + { + if (summoner->GetEntry() == NPC_VAZRUDEN_HERALD) + VazrudenGUID = summoner->GetGUID(); + } + + void JustSummoned(Creature* summoned) override + { + if (summoned && summoned->GetEntry() == NPC_LIQUID_FIRE) { - boss_nazanAI(Creature* creature) : BossAI(creature, DATA_NAZAN) - { - Initialize(); - flight = true; - BellowingRoar_Timer = 0; - ConeOfFire_Timer = 0; - } + summoned->SetLevel(me->GetLevel()); + summoned->SetFaction(me->GetFaction()); + summoned->CastSpell(summoned, DUNGEON_MODE(SPELL_SUMMON_LIQUID_FIRE, SPELL_SUMMON_LIQUID_FIRE_H), true); + summoned->CastSpell(summoned, SPELL_FIRE_NOVA_VISUAL, true); + } + } - void Initialize() - { - Fireball_Timer = 4000; - Fly_Timer = 45000; - Turn_Timer = 0; - } + void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override + { + if (spellInfo->Id == uint32(SPELL_FIREBALL)) + me->SummonCreature(NPC_LIQUID_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 30s); + } - void Reset() override - { - Initialize(); - _Reset(); - } + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; - void JustEngagedWith(Unit* /*who*/) override { } + if (Fireball_Timer <= diff) + { + if (Unit* victim = SelectTarget(SelectTargetMethod::Random, 0)) + DoCast(victim, SPELL_FIREBALL, true); + Fireball_Timer = urand(4000, 7000); + } + else + Fireball_Timer -= diff; - void IsSummonedBy(WorldObject* summoner) override + if (flight) // phase 1 - the flight + { + Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); + if (Fly_Timer < diff || !(Vazruden && Vazruden->IsAlive() && Vazruden->HealthAbovePct(20))) { - if (summoner->GetEntry() == NPC_VAZRUDEN_HERALD) - VazrudenGUID = summoner->GetGUID(); + flight = false; + BellowingRoar_Timer = 6000; + ConeOfFire_Timer = 12000; + me->SetDisableGravity(false); + me->SetWalk(true); + me->GetMotionMaster()->Clear(); + if (Unit* victim = SelectTarget(SelectTargetMethod::MinDistance, 0)) + AttackStart(victim); + DoStartMovement(me->GetVictim()); + Talk(EMOTE); + return; } + else + Fly_Timer -= diff; - void JustSummoned(Creature* summoned) override + if (Turn_Timer <= diff) { - if (summoned && summoned->GetEntry() == NPC_LIQUID_FIRE) - { - summoned->SetLevel(me->GetLevel()); - summoned->SetFaction(me->GetFaction()); - summoned->CastSpell(summoned, DUNGEON_MODE(SPELL_SUMMON_LIQUID_FIRE, SPELL_SUMMON_LIQUID_FIRE_H), true); - summoned->CastSpell(summoned, SPELL_FIRE_NOVA_VISUAL, true); - } + uint32 waypoint = (Fly_Timer/10000)%2; + if (!me->IsWithinDist3d(VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2], 5)) + me->GetMotionMaster()->MovePoint(0, VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2]); + Turn_Timer = 10000; } - - void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override + else + Turn_Timer -= diff; + } + else // phase 2 - land fight + { + if (ConeOfFire_Timer <= diff) { - if (spellInfo->Id == uint32(SPELL_FIREBALL)) - me->SummonCreature(NPC_LIQUID_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 30s); + DoCast(me, SPELL_CONE_OF_FIRE); + ConeOfFire_Timer = 12000; + Fireball_Timer = 4000; } + else + ConeOfFire_Timer -= diff; - void UpdateAI(uint32 diff) override + if (IsHeroic()) { - if (!UpdateVictim()) - return; - - if (Fireball_Timer <= diff) + if (BellowingRoar_Timer <= diff) { - if (Unit* victim = SelectTarget(SelectTargetMethod::Random, 0)) - DoCast(victim, SPELL_FIREBALL, true); - Fireball_Timer = urand(4000, 7000); + DoCast(me, SPELL_BELLOWING_ROAR); + BellowingRoar_Timer = 45000; } else - Fireball_Timer -= diff; - - if (flight) // phase 1 - the flight - { - Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); - if (Fly_Timer < diff || !(Vazruden && Vazruden->IsAlive() && Vazruden->HealthAbovePct(20))) - { - flight = false; - BellowingRoar_Timer = 6000; - ConeOfFire_Timer = 12000; - me->SetDisableGravity(false); - me->SetWalk(true); - me->GetMotionMaster()->Clear(); - if (Unit* victim = SelectTarget(SelectTargetMethod::MinDistance, 0)) - AttackStart(victim); - DoStartMovement(me->GetVictim()); - Talk(EMOTE); - return; - } - else - Fly_Timer -= diff; - - if (Turn_Timer <= diff) - { - uint32 waypoint = (Fly_Timer/10000)%2; - if (!me->IsWithinDist3d(VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2], 5)) - me->GetMotionMaster()->MovePoint(0, VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2]); - Turn_Timer = 10000; - } - else - Turn_Timer -= diff; - } - else // phase 2 - land fight - { - if (ConeOfFire_Timer <= diff) - { - DoCast(me, SPELL_CONE_OF_FIRE); - ConeOfFire_Timer = 12000; - Fireball_Timer = 4000; - } - else - ConeOfFire_Timer -= diff; - - if (IsHeroic()) - { - if (BellowingRoar_Timer <= diff) - { - DoCast(me, SPELL_BELLOWING_ROAR); - BellowingRoar_Timer = 45000; - } - else - BellowingRoar_Timer -= diff; - } - - DoMeleeAttackIfReady(); - } + BellowingRoar_Timer -= diff; } - private: - uint32 Fireball_Timer; - uint32 ConeOfFire_Timer; - uint32 BellowingRoar_Timer; - uint32 Fly_Timer; - uint32 Turn_Timer; - bool flight; - ObjectGuid VazrudenGUID; - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return GetHellfireRampartsAI<boss_nazanAI>(creature); + DoMeleeAttackIfReady(); } + } + + private: + uint32 Fireball_Timer; + uint32 ConeOfFire_Timer; + uint32 BellowingRoar_Timer; + uint32 Fly_Timer; + uint32 Turn_Timer; + bool flight; + ObjectGuid VazrudenGUID; }; -class boss_vazruden : public CreatureScript +struct boss_vazruden : public BossAI { - public: - boss_vazruden() : CreatureScript("boss_vazruden") { } - - struct boss_vazrudenAI : public BossAI + boss_vazruden(Creature* creature) : BossAI(creature, DATA_VAZRUDEN) + { + Initialize(); + } + + void Initialize() + { + Revenge_Timer = 4000; + UnsummonCheck = 2000; + WipeSaid = false; + } + + void Reset() override + { + Initialize(); + _Reset(); + } + + void JustEngagedWith(Unit* who) override + { + Talk(SAY_AGGRO); + BossAI::JustEngagedWith(who); + } + + void KilledUnit(Unit* who) override + { + if (who && who->GetEntry() != NPC_VAZRUDEN) + Talk(SAY_KILL); + } + + void JustDied(Unit* killer) override + { + if (killer && killer != me) + Talk(SAY_DIE); + _JustDied(); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) { - boss_vazrudenAI(Creature* creature) : BossAI(creature, DATA_VAZRUDEN) - { - Initialize(); - } - - void Initialize() - { - Revenge_Timer = 4000; - UnsummonCheck = 2000; - WipeSaid = false; - } - - void Reset() override - { - Initialize(); - _Reset(); - } - - void JustEngagedWith(Unit* who) override - { - Talk(SAY_AGGRO); - BossAI::JustEngagedWith(who); - } - - void KilledUnit(Unit* who) override - { - if (who && who->GetEntry() != NPC_VAZRUDEN) - Talk(SAY_KILL); - } - - void JustDied(Unit* killer) override + if (UnsummonCheck < diff && me->IsAlive()) { - if (killer && killer != me) - Talk(SAY_DIE); - _JustDied(); - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - { - if (UnsummonCheck < diff && me->IsAlive()) - { - if (!WipeSaid) - { - Talk(SAY_WIPE); - WipeSaid = true; - } - me->DisappearAndDie(); - } - else - UnsummonCheck -= diff; - return; - } - - if (Revenge_Timer <= diff) + if (!WipeSaid) { - if (Unit* victim = me->GetVictim()) - DoCast(victim, DUNGEON_MODE(SPELL_REVENGE, SPELL_REVENGE_H)); - Revenge_Timer = 5000; + Talk(SAY_WIPE); + WipeSaid = true; } - else - Revenge_Timer -= diff; - - DoMeleeAttackIfReady(); + me->DisappearAndDie(); } + else + UnsummonCheck -= diff; + return; + } - private: - uint32 Revenge_Timer; - bool WipeSaid; - uint32 UnsummonCheck; - }; - - CreatureAI* GetAI(Creature* creature) const override + if (Revenge_Timer <= diff) { - return GetHellfireRampartsAI<boss_vazrudenAI>(creature); + if (Unit* victim = me->GetVictim()) + DoCast(victim, DUNGEON_MODE(SPELL_REVENGE, SPELL_REVENGE_H)); + Revenge_Timer = 5000; } + else + Revenge_Timer -= diff; + + DoMeleeAttackIfReady(); + } + + private: + uint32 Revenge_Timer; + bool WipeSaid; + uint32 UnsummonCheck; }; -class boss_vazruden_the_herald : public CreatureScript +struct boss_vazruden_the_herald : public ScriptedAI { - public: - boss_vazruden_the_herald() : CreatureScript("boss_vazruden_the_herald") { } - - struct boss_vazruden_the_heraldAI : public ScriptedAI + boss_vazruden_the_herald(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + summoned = false; + sentryDown = false; + } + + void Initialize() + { + phase = 0; + waypoint = 0; + check = 0; + } + + void Reset() override + { + Initialize(); + UnsummonAdds(); + } + + void UnsummonAdds() + { + if (summoned) { - boss_vazruden_the_heraldAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - summoned = false; - sentryDown = false; - } - - void Initialize() + Creature* Nazan = ObjectAccessor::GetCreature(*me, NazanGUID); + if (!Nazan) + Nazan = me->FindNearestCreature(NPC_NAZAN, 5000); + if (Nazan) { - phase = 0; - waypoint = 0; - check = 0; + Nazan->DisappearAndDie(); + NazanGUID.Clear(); } - void Reset() override + Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); + if (!Vazruden) + Vazruden = me->FindNearestCreature(NPC_VAZRUDEN, 5000); + if (Vazruden) { - Initialize(); - UnsummonAdds(); - } - - void UnsummonAdds() - { - if (summoned) - { - Creature* Nazan = ObjectAccessor::GetCreature(*me, NazanGUID); - if (!Nazan) - Nazan = me->FindNearestCreature(NPC_NAZAN, 5000); - if (Nazan) - { - Nazan->DisappearAndDie(); - NazanGUID.Clear(); - } - - Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); - if (!Vazruden) - Vazruden = me->FindNearestCreature(NPC_VAZRUDEN, 5000); - if (Vazruden) - { - Vazruden->DisappearAndDie(); - VazrudenGUID.Clear(); - } - summoned = false; - me->ClearUnitState(UNIT_STATE_ROOT); - me->SetVisible(true); - } + Vazruden->DisappearAndDie(); + VazrudenGUID.Clear(); } + summoned = false; + me->ClearUnitState(UNIT_STATE_ROOT); + me->SetVisible(true); + } + } - void SummonAdds() + void SummonAdds() + { + if (!summoned) + { + if (Creature* Vazruden = me->SummonCreature(NPC_VAZRUDEN, VazrudenMiddle[0], VazrudenMiddle[1], VazrudenMiddle[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100min)) + VazrudenGUID = Vazruden->GetGUID(); + if (Creature* Nazan = me->SummonCreature(NPC_NAZAN, VazrudenMiddle[0], VazrudenMiddle[1], VazrudenMiddle[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100min)) { - if (!summoned) - { - if (Creature* Vazruden = me->SummonCreature(NPC_VAZRUDEN, VazrudenMiddle[0], VazrudenMiddle[1], VazrudenMiddle[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100min)) - VazrudenGUID = Vazruden->GetGUID(); - if (Creature* Nazan = me->SummonCreature(NPC_NAZAN, VazrudenMiddle[0], VazrudenMiddle[1], VazrudenMiddle[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100min)) - { - NazanGUID = Nazan->GetGUID(); - if (Player* player = Nazan->SelectNearestPlayer(60.0f)) - Nazan->AI()->AttackStart(player); - } - summoned = true; - me->SetVisible(false); - me->AddUnitState(UNIT_STATE_ROOT); - } + NazanGUID = Nazan->GetGUID(); + if (Player* player = Nazan->SelectNearestPlayer(60.0f)) + Nazan->AI()->AttackStart(player); } + summoned = true; + me->SetVisible(false); + me->AddUnitState(UNIT_STATE_ROOT); + } + } - void JustEngagedWith(Unit* /*who*/) override - { - if (phase == 0) - { - phase = 1; - check = 0; - Talk(SAY_INTRO); - } - } + void JustEngagedWith(Unit* /*who*/) override + { + if (phase == 0) + { + phase = 1; + check = 0; + Talk(SAY_INTRO); + } + } + + void JustSummoned(Creature* summon) override + { + if (!summon) + return; + Unit* victim = me->GetVictim(); + if (summon->GetEntry() == NPC_NAZAN) + { + summon->SetDisableGravity(true); + summon->SetSpeedRate(MOVE_FLIGHT, 2.5f); + if (victim) + AttackStartNoMove(victim); + } + else + if (victim) + summon->AI()->AttackStart(victim); + } + + void SentryDownBy(Unit* killer) + { + if (sentryDown) + { + AttackStartNoMove(killer); + sentryDown = false; + } + else + sentryDown = true; + } - void JustSummoned(Creature* summon) override + void UpdateAI(uint32 diff) override + { + switch (phase) + { + case 0: // circle around the platform + return; + break; + case 1: // go to the middle and begin the fight + if (check <= diff) { - if (!summon) - return; - Unit* victim = me->GetVictim(); - if (summon->GetEntry() == NPC_NAZAN) + if (!me->IsWithinDist3d(VazrudenMiddle[0], VazrudenMiddle[1], VazrudenMiddle[2], 5)) { - summon->SetDisableGravity(true); - summon->SetSpeedRate(MOVE_FLIGHT, 2.5f); - if (victim) - AttackStartNoMove(victim); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(0, VazrudenMiddle[0], VazrudenMiddle[1], VazrudenMiddle[2]); + check = 1000; } else - if (victim) - summon->AI()->AttackStart(victim); - } - - void SentryDownBy(Unit* killer) - { - if (sentryDown) { - AttackStartNoMove(killer); - sentryDown = false; + SummonAdds(); + phase = 2; + return; } - else - sentryDown = true; } - - void UpdateAI(uint32 diff) override + else + check -= diff; + break; + default: // adds do the job now + if (check <= diff) { - switch (phase) + Creature* Nazan = ObjectAccessor::GetCreature(*me, NazanGUID); + Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); + if ((Nazan && Nazan->IsAlive()) || (Vazruden && Vazruden->IsAlive())) { - case 0: // circle around the platform - return; - break; - case 1: // go to the middle and begin the fight - if (check <= diff) - { - if (!me->IsWithinDist3d(VazrudenMiddle[0], VazrudenMiddle[1], VazrudenMiddle[2], 5)) - { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0, VazrudenMiddle[0], VazrudenMiddle[1], VazrudenMiddle[2]); - check = 1000; - } - else - { - SummonAdds(); - phase = 2; - return; - } - } + if ((Nazan && Nazan->GetVictim()) || (Vazruden && Vazruden->GetVictim())) + return; else - check -= diff; - break; - default: // adds do the job now - if (check <= diff) { - Creature* Nazan = ObjectAccessor::GetCreature(*me, NazanGUID); - Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); - if ((Nazan && Nazan->IsAlive()) || (Vazruden && Vazruden->IsAlive())) - { - if ((Nazan && Nazan->GetVictim()) || (Vazruden && Vazruden->GetVictim())) - return; - else - { - UnsummonAdds(); - EnterEvadeMode(); - return; - } - } - if (!(Nazan && Nazan->IsAlive()) && !(Vazruden && Vazruden->IsAlive())) - { - me->DisappearAndDie(); - } - check = 2000; + UnsummonAdds(); + EnterEvadeMode(); + return; } - else - check -= diff; - break; } + if (!(Nazan && Nazan->IsAlive()) && !(Vazruden && Vazruden->IsAlive())) + { + me->DisappearAndDie(); + } + check = 2000; } - - private: - uint32 phase; - uint32 waypoint; - uint32 check; - bool sentryDown; - ObjectGuid NazanGUID; - ObjectGuid VazrudenGUID; - bool summoned; - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return GetHellfireRampartsAI<boss_vazruden_the_heraldAI>(creature); + else + check -= diff; + break; } + } + + private: + uint32 phase; + uint32 waypoint; + uint32 check; + bool sentryDown; + ObjectGuid NazanGUID; + ObjectGuid VazrudenGUID; + bool summoned; }; -class npc_hellfire_sentry : public CreatureScript +struct npc_hellfire_sentry : public ScriptedAI { - public: - npc_hellfire_sentry() : CreatureScript("npc_hellfire_sentry") { } - - struct npc_hellfire_sentryAI : public ScriptedAI + npc_hellfire_sentry(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + KidneyShot_Timer = urand(3000, 7000); + } + + void Reset() override + { + Initialize(); + } + + void JustEngagedWith(Unit* /*who*/) override { } + + void JustDied(Unit* killer) override + { + if (!killer) + return; + + if (Creature* herald = me->FindNearestCreature(NPC_VAZRUDEN_HERALD, 150)) + ENSURE_AI(boss_vazruden_the_herald, herald->AI())->SentryDownBy(killer); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + if (KidneyShot_Timer <= diff) { - npc_hellfire_sentryAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - } - - void Initialize() - { - KidneyShot_Timer = urand(3000, 7000); - } - - void Reset() override - { - Initialize(); - } - - void JustEngagedWith(Unit* /*who*/) override { } - - void JustDied(Unit* killer) override - { - if (!killer) - return; - - if (Creature* herald = me->FindNearestCreature(NPC_VAZRUDEN_HERALD, 150)) - ENSURE_AI(boss_vazruden_the_herald::boss_vazruden_the_heraldAI, herald->AI())->SentryDownBy(killer); - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - if (KidneyShot_Timer <= diff) - { - if (Unit* victim = me->GetVictim()) - DoCast(victim, SPELL_KIDNEY_SHOT); - KidneyShot_Timer = 20000; - } - else - KidneyShot_Timer -= diff; - - DoMeleeAttackIfReady(); - } + if (Unit* victim = me->GetVictim()) + DoCast(victim, SPELL_KIDNEY_SHOT); + KidneyShot_Timer = 20000; + } + else + KidneyShot_Timer -= diff; - private: - uint32 KidneyShot_Timer; - }; + DoMeleeAttackIfReady(); + } - CreatureAI* GetAI(Creature* creature) const override - { - return GetHellfireRampartsAI<npc_hellfire_sentryAI>(creature); - } + private: + uint32 KidneyShot_Timer; }; + void AddSC_boss_vazruden_the_herald() { - new boss_vazruden_the_herald(); - new boss_vazruden(); - new boss_nazan(); - new npc_hellfire_sentry(); + RegisterHellfireRampartsCreatureAI(boss_nazan); + RegisterHellfireRampartsCreatureAI(boss_vazruden); + RegisterHellfireRampartsCreatureAI(boss_vazruden_the_herald); + RegisterHellfireRampartsCreatureAI(npc_hellfire_sentry); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp index 778855df653..240327d96ec 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp @@ -15,170 +15,153 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Watchkeeper_Gargolmar -SD%Complete: 80 -SDComment: Missing adds to heal him. Surge should be used on target furthest away, not random. -SDCategory: Hellfire Citadel, Hellfire Ramparts -EndScriptData */ +/* Missing adds to heal him + * Surge should be used on target furthest away, not random */ #include "ScriptMgr.h" #include "hellfire_ramparts.h" #include "ScriptedCreature.h" +#include "SpellInfo.h" -enum Says +enum GargolmarTexts { SAY_TAUNT = 0, SAY_HEAL = 1, SAY_SURGE = 2, SAY_AGGRO = 3, - SAY_KILL = 4, - SAY_DIE = 5 + SAY_SLAY = 4 }; -enum Spells +enum GargolmarSpells { SPELL_MORTAL_WOUND = 30641, SPELL_SURGE = 34645, SPELL_RETALIATION = 22857 }; -enum Events +enum GargolmarEvents { EVENT_MORTAL_WOUND = 1, - EVENT_SURGE = 2, - EVENT_RETALIATION = 3 + EVENT_SURGE, + EVENT_RETALIATION, + EVENT_TAUNT, + EVENT_HEAL }; -class boss_watchkeeper_gargolmar : public CreatureScript +enum GargolmarMisc { - public: - boss_watchkeeper_gargolmar() : CreatureScript("boss_watchkeeper_gargolmar") { } + SOUND_DEATH = 10336 +}; - struct boss_watchkeeper_gargolmarAI : public BossAI +// 17306 - Watchkeeper Gargolmar +struct boss_watchkeeper_gargolmar : public BossAI +{ + boss_watchkeeper_gargolmar(Creature* creature) : BossAI(creature, DATA_WATCHKEEPER_GARGOLMAR), _yelledForHeal(false), _retaliation(false) { } + + void JustAppeared() override + { + // This is just timed, not on LoS or areatrigger (the source is videos) + events.ScheduleEvent(EVENT_TAUNT, 10min, 15min); + } + + void Reset() override + { + _Reset(); + _yelledForHeal = false; + _retaliation = false; + } + + void JustEngagedWith(Unit* who) override + { + Talk(SAY_AGGRO); + BossAI::JustEngagedWith(who); + events.ScheduleEvent(EVENT_MORTAL_WOUND, 5s, 10s); + events.ScheduleEvent(EVENT_SURGE, 3s, 5s); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override + { + if (!_yelledForHeal && me->HealthBelowPctDamaged(40, damage)) { - boss_watchkeeper_gargolmarAI(Creature* creature) : BossAI(creature, DATA_WATCHKEEPER_GARGOLMAR) - { - Initialize(); - } - - void Initialize() - { - hasTaunted = false; - yelledForHeal = false; - retaliation = false; - } - - void Reset() override - { - Initialize(); - _Reset(); - } - - void JustEngagedWith(Unit* who) override - { - Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_MORTAL_WOUND, 5s); - events.ScheduleEvent(EVENT_SURGE, 4s); - BossAI::JustEngagedWith(who); - } + _yelledForHeal = true; + events.ScheduleEvent(EVENT_HEAL, 0s); + } + if (!_retaliation && me->HealthBelowPctDamaged(20, damage)) + { + _retaliation = true; + events.ScheduleEvent(EVENT_RETALIATION, 0s); + } + } + + void OnSpellCast(SpellInfo const* spell) override + { + if (spell->Id == SPELL_SURGE) + if (roll_chance_i(50)) + Talk(SAY_SURGE); + } + + void KilledUnit(Unit* /*victim*/) override + { + Talk(SAY_SLAY); + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + DoPlaySoundToSet(me, SOUND_DEATH); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + { + events.Update(diff); - void MoveInLineOfSight(Unit* who) override + while (uint32 eventId = events.ExecuteEvent()) { - if (!me->GetVictim() && me->CanCreatureAttack(who)) - { - if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) - return; - - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) - { - //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - AttackStart(who); - } - else if (!hasTaunted && me->IsWithinDistInMap(who, 60.0f)) - { - Talk(SAY_TAUNT); - hasTaunted = true; - } - } + if (eventId == EVENT_TAUNT) + Talk(SAY_TAUNT); } - void KilledUnit(Unit* /*victim*/) override - { - Talk(SAY_KILL); - } + return; + } - void JustDied(Unit* /*killer*/) override - { - Talk(SAY_DIE); - _JustDied(); - } + events.Update(diff); - void UpdateAI(uint32 diff) override + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_MORTAL_WOUND: - DoCastVictim(SPELL_MORTAL_WOUND); - events.ScheduleEvent(EVENT_MORTAL_WOUND, 5s, 13s); - break; - case EVENT_SURGE: - Talk(SAY_SURGE); - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - DoCast(target, SPELL_SURGE); - events.ScheduleEvent(EVENT_SURGE, 5s, 13s); - break; - case EVENT_RETALIATION: - DoCast(me, SPELL_RETALIATION); - events.ScheduleEvent(EVENT_RETALIATION, 30s); - break; - default: - break; - } - } - - if (!retaliation) - { - if (HealthBelowPct(20)) - { - events.ScheduleEvent(EVENT_RETALIATION, 1s); - retaliation = true; - } - } - - if (!yelledForHeal) - { - if (HealthBelowPct(40)) - { - Talk(SAY_HEAL); - yelledForHeal = true; - } - } - - DoMeleeAttackIfReady(); + case EVENT_MORTAL_WOUND: + DoCastVictim(SPELL_MORTAL_WOUND); + events.Repeat(5s, 15s); + break; + case EVENT_SURGE: + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) + DoCast(target, SPELL_SURGE); + events.Repeat(15s, 40s); + break; + case EVENT_RETALIATION: + DoCastSelf(SPELL_RETALIATION); + events.Repeat(30s); + break; + case EVENT_HEAL: + Talk(SAY_HEAL); + break; + default: + break; } + } - private: - bool hasTaunted; - bool yelledForHeal; - bool retaliation; - }; + DoMeleeAttackIfReady(); + } - CreatureAI* GetAI(Creature* creature) const override - { - return GetHellfireRampartsAI<boss_watchkeeper_gargolmarAI>(creature); - } +private: + bool _yelledForHeal; + bool _retaliation; }; void AddSC_boss_watchkeeper_gargolmar() { - new boss_watchkeeper_gargolmar(); + RegisterHellfireRampartsCreatureAI(boss_watchkeeper_gargolmar); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h index f3115b745c5..9b14e55a31c 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h @@ -54,4 +54,6 @@ inline AI* GetHellfireRampartsAI(T* obj) return GetInstanceAI<AI>(obj, HRScriptName); } +#define RegisterHellfireRampartsCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetHellfireRampartsAI) + #endif diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp index 839c478b0e0..40c404ec268 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp @@ -15,13 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Instance_Hellfire_Ramparts -SD%Complete: 50 -SDComment: -SDCategory: Hellfire Ramparts -EndScriptData */ - #include "ScriptMgr.h" #include "GameObject.h" #include "hellfire_ramparts.h" |