diff options
author | Rushor <PBienati@web.de> | 2015-01-10 05:19:59 +0000 |
---|---|---|
committer | Nayd <dnpd.dd@gmail.com> | 2015-01-10 05:20:36 +0000 |
commit | f66596a33591559b13a75eb975ab692d46d24213 (patch) | |
tree | 89b1dfda484da7711f0f10783bc9a1c9d194921f /src | |
parent | 039cf60d11a74c6e4db92c829d43300e5b0d6a32 (diff) |
Scripts/Stratholme: Move Maleki the Pallid to Eventmaps
Closes #13871
(cherry picked from commit db849e7fccd1545435dacbc94f5e42142c8b6ced)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index 96651e5bff4..52078ceef8c 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -33,7 +33,14 @@ enum Spells SPELL_DRAINLIFE = 20743, SPELL_DRAIN_MANA = 17243, SPELL_ICETOMB = 16869 +}; +enum MalekiEvents +{ + EVENT_FROSTBOLT = 1, + EVENT_DRAINLIFE = 2, + EVENT_DRAIN_MANA = 3, + EVENT_ICETOMB = 4 }; class boss_maleki_the_pallid : public CreatureScript @@ -50,30 +57,19 @@ public: { boss_maleki_the_pallidAI(Creature* creature) : ScriptedAI(creature) { - Initialize(); instance = me->GetInstanceScript(); } - void Initialize() - { - Frostbolt_Timer = 1000; - IceTomb_Timer = 16000; - DrainLife_Timer = 31000; - } - - InstanceScript* instance; - - uint32 Frostbolt_Timer; - uint32 IceTomb_Timer; - uint32 DrainLife_Timer; - void Reset() override { - Initialize(); + _events.Reset(); } void EnterCombat(Unit* /*who*/) override { + _events.ScheduleEvent(EVENT_FROSTBOLT, 1 * IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_ICETOMB, 16 * IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_DRAINLIFE, 31 * IN_MILLISECONDS); } void JustDied(Unit* /*killer*/) override @@ -87,32 +83,37 @@ public: if (!UpdateVictim()) return; - //Frostbolt - if (Frostbolt_Timer <= diff) - { - if (rand32() % 100 < 90) - DoCastVictim(SPELL_FROSTBOLT); - Frostbolt_Timer = 3500; - } else Frostbolt_Timer -= diff; - - //IceTomb - if (IceTomb_Timer <= diff) - { - if (rand32() % 100 < 65) - DoCastVictim(SPELL_ICETOMB); - IceTomb_Timer = 28000; - } else IceTomb_Timer -= diff; + _events.Update(diff); - //DrainLife - if (DrainLife_Timer <= diff) + while (uint32 eventId = _events.ExecuteEvent()) { - if (rand32() % 100 < 55) - DoCastVictim(SPELL_DRAINLIFE); - DrainLife_Timer = 31000; - } else DrainLife_Timer -= diff; + switch (eventId) + { + case EVENT_FROSTBOLT: + if (rand32() % 90) + DoCastVictim(SPELL_FROSTBOLT); + _events.ScheduleEvent(EVENT_FROSTBOLT, 3.5 * IN_MILLISECONDS); + break; + case EVENT_ICETOMB: + if (rand32() % 65) + DoCastVictim(SPELL_ICETOMB); + _events.ScheduleEvent(EVENT_ICETOMB, 28 * IN_MILLISECONDS); + break; + case EVENT_DRAINLIFE: + if (rand32() % 55) + DoCastVictim(SPELL_DRAINLIFE); + _events.ScheduleEvent(EVENT_DRAINLIFE, 31 * IN_MILLISECONDS); + break; + default: + break; + } + } DoMeleeAttackIfReady(); } + private: + EventMap _events; + InstanceScript* instance; }; }; |