Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_argent_challenge.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: Argent Challenge Encounter.
8SD%Complete: 50 %
9SDComment: AI for Argent Soldiers are not implemented. AI from bosses need more improvements.
10SDCategory: Trial of the Champion
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "SpellScript.h"
17#include "ScriptedEscortAI.h"
18/*
19enum Yells
20{
21 // Eadric the Pure
22 SAY_INTRO = 0,
23 SAY_AGGRO = 1,
24 EMOTE_RADIANCE = 2,
25 EMOTE_HAMMER_RIGHTEOUS = 3,
26 SAY_HAMMER_RIGHTEOUS = 4,
27 SAY_KILL_PLAYER = 5,
28 SAY_DEFEATED = 6,
29
30 // Argent Confessor Paletress
31 SAY_INTRO_1 = 0,
32 SAY_INTRO_2 = 1,
33 SAY_AGGRO = 2,
34 SAY_MEMORY_SUMMON = 3,
35 SAY_MEMORY_DEATH = 4,
36 SAY_KILL_PLAYER = 5,
37 SAY_DEFEATED = 6,
38
39 // Memory of X
40 EMOTE_WAKING_NIGHTMARE = 0
41};
42*/
44{
45 // Eadric the Pure
51
52 // Paletress
53 SPELL_SMITE = 66536,
57 SPELL_RENEW = 66537,
60 SPELL_SHIELD = 66515,
63
64 // Memory of X (Summon)
90
91 // Memory
98};
99
100class OrientationCheck : public SF_UNARY_FUNCTION<Unit*, bool>
101{
102 public:
103 explicit OrientationCheck(Unit* _caster) : caster(_caster) { }
105 {
106 return !object->isInFront(caster, 2.5f) || !object->IsWithinDist(caster, 40.0f);
107 }
108
109 private:
111};
112
138
140{
141public:
142 boss_eadric() : CreatureScript("boss_eadric") { }
143 struct boss_eadricAI : public ScriptedAI
144 {
145 boss_eadricAI(Creature* creature) : ScriptedAI(creature)
146 {
147 instance = creature->GetInstanceScript();
148 creature->SetReactState(REACT_PASSIVE);
150 }
151
153
158
159 bool bDone;
160
162 {
163 uiVenganceTimer = 10000;
164 uiRadianceTimer = 16000;
165 uiHammerJusticeTimer = 25000;
166 uiResetTimer = 5000;
167
168 bDone = false;
169 }
170
171 void DamageTaken(Unit* /*done_by*/, uint32 &damage) OVERRIDE
172 {
173 if (damage >= me->GetHealth())
174 {
175 damage = 0;
177 me->setFaction(35);
178 bDone = true;
179 }
180 }
181
182 void MovementInform(uint32 MovementType, uint32 /*Data*/) OVERRIDE
183 {
184 if (MovementType != POINT_MOTION_TYPE)
185 return;
186
187 if (instance)
189
190 me->DisappearAndDie();
191 }
192
194 {
195 if (bDone && uiResetTimer <= uiDiff)
196 {
197 me->GetMotionMaster()->MovePoint(0, 746.87f, 665.87f, 411.75f);
198 bDone = false;
199 } else uiResetTimer -= uiDiff;
200
201 if (!UpdateVictim())
202 return;
203
204 if (uiHammerJusticeTimer <= uiDiff)
205 {
206 me->InterruptNonMeleeSpells(true);
207
208 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true))
209 {
210 if (target && target->IsAlive())
211 {
214 }
215 }
216 uiHammerJusticeTimer = 25000;
217 } else uiHammerJusticeTimer -= uiDiff;
218
219 if (uiVenganceTimer <= uiDiff)
220 {
222
223 uiVenganceTimer = 10000;
224 } else uiVenganceTimer -= uiDiff;
225
226 if (uiRadianceTimer <= uiDiff)
227 {
229
230 uiRadianceTimer = 16000;
231 } else uiRadianceTimer -= uiDiff;
232
234 }
235 };
236
238 {
239 return new boss_eadricAI(creature);
240 }
241};
242
244{
245public:
246 boss_paletress() : CreatureScript("boss_paletress") { }
247
249 {
250 boss_paletressAI(Creature* creature) : ScriptedAI(creature)
251 {
252 instance = creature->GetInstanceScript();
253
254 MemoryGUID = 0;
255 creature->SetReactState(REACT_PASSIVE);
257 creature->RestoreFaction();
258 }
259
262
264 bool bDone;
265
270
272 {
273 me->RemoveAllAuras();
274
275 uiHolyFireTimer = std::rand() % 12000 + 9000;
276 uiHolySmiteTimer = std::rand() % 7000 + 5000;
277 uiRenewTimer = std::rand() % 5000 + 2000;
278
279 uiResetTimer = 7000;
280
281 bHealth = false;
282 bDone = false;
283
284 if (Creature* pMemory = Unit::GetCreature(*me, MemoryGUID))
285 if (pMemory->IsAlive())
286 pMemory->RemoveFromWorld();
287 }
288
289 void SetData(uint32 uiId, uint32 /*uiValue*/) OVERRIDE
290 {
291 if (uiId == 1)
292 me->RemoveAura(SPELL_SHIELD);
293 }
294
295 void DamageTaken(Unit* /*done_by*/, uint32 &damage) OVERRIDE
296 {
297 if (damage >= me->GetHealth())
298 {
299 damage = 0;
301 me->setFaction(35);
302 bDone = true;
303 }
304 }
305
306 void MovementInform(uint32 MovementType, uint32 Point) OVERRIDE
307 {
308 if (MovementType != POINT_MOTION_TYPE || Point != 0)
309 return;
310
311 if (instance)
313
314 me->DisappearAndDie();
315 }
316
318 {
319 if (bDone && uiResetTimer <= uiDiff)
320 {
321 me->GetMotionMaster()->MovePoint(0, 746.87f, 665.87f, 411.75f);
322 bDone = false;
323 } else uiResetTimer -= uiDiff;
324
325 if (!UpdateVictim())
326 return;
327
328 if (uiHolyFireTimer <= uiDiff)
329 {
330 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true))
331 {
332 if (target && target->IsAlive())
333 DoCast(target, SPELL_HOLY_FIRE);
334 }
335 if (me->HasAura(SPELL_SHIELD))
336 uiHolyFireTimer = 13000;
337 else
338 uiHolyFireTimer = std::rand() % 12000 + 9000;
339 } else uiHolyFireTimer -= uiDiff;
340
341 if (uiHolySmiteTimer <= uiDiff)
342 {
343 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true))
344 {
345 if (target && target->IsAlive())
346 DoCast(target, SPELL_SMITE);
347 }
348 if (me->HasAura(SPELL_SHIELD))
349 uiHolySmiteTimer = 9000;
350 else
351 uiHolySmiteTimer = std::rand() % 7000 + 5000;
352 } else uiHolySmiteTimer -= uiDiff;
353
354 if (me->HasAura(SPELL_SHIELD))
355 {
356 if (uiRenewTimer <= uiDiff)
357 {
358 me->InterruptNonMeleeSpells(true);
359 uint8 uiTarget = std::rand() % 1;
360 switch (uiTarget)
361 {
362 case 0:
364 break;
365 case 1:
366 if (Creature* pMemory = Unit::GetCreature(*me, MemoryGUID))
367 if (pMemory->IsAlive())
368 DoCast(pMemory, SPELL_RENEW);
369 break;
370 }
371 uiRenewTimer = std::rand() % 17000 + 15000;
372 } else uiRenewTimer -= uiDiff;
373 }
374
375 if (!bHealth && !HealthAbovePct(25))
376 {
377 me->InterruptNonMeleeSpells(true);
381 DoCastAOE(SPELL_CONFESS, false);
382
383 bHealth = true;
384 }
385
387 }
388
390 {
391 MemoryGUID = summon->GetGUID();
392 }
393 };
394
396 {
397 return new boss_paletressAI(creature);
398 }
399};
400
402{
403public:
404 npc_memory() : CreatureScript("npc_memory") { }
405
406 struct npc_memoryAI : public ScriptedAI
407 {
408 npc_memoryAI(Creature* creature) : ScriptedAI(creature) { }
409
413
415 {
416 uiOldWoundsTimer = 12000;
417 uiShadowPastTimer = 5000;
418 uiWakingNightmare = 7000;
419 }
420
422 {
423 if (!UpdateVictim())
424 return;
425
426 if (uiOldWoundsTimer <= uiDiff)
427 {
428 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
429 {
430 if (target && target->IsAlive())
431 DoCast(target, SPELL_OLD_WOUNDS);
432 }
433 uiOldWoundsTimer = 12000;
434 }else uiOldWoundsTimer -= uiDiff;
435
436 if (uiWakingNightmare <= uiDiff)
437 {
439 uiWakingNightmare = 7000;
440 }else uiWakingNightmare -= uiDiff;
441
442 if (uiShadowPastTimer <= uiDiff)
443 {
444 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
445 {
446 if (target && target->IsAlive())
447 DoCast(target, SPELL_SHADOWS_PAST);
448 }
449 uiShadowPastTimer = 5000;
450 }else uiShadowPastTimer -= uiDiff;
451
453 }
454
455 void JustDied(Unit* /*killer*/) OVERRIDE
456 {
457 if (TempSummon* summ = me->ToTempSummon())
458 if (Unit* summoner = summ->GetSummoner())
459 if (summoner->IsAlive())
460 summoner->GetAI()->SetData(1, 0);
461 }
462 };
463
465 {
466 return new npc_memoryAI(creature);
467 }
468};
469
471{
472public:
473 npc_argent_soldier() : CreatureScript("npc_argent_soldier") { }
474
475 // THIS AI NEEDS MORE IMPROVEMENTS
477 {
479 {
480 instance = creature->GetInstanceScript();
481 me->SetReactState(REACT_DEFENSIVE);
482 SetDespawnAtEnd(false);
483 uiWaypoint = 0;
484 }
485
487
489
491 {
492 if (waypointId == 0)
493 {
494 switch (uiWaypoint)
495 {
496 case 0:
497 me->SetFacingTo(5.81f);
498 break;
499 case 1:
500 me->SetFacingTo(4.60f);
501 break;
502 case 2:
503 me->SetFacingTo(2.79f);
504 break;
505 }
506 }
507 }
508
509 void SetData(uint32 uiType, uint32 /*uiData*/) OVERRIDE
510 {
511 switch (me->GetEntry())
512 {
514 switch (uiType)
515 {
516 case 0:
517 AddWaypoint(0, 712.14f, 628.42f, 411.88f);
518 break;
519 case 1:
520 AddWaypoint(0, 742.44f, 650.29f, 411.79f);
521 break;
522 case 2:
523 AddWaypoint(0, 783.33f, 615.29f, 411.84f);
524 break;
525 }
526 break;
527 case NPC_ARGENT_MONK:
528 switch (uiType)
529 {
530 case 0:
531 AddWaypoint(0, 713.12f, 632.97f, 411.90f);
532 break;
533 case 1:
534 AddWaypoint(0, 746.73f, 650.24f, 411.56f);
535 break;
536 case 2:
537 AddWaypoint(0, 781.32f, 610.54f, 411.82f);
538 break;
539 }
540 break;
541 case NPC_PRIESTESS:
542 switch (uiType)
543 {
544 case 0:
545 AddWaypoint(0, 715.06f, 637.07f, 411.91f);
546 break;
547 case 1:
548 AddWaypoint(0, 750.72f, 650.20f, 411.77f);
549 break;
550 case 2:
551 AddWaypoint(0, 779.77f, 607.03f, 411.81f);
552 break;
553 }
554 break;
555 }
556
557 Start(false, true, 0);
558 uiWaypoint = uiType;
559 }
560
562 {
564
565 if (!UpdateVictim())
566 return;
567
569 }
570
571 void JustDied(Unit* /*killer*/) OVERRIDE
572 {
573 if (instance)
575 }
576 };
577
579 {
580 return new npc_argent_soldierAI(creature);
581 }
582};
583
612
613// 66545 - Summon Memory
615{
616 public:
617 spell_paletress_summon_memory() : SpellScriptLoader("spell_paletress_summon_memory") { }
618
620 {
622
623 bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
624 {
625 for (uint8 i = 0; i < 25; ++i)
626 if (!sSpellMgr->GetSpellInfo(memorySpellId[i]))
627 return false;
628 return true;
629 }
630
631 void FilterTargets(std::list<WorldObject*>& targets)
632 {
633 if (targets.empty())
634 return;
635
637 targets.clear();
638 targets.push_back(target);
639 }
640
641 void HandleScript(SpellEffIndex /*effIndex*/)
642 {
643 GetHitUnit()->CastSpell(GetHitUnit(), memorySpellId[std::rand() % 24], true, NULL, NULL, GetCaster()->GetGUID());
644 }
645
651 };
652
657};
658
660{
661 new boss_eadric();
663 new boss_paletress();
664 new npc_memory();
665 new npc_argent_soldier();
667}
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
@ POINT_MOTION_TYPE
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TARGET_UNIT_SRC_AREA_ENEMY
#define sSpellMgr
Definition SpellMgr.h:744
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define SF_UNARY_FUNCTION
@ REACT_DEFENSIVE
Definition Unit.h:1157
@ REACT_PASSIVE
Definition Unit.h:1156
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ SPELL_SHADOWS_PAST_H
@ SPELL_MEMORY_GRUUL
@ SPELL_MEMORY_HEROD
@ SPELL_MEMORY_ENTROPIUS
@ SPELL_MEMORY_MUTANUS
@ SPELL_WAKING_NIGHTMARE_H
@ SPELL_EADRIC_ACHIEVEMENT
@ SPELL_HAMMER_JUSTICE
@ SPELL_MEMORY_IGNIS
@ SPELL_MEMORY_INGVAR
@ SPELL_MEMORY_KALITHRESH
@ SPELL_MEMORY_ONYXIA
@ SPELL_HOLY_FIRE_H
@ SPELL_MEMORY_THUNDERAAN
@ SPELL_MEMORY_CYANIGOSA
@ SPELL_MEMORY_LUCIFRON
@ SPELL_HAMMER_RIGHTEOUS
@ SPELL_MEMORY_VASHJ
@ SPELL_MEMORY_VANCLEEF
@ SPELL_MEMORY_HOGGER
@ SPELL_MEMORY_ARCHIMONDE
@ SPELL_MEMORY_MALCHEZAAR
@ SPELL_MEMORY_ALGALON
@ SPELL_MEMORY_VEZAX
@ SPELL_SUMMON_MEMORY
@ SPELL_MEMORY_HAKKAR
@ SPELL_MEMORY_DELRISSA
@ SPELL_MEMORY_HEIGAN
@ SPELL_WAKING_NIGHTMARE
@ SPELL_MEMORY_CHROMAGGUS
@ SPELL_SHADOWS_PAST
@ SPELL_MEMORY_ILLIDAN
@ SPELL_MEMORY_VEKNILASH
@ SPELL_OLD_WOUNDS_H
void AddSC_boss_argent_challenge()
uint32 const memorySpellId[25]
bool UpdateVictim()
virtual void EnterEvadeMode()
void SetReactState(ReactStates st)
Definition Creature.h:460
CreatureScript(const char *name)
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:1261
bool operator()(WorldObject *object)
OrientationCheck(Unit *_caster)
HookList< EffectHandler > OnEffectHitTarget
Unit * GetHitUnit()
Unit * GetCaster()
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
SpellScriptLoader(const char *name)
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 DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
Definition Unit.h:1367
void RestoreFaction()
Definition Unit.cpp:7135
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
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
void FilterTargets(std::list< WorldObject * > &unitList)
PrepareSpellScript(spell_eadric_radiance_SpellScript)
SpellScript * GetSpellScript() const OVERRIDE
SpellScript * GetSpellScript() const OVERRIDE
#define SPELL_SMITE
C::value_type const & SelectRandomContainerElement(C const &container)
Definition Containers.h:48
Creature * me
bool HealthAbovePct(uint32 pct) const
ScriptedAI(Creature *creature)
void MovementInform(uint32 MovementType, uint32) OVERRIDE
void DamageTaken(Unit *, uint32 &damage) OVERRIDE
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
void SetData(uint32 uiId, uint32) OVERRIDE
void JustSummoned(Creature *summon) OVERRIDE
void MovementInform(uint32 MovementType, uint32 Point) OVERRIDE
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
void DamageTaken(Unit *, uint32 &damage) OVERRIDE
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
void SetData(uint32 uiType, uint32) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
npc_escortAI(Creature *creature)
void SetDespawnAtEnd(bool despawn)
void Start(bool isActiveAttacker=true, bool run=false, uint64 playerGUID=0, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime=0)
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
@ NPC_ARGENT_LIGHWIELDER
@ NPC_ARGENT_MONK
@ NPC_PRIESTESS
@ DATA_ARGENT_SOLDIER_DEFEATED
@ BOSS_ARGENT_CHALLENGE_P
@ BOSS_ARGENT_CHALLENGE_E