Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_kelidan_the_breaker.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/* ScriptData
7SDName: Boss_Kelidan_The_Breaker
8SD%Complete: 100
9SDComment:
10SDCategory: Hellfire Citadel, Blood Furnace
11EndScriptData */
12
13/* ContentData
14boss_kelidan_the_breaker
15npc_shadowmoon_channeler
16EndContentData */
17
18#include "ScriptMgr.h"
19#include "ScriptedCreature.h"
20#include "SpellAuras.h"
21#include "blood_furnace.h"
22
48
49const float ShadowmoonChannelers[5][4]=
50{
51 {302.0f, -87.0f, -24.4f, 0.157f},
52 {321.0f, -63.5f, -24.6f, 4.887f},
53 {346.0f, -74.5f, -24.6f, 3.595f},
54 {344.0f, -103.5f, -24.5f, 2.356f},
55 {316.0f, -109.0f, -24.6f, 1.257f}
56};
57
59{
60 public:
61 boss_kelidan_the_breaker() : CreatureScript("boss_kelidan_the_breaker") { }
62
64 {
66 {
67 instance = creature->GetInstanceScript();
68 for (uint8 i=0; i<5; ++i)
69 Channelers[i] = 0;
70 }
71
73
80 bool addYell;
82
97
99 {
100 Talk(SAY_WAKE);
101 if (me->IsNonMeleeSpellCasted(false))
102 me->InterruptNonMeleeSpells(true);
103 DoStartMovement(who);
104 if (instance)
106 }
107
108 void KilledUnit(Unit* /*victim*/) OVERRIDE
109 {
110 if (rand()%2)
111 return;
112
113 Talk(SAY_KILL);
114 }
115
117 {
118 if (who && !addYell)
119 {
120 addYell = true;
122 }
123 for (uint8 i=0; i<5; ++i)
124 {
125 Creature* channeler = Unit::GetCreature(*me, Channelers[i]);
126 if (who && channeler && !channeler->IsInCombat())
127 channeler->AI()->AttackStart(who);
128 }
129 }
130
131 void ChannelerDied(Unit* killer)
132 {
133 for (uint8 i=0; i<5; ++i)
134 {
135 Creature* channeler = Unit::GetCreature(*me, Channelers[i]);
136 if (channeler && channeler->IsAlive())
137 return;
138 }
139 me->SetReactState(REACT_AGGRESSIVE);
141 if (killer)
142 me->AI()->AttackStart(killer);
143 }
144
146 {
148 if (!channeler1)
149 return 0;
150
151 uint8 i;
152 for (i=0; i<5; ++i)
153 {
154 Creature* channeler = Unit::GetCreature(*me, Channelers[i]);
155 if (channeler && channeler->GetGUID() == channeler1->GetGUID())
156 break;
157 }
158 return Channelers[(i+2)%5];
159 }
160
162 {
163 for (uint8 i=0; i<5; ++i)
164 {
165 Creature* channeler = Unit::GetCreature(*me, Channelers[i]);
166 if (!channeler || channeler->isDead())
168 if (channeler)
169 Channelers[i] = channeler->GetGUID();
170 else
171 Channelers[i] = 0;
172 }
173 }
174
175 void JustDied(Unit* /*killer*/) OVERRIDE
176 {
177 Talk(SAY_DIE);
178
179 if (!instance)
180 return;
181
183 instance->HandleGameObject(instance->GetData64(DATA_DOOR1), true);
184 instance->HandleGameObject(instance->GetData64(DATA_DOOR6), true);
185 }
186
188 {
189 if (!UpdateVictim())
190 {
191 if (check_Timer <= diff)
192 {
193 if (!me->IsNonMeleeSpellCasted(false))
195 check_Timer = 5000;
196 }
197 else
198 check_Timer -= diff;
199 return;
200 }
201
202 if (Firenova)
203 {
204 if (Firenova_Timer <= diff)
205 {
206 DoCast(me, SPELL_FIRE_NOVA, true);
207 Firenova = false;
208 ShadowVolley_Timer = 2000;
209 }
210 else
211 Firenova_Timer -=diff;
212
213 return;
214 }
215
216 if (ShadowVolley_Timer <= diff)
217 {
219 ShadowVolley_Timer = 5000+rand()%8000;
220 }
221 else
222 ShadowVolley_Timer -=diff;
223
224 if (Corruption_Timer <= diff)
225 {
227 Corruption_Timer = 30000+rand()%20000;
228 }
229 else
230 Corruption_Timer -=diff;
231
232 if (BurningNova_Timer <= diff)
233 {
234 if (me->IsNonMeleeSpellCasted(false))
235 me->InterruptNonMeleeSpells(true);
236
237 Talk(SAY_NOVA);
238
239 if (SpellInfo const* nova = sSpellMgr->GetSpellInfo(SPELL_BURNING_NOVA))
240 {
242 aura->ApplyForTargets();
243 }
244
245 if (IsHeroic())
246 DoTeleportAll(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
247
248 BurningNova_Timer = 20000+rand()%8000;
249 Firenova_Timer= 5000;
250 Firenova = true;
251 }
252 else
253 BurningNova_Timer -=diff;
254
256 }
257 };
258
260 {
261 return new boss_kelidan_the_breakerAI(creature);
262 }
263};
264
265/*######
266## npc_shadowmoon_channeler
267######*/
268
277
279{
280 public:
281 npc_shadowmoon_channeler() : CreatureScript("npc_shadowmoon_channeler") { }
282
284 {
286
290
292 {
293 ShadowBolt_Timer = 1000+rand()%1000;
294 MarkOfShadow_Timer = 5000+rand()%2000;
295 check_Timer = 0;
296 if (me->IsNonMeleeSpellCasted(false))
297 me->InterruptNonMeleeSpells(true);
298 }
299
301 {
302 if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
304 if (me->IsNonMeleeSpellCasted(false))
305 me->InterruptNonMeleeSpells(true);
306 DoStartMovement(who);
307 }
308
309 void JustDied(Unit* killer) OVERRIDE
310 {
311 if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
313 }
314
316 {
317 if (!UpdateVictim())
318 {
319 if (check_Timer <= diff)
320 {
321 if (!me->IsNonMeleeSpellCasted(false))
322 if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
323 {
325 if (Unit* channeled = Unit::GetUnit(*me, channeler))
326 DoCast(channeled, SPELL_CHANNELING);
327 }
328 check_Timer = 5000;
329 }
330 else
331 check_Timer -= diff;
332 return;
333 }
334
335 if (MarkOfShadow_Timer <= diff)
336 {
337 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
339 MarkOfShadow_Timer = 15000+rand()%5000;
340 }
341 else
342 MarkOfShadow_Timer -=diff;
343
344 if (ShadowBolt_Timer <= diff)
345 {
347 ShadowBolt_Timer = 5000+rand()%1000;
348 }
349 else
350 ShadowBolt_Timer -=diff;
351
353 }
354 };
355
357 {
358 return new npc_shadowmoon_channelerAI(creature);
359 }
360};
361
367
#define MAX_EFFECT_MASK
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition Object.h:73
#define CAST_AI(a, b)
#define sSpellMgr
Definition SpellMgr.h:744
@ REACT_PASSIVE
Definition Unit.h:1156
@ REACT_AGGRESSIVE
Definition Unit.h:1158
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_IMMUNE_TO_NPC
Definition Unit.h:634
@ UNIT_FLAG_IMMUNE_TO_PC
Definition Unit.h:633
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ DATA_DOOR6
@ DATA_DOOR1
@ TYPE_KELIDAN_THE_BREAKER_EVENT
#define SAY_KILL
@ SPELL_EVOCATION
@ SPELL_SHADOW_BOLT
@ SPELL_SHADOW_BOLT_VOLLEY
@ H_SPELL_SHADOW_BOLT_VOLLEY
const float ShadowmoonChannelers[5][4]
void AddSC_boss_kelidan_the_breaker()
@ SPELL_SHADOW_BOLT_VOLLEY
static Aura * TryRefreshStackOrCreate(SpellInfo const *spellproto, uint32 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=NULL, Item *castItem=NULL, uint64 casterGUID=0, bool *refresh=NULL)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureAI * AI() const
Definition Creature.h:483
CreatureScript(const char *name)
uint64 GetGUID() const
Definition Object.h:119
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:16
Definition Unit.h:1367
bool IsAlive() const
Definition Unit.h:2032
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
bool IsInCombat() const
Definition Unit.h:1896
bool isDead() const
Definition Unit.h:2040
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool IsHeroic() const
Creature * me
void DoTeleportAll(float x, float y, float z, float o)
ScriptedAI(Creature *creature)
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================