Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_drakos.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "oculus.h"
9
19
21{
27};
28
33
40
42{
43public:
44 boss_drakos() : CreatureScript("boss_drakos") { }
45
47 {
48 return new boss_drakosAI(creature);
49 }
50
51 struct boss_drakosAI : public BossAI
52 {
53 boss_drakosAI(Creature* creature) : BossAI(creature, DATA_DRAKOS_EVENT) { }
54
56 {
57 _Reset();
58
59 events.ScheduleEvent(EVENT_MAGIC_PULL, 15000);
60 events.ScheduleEvent(EVENT_STOMP, 17000);
61 events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000);
62
63 postPull = false;
64 }
65
66 void EnterCombat(Unit* /*who*/) OVERRIDE
67 {
70 }
71
73 {
74 //Return since we have no target
75 if (!UpdateVictim())
76 return;
77
78 events.Update(diff);
79
80 if (me->HasUnitState(UNIT_STATE_CASTING))
81 return;
82
83 while (uint32 eventId = events.ExecuteEvent())
84 {
85 switch (eventId)
86 {
88 {
89 Position pPosition;
90 me->GetPosition(&pPosition);
91
92 for (uint8 i = 0; i <= (postPull ? 3 : 0); i++)
93 {
94 me->GetRandomNearPosition(pPosition, float(std::rand() % 10));
95 me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition);
96 }
97 }
98 events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000);
99 break;
100 case EVENT_MAGIC_PULL:
102 postPull = true;
103 events.ScheduleEvent(EVENT_MAGIC_PULL, 15000);
104 break;
105 case EVENT_STOMP:
108 events.ScheduleEvent(EVENT_STOMP, 17000);
109 break;
110 }
111 }
112
114 }
115
116 void JustDied(Unit* /*killer*/) OVERRIDE
117 {
118 _JustDied();
119
121
122 // start achievement timer (kill Eregos within 20 min)
124 }
125
126 void KilledUnit(Unit* /*victim*/) OVERRIDE
127 {
128 Talk(SAY_KILL);
129 }
130 private:
132 };
133};
134
136{
137public:
138 npc_unstable_sphere() : CreatureScript("npc_unstable_sphere") { }
139
141 {
142 return new npc_unstable_sphereAI(creature);
143 }
144
146 {
147 npc_unstable_sphereAI(Creature* creature) : ScriptedAI(creature) { }
148
150 {
151 me->SetReactState(REACT_PASSIVE);
152 me->GetMotionMaster()->MoveRandom(40.0f);
153
156
157 pulseTimer = 3000;
158 deathTimer = 19000;
159 }
160
162 {
163 if (pulseTimer <= diff)
164 {
167 } else pulseTimer -= diff;
168
169 if (deathTimer <= diff)
170 me->DisappearAndDie();
171 else deathTimer -= diff;
172 }
173 private:
176 };
177};
178
180{
181 new boss_drakos();
183}
@ IN_MILLISECONDS
Definition Common.h:125
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition DBCEnums.h:158
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ REACT_PASSIVE
Definition Unit.h:1156
#define SAY_DEATH
#define SAY_AGGRO
#define SAY_KILL
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_KILL
@ SAY_STOMP
@ SAY_PULL
@ SPELL_UNSTABLE_SPHERE_PULSE
@ SPELL_THUNDERING_STOMP
@ NPC_UNSTABLE_SPHERE
@ SPELL_UNSTABLE_SPHERE_PASSIVE
@ SPELL_UNSTABLE_SPHERE_TIMER
@ SPELL_MAGIC_PULL
void AddSC_boss_drakos()
DrakosAchievement
@ ACHIEV_TIMED_START_EVENT
DrakosEvents
@ EVENT_MAGIC_PULL
@ EVENT_BOMB_SUMMON
@ EVENT_STOMP
@ EVENT_STOMP
InstanceScript *const instance
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_DRAKOS_EVENT
Definition oculus.h:11
@ ACHIEV_TIMED_START_EVENT
Creature * me
ScriptedAI(Creature *creature)
void KilledUnit(Unit *) OVERRIDE
void JustDied(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
boss_drakosAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================