aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMitchesD <majklprofik@seznam.cz>2014-01-22 23:46:45 +0100
committerjoschiwald <joschiwald@online.de>2014-01-22 23:46:45 +0100
commit57e599fa024a0e5def3ddb5a4a790cfb5d9d8d4b (patch)
tree6caa3d6475cba8faa31057193833795fdb009151 /src
parent9fbca6e3a3281428f1f852271c226d5fdb6430b5 (diff)
Scripts/ZulGurub/Jeklik: fixed flying in first phase, reworked spawn and rewritten to EventMap
Closes #11277
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp280
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h8
2 files changed, 122 insertions, 166 deletions
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
index e6ef90d1638..ad2d247c1e7 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -16,13 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: Boss_Jeklik
-SD%Complete: 85
-SDComment: Problem in finding the right flying batriders for spawning and making them fly.
-SDCategory: Zul'Gurub
-EndScriptData */
-
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "zulgurub.h"
@@ -44,11 +36,47 @@ enum Spells
SPELL_CHAIN_MIND_FLAY = 26044, // Right ID unknown. So disabled
SPELL_GREATERHEAL = 23954,
SPELL_BAT_FORM = 23966,
+
// Batriders Spell
SPELL_BOMB = 40332 // Wrong ID but Magmadars bomb is not working...
};
-class boss_jeklik : public CreatureScript //jeklik
+enum BatIds
+{
+ NPC_BLOODSEEKER_BAT = 11368,
+ NPC_FRENZIED_BAT = 14965
+};
+
+enum Events
+{
+ EVENT_CHARGE_JEKLIK = 1,
+ EVENT_SONIC_BURST,
+ EVENT_SCREECH,
+ EVENT_SPAWN_BATS,
+ EVENT_SHADOW_WORD_PAIN,
+ EVENT_MIND_FLAY,
+ EVENT_CHAIN_MIND_FLAY,
+ EVENT_GREATER_HEAL,
+ EVENT_SPAWN_FLYING_BATS
+};
+
+enum Phase
+{
+ PHASE_ONE = 1,
+ PHASE_TWO = 2
+};
+
+Position const SpawnBat[6] =
+{
+ { -12291.6220f, -1380.2640f, 144.8304f, 5.483f },
+ { -12289.6220f, -1380.2640f, 144.8304f, 5.483f },
+ { -12293.6220f, -1380.2640f, 144.8304f, 5.483f },
+ { -12291.6220f, -1380.2640f, 144.8304f, 5.483f },
+ { -12289.6220f, -1380.2640f, 144.8304f, 5.483f },
+ { -12293.6220f, -1380.2640f, 144.8304f, 5.483f }
+};
+
+class boss_jeklik : public CreatureScript
{
public: boss_jeklik() : CreatureScript("boss_jeklik") { }
@@ -56,32 +84,9 @@ class boss_jeklik : public CreatureScript //jeklik
{
boss_jeklikAI(Creature* creature) : BossAI(creature, DATA_JEKLIK) { }
- uint32 Charge_Timer;
- uint32 SonicBurst_Timer;
- uint32 Screech_Timer;
- uint32 SpawnBats_Timer;
- uint32 ShadowWordPain_Timer;
- uint32 MindFlay_Timer;
- uint32 ChainMindFlay_Timer;
- uint32 GreaterHeal_Timer;
- uint32 SpawnFlyingBats_Timer;
-
- bool PhaseTwo;
-
void Reset() OVERRIDE
{
_Reset();
- Charge_Timer = 20000;
- SonicBurst_Timer = 8000;
- Screech_Timer = 13000;
- SpawnBats_Timer = 60000;
- ShadowWordPain_Timer = 6000;
- MindFlay_Timer = 11000;
- ChainMindFlay_Timer = 26000;
- GreaterHeal_Timer = 50000;
- SpawnFlyingBats_Timer = 10000;
-
- PhaseTwo = false;
}
void JustDied(Unit* /*killer*/) OVERRIDE
@@ -94,156 +99,124 @@ class boss_jeklik : public CreatureScript //jeklik
{
_EnterCombat();
Talk(SAY_AGGRO);
+ events.SetPhase(PHASE_ONE);
+
+ events.ScheduleEvent(EVENT_CHARGE_JEKLIK, 20000, 0, PHASE_ONE);
+ events.ScheduleEvent(EVENT_SONIC_BURST, 8000, 0, PHASE_ONE);
+ events.ScheduleEvent(EVENT_SCREECH, 13000, 0, PHASE_ONE);
+ events.ScheduleEvent(EVENT_SPAWN_BATS, 60000, 0, PHASE_ONE);
+
+ me->SetCanFly(true);
DoCast(me, SPELL_BAT_FORM);
}
+ void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE
+ {
+ if (events.IsInPhase(PHASE_ONE) && !HealthAbovePct(50))
+ {
+ me->RemoveAurasDueToSpell(SPELL_BAT_FORM);
+ me->SetCanFly(false);
+ DoResetThreat();
+ events.SetPhase(PHASE_TWO);
+ events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 6000, 0, PHASE_TWO);
+ events.ScheduleEvent(EVENT_MIND_FLAY, 11000, 0, PHASE_TWO);
+ events.ScheduleEvent(EVENT_CHAIN_MIND_FLAY, 26000, 0, PHASE_TWO);
+ events.ScheduleEvent(EVENT_GREATER_HEAL, 50000, 0, PHASE_TWO);
+ events.ScheduleEvent(EVENT_SPAWN_FLYING_BATS, 10000, 0, PHASE_TWO);
+ return;
+ }
+ }
+
void UpdateAI(uint32 diff) OVERRIDE
{
if (!UpdateVictim())
return;
- if (me->GetVictim() && me->IsAlive())
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- if (HealthAbovePct(50))
+ switch (eventId)
{
- if (Charge_Timer <= diff)
- {
+ case EVENT_CHARGE_JEKLIK:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
DoCast(target, SPELL_CHARGE);
AttackStart(target);
}
-
- Charge_Timer = urand(15000, 30000);
- } else Charge_Timer -= diff;
-
- if (SonicBurst_Timer <= diff)
- {
+ events.ScheduleEvent(EVENT_CHARGE_JEKLIK, urand(15000, 30000), 0, PHASE_ONE);
+ break;
+ case EVENT_SONIC_BURST:
DoCastVictim(SPELL_SONICBURST);
- SonicBurst_Timer = urand(8000, 13000);
- } else SonicBurst_Timer -= diff;
-
- if (Screech_Timer <= diff)
- {
+ events.ScheduleEvent(EVENT_SONIC_BURST, urand(8000, 13000), 0, PHASE_ONE);
+ case EVENT_SCREECH:
DoCastVictim(SPELL_SCREECH);
- Screech_Timer = urand(18000, 26000);
- } else Screech_Timer -= diff;
-
- if (SpawnBats_Timer <= diff)
- {
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
-
- Creature* Bat = NULL;
- Bat = me->SummonCreature(11368, -12291.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
- if (target && Bat) Bat ->AI()->AttackStart(target);
-
- Bat = me->SummonCreature(11368, -12289.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
- if (target && Bat) Bat ->AI()->AttackStart(target);
-
- Bat = me->SummonCreature(11368, -12293.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
- if (target && Bat) Bat ->AI()->AttackStart(target);
-
- Bat = me->SummonCreature(11368, -12291.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
- if (target && Bat) Bat ->AI()->AttackStart(target);
-
- Bat = me->SummonCreature(11368, -12289.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
- if (target && Bat) Bat ->AI()->AttackStart(target);
- Bat = me->SummonCreature(11368, -12293.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
- if (target && Bat) Bat ->AI()->AttackStart(target);
-
- SpawnBats_Timer = 60000;
- } else SpawnBats_Timer -= diff;
- }
- else
- {
- if (PhaseTwo)
- {
- if (ShadowWordPain_Timer <= diff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- {
- DoCast(target, SPELL_SHADOW_WORD_PAIN);
- ShadowWordPain_Timer = urand(12000, 18000);
- }
- }ShadowWordPain_Timer -=diff;
-
- if (MindFlay_Timer <= diff)
- {
- DoCastVictim(SPELL_MIND_FLAY);
- MindFlay_Timer = 16000;
- }MindFlay_Timer -=diff;
-
- if (ChainMindFlay_Timer <= diff)
- {
- me->InterruptNonMeleeSpells(false);
- DoCastVictim(SPELL_CHAIN_MIND_FLAY);
- ChainMindFlay_Timer = urand(15000, 30000);
- }ChainMindFlay_Timer -=diff;
-
- if (GreaterHeal_Timer <= diff)
- {
- me->InterruptNonMeleeSpells(false);
- DoCast(me, SPELL_GREATERHEAL);
- GreaterHeal_Timer = urand(25000, 35000);
- }GreaterHeal_Timer -=diff;
-
- if (SpawnFlyingBats_Timer <= diff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- {
- if (Creature* FlyingBat = me->SummonCreature(14965, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+15, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
- FlyingBat->AI()->AttackStart(target);
- }
-
- SpawnFlyingBats_Timer = urand(10000, 15000);
- } else SpawnFlyingBats_Timer -=diff;
- }
- else
- {
- me->SetDisplayId(15219);
- DoResetThreat();
- PhaseTwo = true;
- }
+ events.ScheduleEvent(EVENT_SCREECH, urand(18000, 26000), 0, PHASE_ONE);
+ case EVENT_SPAWN_BATS:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ for (uint8 i = 0; i < 6; ++i)
+ if (Creature* bat = me->SummonCreature(NPC_BLOODSEEKER_BAT, SpawnBat[i], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
+ bat->AI()->AttackStart(target);
+ events.ScheduleEvent(EVENT_SPAWN_BATS, 60000, 0, PHASE_ONE);
+ break;
+ case EVENT_SHADOW_WORD_PAIN:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ DoCast(target, SPELL_SHADOW_WORD_PAIN);
+ events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, urand(12000, 18000), 0, PHASE_TWO);
+ break;
+ case EVENT_MIND_FLAY:
+ DoCastVictim(SPELL_MIND_FLAY);
+ events.ScheduleEvent(EVENT_MIND_FLAY, 16000, 0, PHASE_TWO);
+ break;
+ case EVENT_CHAIN_MIND_FLAY:
+ me->InterruptNonMeleeSpells(false);
+ DoCastVictim(SPELL_CHAIN_MIND_FLAY);
+ events.ScheduleEvent(EVENT_CHAIN_MIND_FLAY, urand(15000, 30000), 0, PHASE_TWO);
+ break;
+ case EVENT_GREATER_HEAL:
+ me->InterruptNonMeleeSpells(false);
+ DoCast(me, SPELL_GREATERHEAL);
+ events.ScheduleEvent(EVENT_GREATER_HEAL, urand(25000, 35000), 0, PHASE_TWO);
+ break;
+ case EVENT_SPAWN_FLYING_BATS:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ if (Creature* flyingBat = me->SummonCreature(NPC_FRENZIED_BAT, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + 15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
+ flyingBat->AI()->AttackStart(target);
+ events.ScheduleEvent(EVENT_SPAWN_FLYING_BATS, urand(10000, 15000), 0, PHASE_TWO);
+ break;
+ default:
+ break;
}
-
- DoMeleeAttackIfReady();
}
+
+ DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
- return new boss_jeklikAI(creature);
+ return GetZulGurubAI<boss_jeklikAI>(creature);
}
};
-//Flying Bat
+// Flying Bat
class npc_batrider : public CreatureScript
{
public:
-
- npc_batrider()
- : CreatureScript("npc_batrider")
- {
- }
+ npc_batrider() : CreatureScript("npc_batrider") { }
struct npc_batriderAI : public ScriptedAI
{
- npc_batriderAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = creature->GetInstanceScript();
- }
-
- InstanceScript* instance;
+ npc_batriderAI(Creature* creature) : ScriptedAI(creature) { }
uint32 Bomb_Timer;
- uint32 Check_Timer;
void Reset() OVERRIDE
{
Bomb_Timer = 2000;
- Check_Timer = 1000;
-
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
@@ -254,7 +227,6 @@ class npc_batrider : public CreatureScript
if (!UpdateVictim())
return;
- //Bomb_Timer
if (Bomb_Timer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
@@ -262,20 +234,9 @@ class npc_batrider : public CreatureScript
DoCast(target, SPELL_BOMB);
Bomb_Timer = 5000;
}
- } else Bomb_Timer -= diff;
-
- //Check_Timer
- if (Check_Timer <= diff)
- {
- if (instance->GetBossState(DATA_JEKLIK) == DONE)
- {
- me->setDeathState(JUST_DIED);
- me->RemoveCorpse();
- return;
- }
-
- Check_Timer = 1000;
- } else Check_Timer -= diff;
+ }
+ else
+ Bomb_Timer -= diff;
DoMeleeAttackIfReady();
}
@@ -283,7 +244,7 @@ class npc_batrider : public CreatureScript
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
- return GetInstanceAI<npc_batriderAI>(creature);
+ return new npc_batriderAI(creature);
}
};
@@ -292,4 +253,3 @@ void AddSC_boss_jeklik()
new boss_jeklik();
new npc_batrider();
}
-
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
index c92e8b8724d..a9386ff1782 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
@@ -66,13 +66,9 @@ enum GameobjectIds
};
template<class AI>
-CreatureAI* GetZulGurubAI(Creature* creature)
+AI* GetZulGurubAI(Creature* creature)
{
- if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(ZGScriptName))
- return new AI(creature);
- return NULL;
+ return GetInstanceAI<AI>(creature, ZGScriptName);
}
#endif