aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp369
1 files changed, 157 insertions, 212 deletions
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
index 2d0ad4ccbed..866151f9696 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
@@ -55,257 +55,202 @@ bool ScheduledIcicleSummons::Execute(uint64 /*time*/, uint32 /*diff*/)
return true;
}
-class npc_ymirjar_flamebearer : public CreatureScript
+struct npc_ymirjar_flamebearer: public ScriptedAI
{
- public:
- npc_ymirjar_flamebearer() : CreatureScript("npc_ymirjar_flamebearer") { }
+ npc_ymirjar_flamebearer(Creature* creature) : ScriptedAI(creature)
+ {
+ }
- struct npc_ymirjar_flamebearerAI: public ScriptedAI
- {
- npc_ymirjar_flamebearerAI(Creature* creature) : ScriptedAI(creature)
- {
- }
+ void Reset() override
+ {
+ _events.Reset();
+ }
- void Reset() override
- {
- _events.Reset();
- }
+ void JustEngagedWith(Unit* /*who*/) override
+ {
+ _events.ScheduleEvent(EVENT_FIREBALL, 4s);
+ _events.ScheduleEvent(EVENT_TACTICAL_BLINK, 15s);
+ }
- void JustEngagedWith(Unit* /*who*/) override
- {
- _events.ScheduleEvent(EVENT_FIREBALL, 4s);
- _events.ScheduleEvent(EVENT_TACTICAL_BLINK, 15s);
- }
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
-
- _events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = _events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_FIREBALL:
- if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
- DoCast(target, SPELL_FIREBALL);
- _events.RescheduleEvent(EVENT_FIREBALL, 5s);
- break;
- case EVENT_TACTICAL_BLINK:
- if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
- DoCast(target, SPELL_TACTICAL_BLINK);
- DoCast(me, SPELL_HELLFIRE);
- _events.RescheduleEvent(EVENT_TACTICAL_BLINK, 12s);
- break;
- default:
- break;
- }
- }
-
- DoMeleeAttackIfReady();
- }
+ _events.Update(diff);
- private:
- EventMap _events;
- };
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- CreatureAI* GetAI(Creature* creature) const override
+ while (uint32 eventId = _events.ExecuteEvent())
{
- return GetPitOfSaronAI<npc_ymirjar_flamebearerAI>(creature);
+ switch (eventId)
+ {
+ case EVENT_FIREBALL:
+ if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
+ DoCast(target, SPELL_FIREBALL);
+ _events.RescheduleEvent(EVENT_FIREBALL, 5s);
+ break;
+ case EVENT_TACTICAL_BLINK:
+ if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
+ DoCast(target, SPELL_TACTICAL_BLINK);
+ DoCast(me, SPELL_HELLFIRE);
+ _events.RescheduleEvent(EVENT_TACTICAL_BLINK, 12s);
+ break;
+ default:
+ break;
+ }
}
-};
-class npc_iceborn_protodrake : public CreatureScript
-{
- public:
- npc_iceborn_protodrake() : CreatureScript("npc_iceborn_protodrake") { }
+ DoMeleeAttackIfReady();
+ }
- struct npc_iceborn_protodrakeAI: public ScriptedAI
- {
- npc_iceborn_protodrakeAI(Creature* creature) : ScriptedAI(creature)
- {
- Initialize();
- }
+private:
+ EventMap _events;
+};
- void Initialize()
- {
- _frostBreathCooldown = 5000;
- }
+struct npc_iceborn_protodrake: public ScriptedAI
+{
+ npc_iceborn_protodrake(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ }
- void Reset() override
- {
- Initialize();
- }
+ void Initialize()
+ {
+ _frostBreathCooldown = 5000;
+ }
- void JustEngagedWith(Unit* /*who*/) override
- {
- if (Vehicle* _vehicle = me->GetVehicleKit())
- _vehicle->RemoveAllPassengers();
- }
+ void Reset() override
+ {
+ Initialize();
+ }
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
-
- if (_frostBreathCooldown < diff)
- {
- DoCastVictim(SPELL_FROST_BREATH);
- _frostBreathCooldown = 10000;
- }
- else
- _frostBreathCooldown -= diff;
-
- DoMeleeAttackIfReady();
- }
+ void JustEngagedWith(Unit* /*who*/) override
+ {
+ if (Vehicle* _vehicle = me->GetVehicleKit())
+ _vehicle->RemoveAllPassengers();
+ }
- private:
- uint32 _frostBreathCooldown;
- };
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
- CreatureAI* GetAI(Creature* creature) const override
+ if (_frostBreathCooldown < diff)
{
- return GetPitOfSaronAI<npc_iceborn_protodrakeAI>(creature);
+ DoCastVictim(SPELL_FROST_BREATH);
+ _frostBreathCooldown = 10000;
}
-};
+ else
+ _frostBreathCooldown -= diff;
-class npc_geist_ambusher : public CreatureScript
-{
- public:
- npc_geist_ambusher() : CreatureScript("npc_geist_ambusher") { }
+ DoMeleeAttackIfReady();
+ }
- struct npc_geist_ambusherAI: public ScriptedAI
- {
- npc_geist_ambusherAI(Creature* creature) : ScriptedAI(creature)
- {
- Initialize();
- }
+private:
+ uint32 _frostBreathCooldown;
+};
- void Initialize()
- {
- _leapingFaceMaulCooldown = 9000;
- }
+struct npc_geist_ambusher: public ScriptedAI
+{
+ npc_geist_ambusher(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ }
- void Reset() override
- {
- Initialize();
- }
+ void Initialize()
+ {
+ _leapingFaceMaulCooldown = 9000;
+ }
- void JustEngagedWith(Unit* who) override
- {
- if (who->GetTypeId() != TYPEID_PLAYER)
- return;
+ void Reset() override
+ {
+ Initialize();
+ }
- // the max range is determined by aggro range
- if (me->GetDistance(who) > 5.0f)
- DoCast(who, SPELL_LEAPING_FACE_MAUL);
- }
+ void JustEngagedWith(Unit* who) override
+ {
+ if (who->GetTypeId() != TYPEID_PLAYER)
+ return;
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
-
- if (_leapingFaceMaulCooldown < diff)
- {
- if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 5.0f, true))
- DoCast(target, SPELL_LEAPING_FACE_MAUL);
- _leapingFaceMaulCooldown = urand(9000, 14000);
- }
- else
- _leapingFaceMaulCooldown -= diff;
-
- DoMeleeAttackIfReady();
- }
+ // the max range is determined by aggro range
+ if (me->GetDistance(who) > 5.0f)
+ DoCast(who, SPELL_LEAPING_FACE_MAUL);
+ }
- private:
- uint32 _leapingFaceMaulCooldown;
- };
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
- CreatureAI* GetAI(Creature* creature) const override
+ if (_leapingFaceMaulCooldown < diff)
{
- return GetPitOfSaronAI<npc_geist_ambusherAI>(creature);
+ if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 5.0f, true))
+ DoCast(target, SPELL_LEAPING_FACE_MAUL);
+ _leapingFaceMaulCooldown = urand(9000, 14000);
}
-};
+ else
+ _leapingFaceMaulCooldown -= diff;
-class npc_pit_of_saron_icicle : public CreatureScript
-{
- public:
- npc_pit_of_saron_icicle() : CreatureScript("npc_pit_of_saron_icicle") { }
+ DoMeleeAttackIfReady();
+ }
- struct npc_pit_of_saron_icicleAI : public PassiveAI
- {
- npc_pit_of_saron_icicleAI(Creature* creature) : PassiveAI(creature)
- {
- me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
- }
+private:
+ uint32 _leapingFaceMaulCooldown;
+};
- void IsSummonedBy(WorldObject* summoner) override
- {
- _summonerGUID = summoner->GetGUID();
+struct npc_pit_of_saron_icicle : public PassiveAI
+{
+ npc_pit_of_saron_icicle(Creature* creature) : PassiveAI(creature)
+ {
+ me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
+ }
- _scheduler.Schedule(Milliseconds(3650), [this](TaskContext /*context*/)
- {
- DoCastSelf(SPELL_ICICLE_FALL_TRIGGER, true);
- DoCastSelf(SPELL_ICICLE_FALL_VISUAL);
+ void IsSummonedBy(WorldObject* summoner) override
+ {
+ _summonerGUID = summoner->GetGUID();
- if (Unit* caster = ObjectAccessor::GetUnit(*me, _summonerGUID))
- caster->RemoveDynObject(SPELL_ICICLE_SUMMON);
- });
- }
+ _scheduler.Schedule(Milliseconds(3650), [this](TaskContext /*context*/)
+ {
+ DoCastSelf(SPELL_ICICLE_FALL_TRIGGER, true);
+ DoCastSelf(SPELL_ICICLE_FALL_VISUAL);
- void UpdateAI(uint32 diff) override
- {
- _scheduler.Update(diff);
- }
+ if (Unit* caster = ObjectAccessor::GetUnit(*me, _summonerGUID))
+ caster->RemoveDynObject(SPELL_ICICLE_SUMMON);
+ });
+ }
- private:
- TaskScheduler _scheduler;
- ObjectGuid _summonerGUID;
- };
+ void UpdateAI(uint32 diff) override
+ {
+ _scheduler.Update(diff);
+ }
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetPitOfSaronAI<npc_pit_of_saron_icicleAI>(creature);
- }
+private:
+ TaskScheduler _scheduler;
+ ObjectGuid _summonerGUID;
};
-class spell_pos_ice_shards : public SpellScriptLoader
+class spell_pos_ice_shards : public SpellScript
{
- public:
- spell_pos_ice_shards() : SpellScriptLoader("spell_pos_ice_shards") { }
+ PrepareSpellScript(spell_pos_ice_shards);
- class spell_pos_ice_shards_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_pos_ice_shards_SpellScript);
-
- bool Load() override
- {
- // This script should execute only in Pit of Saron
- return InstanceHasScript(GetCaster(), PoSScriptName);
- }
-
- void HandleScriptEffect(SpellEffIndex /*effIndex*/)
- {
- if (GetHitPlayer())
- GetCaster()->GetInstanceScript()->SetData(DATA_ICE_SHARDS_HIT, 1);
- }
+ bool Load() override
+ {
+ // This script should execute only in Pit of Saron
+ return InstanceHasScript(GetCaster(), PoSScriptName);
+ }
- void Register() override
- {
- OnEffectHitTarget += SpellEffectFn(spell_pos_ice_shards_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
- }
- };
+ void HandleScriptEffect(SpellEffIndex /*effIndex*/)
+ {
+ if (GetHitPlayer())
+ GetCaster()->GetInstanceScript()->SetData(DATA_ICE_SHARDS_HIT, 1);
+ }
- SpellScript* GetSpellScript() const override
- {
- return new spell_pos_ice_shards_SpellScript();
- }
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_pos_ice_shards::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
+ }
};
enum TyrannusEventCavernEmote
@@ -355,11 +300,11 @@ public:
void AddSC_pit_of_saron()
{
- new npc_ymirjar_flamebearer();
- new npc_iceborn_protodrake();
- new npc_geist_ambusher();
- new npc_pit_of_saron_icicle();
- new spell_pos_ice_shards();
+ RegisterPitOfSaronCreatureAI(npc_ymirjar_flamebearer);
+ RegisterPitOfSaronCreatureAI(npc_iceborn_protodrake);
+ RegisterPitOfSaronCreatureAI(npc_geist_ambusher);
+ RegisterPitOfSaronCreatureAI(npc_pit_of_saron_icicle);
+ RegisterSpellScript(spell_pos_ice_shards);
new at_pit_cavern_entrance();
new at_pit_cavern_end();
}