Scripts/Stratholme: Move Maleki the Pallid to Eventmaps

Closes #13871
This commit is contained in:
Rushor
2015-01-10 05:19:59 +00:00
committed by Nayd
parent 0baa4deb3f
commit db849e7fcc

View File

@@ -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;
_events.Update(diff);
//IceTomb
if (IceTomb_Timer <= diff)
while (uint32 eventId = _events.ExecuteEvent())
{
if (rand32() % 100 < 65)
DoCastVictim(SPELL_ICETOMB);
IceTomb_Timer = 28000;
} else IceTomb_Timer -= diff;
//DrainLife
if (DrainLife_Timer <= diff)
{
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;
};
};