Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_jedoga_shadowseeker.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/*
7 * Comment: Complete - BUT THE TRIGGER NEEDS DATA WHETHER THE PRISON OF TALDARAM IS OFFLINE !
8 */
9
10#include "ScriptMgr.h"
11#include "ScriptedCreature.h"
12#include "ahnkahet.h"
13
14
24
36
38{
39 {372.330994f, -705.278015f, -0.624178f, 5.427970f},
40 {372.330994f, -705.278015f, -16.179716f, 5.427970f}
41};
42
48
50{
51public:
52 boss_jedoga_shadowseeker() : CreatureScript("boss_jedoga_shadowseeker") { }
53
55 {
57 {
58 instance = creature->GetInstanceScript();
59 bFirstTime = true;
60 bPreDone = false;
61 }
62
64
69
77
79 {
80 uiOpFerTimer = std::rand() % (20 * IN_MILLISECONDS) + (15*IN_MILLISECONDS);
81
85
86 bOpFerok = false;
87 bOpFerokFail = false;
88 bOnGround = false;
89 bCanDown = false;
90 volunteerWork = true;
91
92 if (instance)
93 {
94 if (!bFirstTime)
96
97 instance->SetData64(DATA_PL_JEDOGA_TARGET, 0);
98 instance->SetData64(DATA_ADD_JEDOGA_OPFER, 0);
100 }
101 MoveUp();
102
103 bFirstTime = false;
104 }
105
107 {
108 if (!instance || (who->GetTypeId() == TypeID::TYPEID_UNIT && who->GetEntry() == NPC_JEDOGA_CONTROLLER))
109 return;
110
112 me->SetInCombatWithZone();
114 }
115
117 {
118 if (!who || (who->GetTypeId() == TypeID::TYPEID_UNIT && who->GetEntry() == NPC_JEDOGA_CONTROLLER))
119 return;
120
122 }
123
125 {
126 if (!Victim || Victim->GetTypeId() != TypeID::TYPEID_PLAYER)
127 return;
128
130 }
131
132 void JustDied(Unit* /*killer*/) OVERRIDE
133 {
135 if (instance)
136 instance->SetBossState(DATA_JEDOGA_SHADOWSEEKER, DONE);
137 }
138
140 {
141 if (action == ACTION_INITIAND_KILLED)
142 volunteerWork = false;
143 }
144
146 {
147 if (type == DATA_VOLUNTEER_WORK)
148 return volunteerWork ? 1 : 0;
149
150 return 0;
151 }
152
154 {
155 if (!instance || !who || (who->GetTypeId() == TypeID::TYPEID_UNIT && who->GetEntry() == NPC_JEDOGA_CONTROLLER))
156 return;
157
158 if (!bPreDone && who->GetTypeId() == TypeID::TYPEID_PLAYER && me->GetDistance(who) < 100.0f)
159 {
161 bPreDone = true;
162 }
163
164 if (instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) != IN_PROGRESS || !bOnGround)
165 return;
166
167 if (!me->GetVictim() && me->CanCreatureAttack(who))
168 {
169 float attackRadius = me->GetAttackDistance(who);
170 if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who))
171 {
172 if (!me->GetVictim())
173 {
174 who->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
175 AttackStart(who);
176 }
177 else if (me->GetMap()->IsDungeon())
178 {
179 who->SetInCombatWith(me);
180 me->AddThreat(who, 0.0f);
181 }
182 }
183 }
184 }
185
186 void MoveDown()
187 {
188 if (!instance)
189 return;
190
191 bOpFerokFail = false;
192
194 me->GetMotionMaster()->MovePoint(1, JedogaPosition[1]);
195 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false);
196 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, false);
198
199 me->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL);
200
201 bOnGround = true;
202
203 if (UpdateVictim())
204 {
205 AttackStart(me->GetVictim());
206 me->GetMotionMaster()->MoveChase(me->GetVictim());
207 }
208 else
209 {
210 if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_PL_JEDOGA_TARGET)))
211 {
212 AttackStart(target);
214 if (instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) != IN_PROGRESS)
215 EnterCombat(target);
216 }
217 else if (!me->IsInCombat())
219 }
220 }
221
222 void MoveUp()
223 {
224 if (!instance)
225 return;
226
227 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
228 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
230
231 me->AttackStop();
232 me->RemoveAllAuras();
233 me->LoadCreaturesAddon();
234 me->GetMotionMaster()->MovePoint(0, JedogaPosition[0]);
235
237 if (instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) == IN_PROGRESS)
238 OpferRufen();
239
240 bOnGround = false;
241 uiOpFerTimer = std::rand() % (30 * IN_MILLISECONDS) + (15*IN_MILLISECONDS);
242 }
243
245 {
246 if (!instance)
247 return;
248
249 uint64 opfer = instance->GetData64(DATA_ADD_JEDOGA_INITIAND);
250
251 if (opfer)
252 {
254 instance->SetData64(DATA_ADD_JEDOGA_OPFER, opfer);
255 } else
256 bCanDown = true;
257 }
258
259 void Opfern()
260 {
262
263 me->InterruptNonMeleeSpells(false);
265
266 bOpFerok = false;
267 bCanDown = true;
268 }
269
271 {
272 if (!instance)
273 return;
274
276 MoveDown();
277
278 if (bOpFerok && !bOnGround && !bCanDown) Opfern();
279
280 if (bOpFerokFail && !bOnGround && !bCanDown)
281 bCanDown = true;
282
283 if (bCanDown)
284 {
285 MoveDown();
286 bCanDown = false;
287 }
288
289 if (bOnGround)
290 {
291 if (!UpdateVictim())
292 return;
293
294 if (uiCycloneTimer <= diff)
295 {
297 uiCycloneTimer = std::rand() % (30 * IN_MILLISECONDS) + (15*IN_MILLISECONDS);
298 } else uiCycloneTimer -= diff;
299
300 if (uiBoltTimer <= diff)
301 {
302 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
303 me->CastSpell(target, DUNGEON_MODE(SPELL_LIGHTNING_BOLT, SPELL_LIGHTNING_BOLT_H), false);
304
305 uiBoltTimer = std::rand() % (30 * IN_MILLISECONDS) + (15*IN_MILLISECONDS);
306 } else uiBoltTimer -= diff;
307
308 if (uiThunderTimer <= diff)
309 {
310 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
311 me->CastSpell(target, DUNGEON_MODE(SPELL_THUNDERSHOCK, SPELL_THUNDERSHOCK_H), false);
312
313 uiThunderTimer = std::rand() % (30 * IN_MILLISECONDS) + (15*IN_MILLISECONDS);
314 } else uiThunderTimer -= diff;
315
316 if (uiOpFerTimer <= diff)
317 MoveUp();
318 else
319 uiOpFerTimer -= diff;
320
322 }
323 }
324 };
325
327 {
328 return new boss_jedoga_shadowseekerAI(creature);
329 }
330};
331
333{
334public:
335 npc_jedoga_initiand() : CreatureScript("npc_jedoga_initiand") { }
336
338 {
340 {
341 instance = creature->GetInstanceScript();
342 }
343
345
347
349
351 {
352 if (!instance)
353 return;
354
355 bWalking = false;
357
358 if (instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) != IN_PROGRESS)
359 {
360 me->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL);
361 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false);
362 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, false);
364 }
365 else
366 {
368 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
369 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
371 }
372 }
373
374 void JustDied(Unit* killer) OVERRIDE
375 {
376 if (!killer || !instance)
377 return;
378
379 if (bWalking)
380 {
382 {
384 CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = true;
385
386 if (killer->GetTypeId() == TypeID::TYPEID_PLAYER)
387 boss->AI()->DoAction(ACTION_INITIAND_KILLED);
388 }
389
390 instance->SetData64(DATA_ADD_JEDOGA_OPFER, 0);
391
392 bWalking = false;
393 }
394 if (killer->GetTypeId() == TypeID::TYPEID_PLAYER)
395 instance->SetData64(DATA_PL_JEDOGA_TARGET, killer->GetGUID());
396 }
397
398 void EnterCombat(Unit* /*who*/) OVERRIDE
399 {
400 }
401
403 {
404 if ((instance && instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) == IN_PROGRESS) || !victim)
405 return;
406
408 }
409
411
412 {
413 if ((instance && instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) == IN_PROGRESS) || !who)
414 return;
415
417 }
418
419 void MovementInform(uint32 uiType, uint32 uiPointId) OVERRIDE
420 {
421 if (uiType != POINT_MOTION_TYPE || !instance)
422 return;
423
424 switch (uiPointId)
425 {
426 case 1:
427 {
428 Creature* boss = me->GetMap()->GetCreature(instance->GetData64(DATA_JEDOGA_SHADOWSEEKER));
429 if (boss)
430 {
433 me->Kill(me);
434 }
435 }
436 break;
437 }
438 }
439
441 {
442 if (instance && bCheckTimer <= diff)
443 {
444 if (me->GetGUID() == instance->GetData64(DATA_ADD_JEDOGA_OPFER) && !bWalking)
445 {
446 me->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL);
447 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false);
448 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, false);
450
451 float distance = me->GetDistance(JedogaPosition[1]);
452
453 if (distance < 9.0f)
454 me->SetSpeed(MOVE_WALK, 0.5f, true);
455 else if (distance < 15.0f)
456 me->SetSpeed(MOVE_WALK, 0.75f, true);
457 else if (distance < 20.0f)
458 me->SetSpeed(MOVE_WALK, 1.0f, true);
459
460 me->GetMotionMaster()->Clear(false);
461 me->GetMotionMaster()->MovePoint(1, JedogaPosition[1]);
462 bWalking = true;
463 }
464 if (!bWalking)
465 {
466 if (instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) != IN_PROGRESS && me->HasAura(SPELL_SPHERE_VISUAL))
467 {
468 me->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL);
469 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false);
470 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, false);
472 }
473 if (instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) == IN_PROGRESS && !me->HasAura(SPELL_SPHERE_VISUAL))
474 {
476 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
477 me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
479 }
480 }
482 } else bCheckTimer -= diff;
483
484 //Return since we have no target
485 if (!UpdateVictim())
486 return;
487
489 }
490 };
491
493 {
494 return new npc_jedoga_initiandAI(creature);
495 }
496};
497
498// ------------------------------------------------------------------------------------------------------------
499// Jedogas Aufseher - Entry: 30181
500// ------------------------------------------------------------------------------------------------------------
506
508{
509public:
510 npc_jedogas_aufseher_trigger() : CreatureScript("npc_jedogas_aufseher_trigger") { }
511
513 {
515 {
516 instance = creature->GetInstanceScript();
517 bRemoved = false;
518 bRemoved2 = false;
519 bCasted = false;
520 bCasted2 = false;
521
522 SetCombatMovement(false);
523 }
524
526
531
532 void Reset() OVERRIDE { }
533 void EnterCombat(Unit* /*who*/) OVERRIDE { }
534 void AttackStart(Unit* /*victim*/) OVERRIDE { }
535 void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { }
536
537
538 void UpdateAI(uint32 /*diff*/) OVERRIDE
539 {
540 if (!instance)
541 return;
542
543 if (!bRemoved && me->GetPositionX() > 440.0f)
544 {
545 if (instance->GetBossState(DATA_PRINCE_TALDARAM) == DONE)
546 {
547 me->InterruptNonMeleeSpells(true);
548 bRemoved = true;
549 return;
550 }
551 if (!bCasted)
552 {
554 bCasted = true;
555 }
556 }
557 if (!bRemoved2 && me->GetPositionX() < 440.0f)
558 {
560 {
562 bCasted2 = true;
563 }
565 {
566 me->InterruptNonMeleeSpells(true);
567 bCasted2 = false;
568 }
569 if (!bRemoved2 && instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) == DONE)
570 {
571 me->InterruptNonMeleeSpells(true);
572 bRemoved2 = true;
573 }
574 }
575 }
576 };
577
579 {
580 return new npc_jedogas_aufseher_triggerAI(creature);
581 }
582};
583
585{
586 public:
588 {
589 }
590
591 bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE
592 {
593 if (!target)
594 return false;
595
596 if (Creature* Jedoga = target->ToCreature())
597 if (Jedoga->AI()->GetData(DATA_VOLUNTEER_WORK))
598 return true;
599
600 return false;
601 }
602};
603
@ IN_MILLISECONDS
Definition Common.h:125
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ IN_PROGRESS
@ FAIL
@ DONE
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition Object.h:55
@ TYPEID_UNIT
Definition Object.h:54
#define CAST_AI(a, b)
@ IMMUNITY_DAMAGE
@ SPELL_SCHOOL_MASK_NORMAL
@ SPELL_SCHOOL_MASK_MAGIC
@ SPELL_AURA_MOD_STEALTH
@ MOVE_WALK
Definition Unit.h:555
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ NPC_JEDOGA_CONTROLLER
Definition ahnkahet.h:48
@ DATA_JEDOGA_RESET_INITIANDS
Definition ahnkahet.h:30
@ DATA_PL_JEDOGA_TARGET
Definition ahnkahet.h:26
@ DATA_ALL_INITIAND_DEAD
Definition ahnkahet.h:31
@ DATA_JEDOGA_SHADOWSEEKER
Definition ahnkahet.h:18
@ DATA_JEDOGA_TRIGGER_SWITCH
Definition ahnkahet.h:29
@ DATA_ADD_JEDOGA_INITIAND
Definition ahnkahet.h:28
@ DATA_PRINCE_TALDARAM
Definition ahnkahet.h:17
@ DATA_ADD_JEDOGA_OPFER
Definition ahnkahet.h:27
@ SPELL_LIGHTNING_BOLT
void AddSC_boss_jedoga_shadowseeker()
@ SPELL_GIFT_OF_THE_HERALD
@ SPELL_BEAM_VISUAL_JEDOGAS_AUFSEHER_2
@ SPELL_BEAM_VISUAL_JEDOGAS_AUFSEHER_1
const Position JedogaPosition[2]
AchievementCriteriaScript(const char *name)
virtual void MoveInLineOfSight(Unit *)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureAI * AI() const
Definition Creature.h:483
CreatureScript(const char *name)
static Creature * GetCreature(WorldObject const &u, uint64 guid)
Creature * ToCreature()
Definition Object.h:207
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
Definition Unit.h:1367
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
bool OnCheck(Player *, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
void SetCombatMovement(bool allowMovement)
Creature * me
ScriptedAI(Creature *creature)
const T & DUNGEON_MODE(const T &normal5, const T &heroic5) const
void AttackStart(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void MovementInform(uint32 uiType, uint32 uiPointId) OVERRIDE
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================