Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_terestian_illhoof.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_Terestian_Illhoof
8SD%Complete: 95
9SDComment: Complete! Needs adjustments to use spell though.
10SDCategory: Karazhan
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "karazhan.h"
16#include "PassiveAI.h"
17
26
28{
29 SPELL_SUMMON_DEMONCHAINS = 30120, // Summons demonic chains that maintain the ritual of sacrifice.
30 SPELL_DEMON_CHAINS = 30206, // Instant - Visual Effect
31 SPELL_ENRAGE = 23537, // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min.
32 SPELL_SHADOW_BOLT = 30055, // Hurls a bolt of dark magic at an enemy, inflicting Shadow damage.
33 SPELL_SACRIFICE = 30115, // Teleports and adds the debuff
34 SPELL_BERSERK = 32965, // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley.
35 SPELL_SUMMON_FIENDISIMP = 30184, // Summons a Fiendish Imp.
36 SPELL_SUMMON_IMP = 30066, // Summons Kil'rek
37
38 SPELL_FIENDISH_PORTAL = 30171, // Opens portal and summons Fiendish Portal, 2 sec cast
39 SPELL_FIENDISH_PORTAL_1 = 30179, // Opens portal and summons Fiendish Portal, instant cast
40
41 SPELL_FIREBOLT = 30050, // Blasts a target for 150 Fire damage.
42 SPELL_BROKEN_PACT = 30065, // All damage taken increased by 25%.
43 SPELL_AMPLIFY_FLAMES = 30053, // Increases the Fire damage taken by an enemy by 500 for 25 sec.
44};
45
47{
50 NPC_PORTAL = 17265,
51 NPC_KILREK = 17229
52};
53
55{
56public:
57 npc_kilrek() : CreatureScript("npc_kilrek") { }
58
60 {
61 return new npc_kilrekAI(creature);
62 }
63
64 struct npc_kilrekAI : public ScriptedAI
65 {
66 npc_kilrekAI(Creature* creature) : ScriptedAI(creature)
67 {
68 instance = creature->GetInstanceScript();
69
70 TerestianGUID = 0;
71
72 AmplifyTimer = 0;
73 }
74
76 {
77 TerestianGUID = 0;
78 AmplifyTimer = 2000;
79 }
80
81 void EnterCombat(Unit* /*who*/) OVERRIDE
82 {
83 if (!instance)
84 {
86 return;
87 }
88 }
89
90 void JustDied(Unit* /*killer*/) OVERRIDE
91 {
92 if (instance)
93 {
95 if (TerestianGUID)
96 {
97 Unit* Terestian = Unit::GetUnit(*me, TerestianGUID);
98 if (Terestian && Terestian->IsAlive())
99 DoCast(Terestian, SPELL_BROKEN_PACT, true);
100 }
101 } else ERROR_INST_DATA(me);
102 }
103
105 {
106 //Return since we have no target
107 if (!UpdateVictim())
108 return;
109
110 if (AmplifyTimer <= diff)
111 {
112 me->InterruptNonMeleeSpells(false);
114
115 AmplifyTimer = std::rand() % 20000 + 10000;
116 } else AmplifyTimer -= diff;
117
119 }
120
121 private:
125 };
126};
127
129{
130public:
131 npc_demon_chain() : CreatureScript("npc_demon_chain") { }
132
134 {
135 return new npc_demon_chainAI(creature);
136 }
137
139 {
140 npc_demon_chainAI(Creature* creature) : ScriptedAI(creature)
141 {
142 SacrificeGUID = 0;
143 }
144
146 {
147 SacrificeGUID = 0;
148 }
149
150 void EnterCombat(Unit* /*who*/) OVERRIDE { }
151 void AttackStart(Unit* /*who*/) OVERRIDE { }
152 void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { }
153
154
155 void JustDied(Unit* /*killer*/) OVERRIDE
156 {
157 if (SacrificeGUID)
158 {
159 Unit* Sacrifice = Unit::GetUnit(*me, SacrificeGUID);
160 if (Sacrifice)
162 }
163 }
164
166 };
167};
168
170{
171public:
172 npc_fiendish_portal() : CreatureScript("npc_fiendish_portal") { }
173
175 {
176 return new npc_fiendish_portalAI(creature);
177 }
178
180 {
182
184
186 {
188 }
189
191 {
192 summons.Summon(summon);
193 DoZoneInCombat(summon);
194 }
195
197 {
198 summons.DespawnAll();
199 }
200 };
201};
202
204{
205public:
206 npc_fiendish_imp() : CreatureScript("npc_fiendish_imp") { }
207
209 {
210 return new npc_fiendish_impAI(creature);
211 }
212
214 {
216 {
217 FireboltTimer = 0;
218 }
219
221 {
222 FireboltTimer = 2000;
223
224 me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true);
225 }
226
227 void EnterCombat(Unit* /*who*/) OVERRIDE { }
228
230 {
231 //Return since we have no target
232 if (!UpdateVictim())
233 return;
234
235 if (FireboltTimer <= diff)
236 {
238 FireboltTimer = 2200;
239 } else FireboltTimer -= diff;
240
242 }
243
244 private:
246 };
247};
248
250{
251public:
252 boss_terestian_illhoof() : CreatureScript("boss_terestian_illhoof") { }
253
255 {
256 return new boss_terestianAI(creature);
257 }
258
260 {
261 boss_terestianAI(Creature* creature) : ScriptedAI(creature)
262 {
263 instance = creature->GetInstanceScript();
264 for (uint8 i = 0; i < 2; ++i)
265 PortalGUID[i] = 0;
266
267 PortalsCount = 0;
268
269 SacrificeTimer = 0;
270 ShadowboltTimer = 0;
271 SummonTimer = 0;
272 BerserkTimer = 0;
273
274 SummonedPortals = false;
275 Berserk = false;
276 }
277
279 {
280 for (uint8 i = 0; i < 2; ++i)
281 {
282 if (PortalGUID[i])
283 {
284 if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[i]))
285 {
286 CAST_AI(npc_fiendish_portal::npc_fiendish_portalAI, pPortal->AI())->DespawnAllImp();
287 pPortal->DespawnOrUnsummon();
288 }
289
290 PortalGUID[i] = 0;
291 }
292 }
293
294 PortalsCount = 0;
295 SacrificeTimer = 30000;
296 ShadowboltTimer = 5000;
297 SummonTimer = 10000;
298 BerserkTimer = 600000;
299
300 SummonedPortals = false;
301 Berserk = false;
302
303 if (instance)
305
306 me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT);
307
308 if (Minion* Kilrek = me->GetFirstMinion())
309 {
310 if (!Kilrek->IsAlive())
311 {
312 Kilrek->UnSummon();
313 DoCast(me, SPELL_SUMMON_IMP, true);
314 }
315 }
316 else DoCast(me, SPELL_SUMMON_IMP, true);
317 }
318
319 void EnterCombat(Unit* /*who*/) OVERRIDE
320 {
322 }
323
325 {
326 if (summoned->GetEntry() == NPC_PORTAL)
327 {
328 PortalGUID[PortalsCount] = summoned->GetGUID();
329 ++PortalsCount;
330
331 if (summoned->GetUInt32Value(UNIT_FIELD_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1)
332 {
334 SummonedPortals = true;
335 }
336 }
337 }
338
339 void KilledUnit(Unit* /*victim*/) OVERRIDE
340 {
341 Talk(SAY_SLAY);
342 }
343
344 void JustDied(Unit* /*killer*/) OVERRIDE
345 {
346 for (uint8 i = 0; i < 2; ++i)
347 {
348 if (PortalGUID[i])
349 {
350 if (Creature* pPortal = Unit::GetCreature((*me), PortalGUID[i]))
351 pPortal->DespawnOrUnsummon();
352
353 PortalGUID[i] = 0;
354 }
355 }
356
358
359 if (instance)
360 instance->SetData(TYPE_TERESTIAN, DONE);
361 }
362
364 {
365 if (!UpdateVictim())
366 return;
367
368 if (SacrificeTimer <= diff)
369 {
370 Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
371 if (target && target->IsAlive())
372 {
373 DoCast(target, SPELL_SACRIFICE, true);
374 DoCast(target, SPELL_SUMMON_DEMONCHAINS, true);
375
376 if (Creature* Chains = me->FindNearestCreature(NPC_DEMONCHAINS, 5000))
377 {
378 CAST_AI(npc_demon_chain::npc_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID();
379 Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true);
381 SacrificeTimer = 30000;
382 }
383 }
384 } else SacrificeTimer -= diff;
385
386 if (ShadowboltTimer <= diff)
387 {
389 ShadowboltTimer = 10000;
390 } else ShadowboltTimer -= diff;
391
392 if (SummonTimer <= diff)
393 {
394 if (!PortalGUID[0])
396
397 if (!PortalGUID[1])
399
400 if (PortalGUID[0] && PortalGUID[1])
401 {
402 if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[std::rand() % 1]))
403 pPortal->CastSpell(me->GetVictim(), SPELL_SUMMON_FIENDISIMP, false);
404 SummonTimer = 5000;
405 }
406 } else SummonTimer -= diff;
407
408 if (!Berserk)
409 {
410 if (BerserkTimer <= diff)
411 {
413 Berserk = true;
414 } else BerserkTimer -= diff;
415 }
416
418 }
419
420 private:
422
425
430
433 };
434};
435
437{
439 new npc_fiendish_imp();
441 new npc_kilrek();
442 new npc_demon_chain();
443}
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
@ DONE
@ NOT_STARTED
#define CAST_AI(a, b)
@ IMMUNITY_SCHOOL
@ SPELL_SCHOOL_MASK_FIRE
@ SELECT_TARGET_TOPAGGRO
Definition UnitAI.h:24
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_CREATED_BY_SPELL
Creatures
@ SPELL_ENRAGE
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
#define SPELL_BERSERK
@ SPELL_SHADOW_BOLT
void AddSC_boss_terestian_illhoof()
@ SPELL_SUMMON_DEMONCHAINS
@ SPELL_FIENDISH_PORTAL_1
@ SPELL_AMPLIFY_FLAMES
@ SPELL_FIENDISH_PORTAL
@ SPELL_SUMMON_FIENDISIMP
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:56
CreatureScript(const char *name)
uint64 GetGUID() const
Definition Object.h:119
PassiveAI(Creature *c)
Definition PassiveAI.cpp:10
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
Definition Unit.h:1367
void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID=0, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
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
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
#define ERROR_INST_DATA(a)
Definition karazhan.h:52
@ DATA_TERESTIAN
Definition karazhan.h:28
@ TYPE_TERESTIAN
Definition karazhan.h:18
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void JustSummoned(Creature *summoned) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterCombat(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================