TrinityCore
Loading...
Searching...
No Matches
boss_reliquary_of_souls.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "black_temple.h"
20#include "Containers.h"
21#include "InstanceScript.h"
22#include "MotionMaster.h"
23#include "Player.h"
24#include "ScriptedCreature.h"
25#include "SpellAuraEffects.h"
26#include "SpellScript.h"
27#include "TemporarySummon.h"
28
30{
31 // Essence of Suffering
36 //SUFF_SAY_AFTER = 4,
38
39 // Essence of Desire
44 //DESI_SAY_AFTER = 4,
45
46 // Essence of Anger
51 //ANGER_SAY_SPEC = 4,
53 //ANGER_SAY_DEATH = 6
54};
55
57{
58 // Reliquary
63
64 // Essence of Suffering
67 SPELL_FRENZY = 41305,
68
69 // Essence of Desire
73 SPELL_DEADEN = 41410,
75
76 // Essence of Anger
79 SPELL_SPITE = 41376,
81 SPELL_SEETHE = 41364,
82
83 // Enslaved Soul
86
87 // World Trigger
89};
90
100
107
124
125Position const DespawnPoint = { 497.4939f, 183.2081f, 94.53341f };
126
128{
129 public: EnslavedSoulEvent(Creature* owner) : _owner(owner) { }
130
131 bool Execute(uint64 /*time*/, uint32 /*diff*/) override
132 {
134 return true;
135 }
136
137 private:
139};
140
141// 22856 - Reliquary of the Lost
143{
145
146 void Reset() override
147 {
148 _Reset();
150 _inCombat = false;
152 }
153
154 void JustSummoned(Creature* summon) override
155 {
156 summons.Summon(summon);
157 summon->AI()->DoZoneInCombat();
158 }
159
171
172 void DoAction(int32 actionId) override
173 {
174 switch (actionId)
175 {
181 break;
187 break;
188 case ACTION_KILL_SELF:
189 me->KillSelf();
191 combatTrigger->AI()->DoAction(ACTION_KILL_SELF);
192 break;
194 _inCombat = true;
197 break;
198 default:
199 break;
200 }
201 }
202
204 {
205 std::vector<Creature*> _worldTriggerList;
207
208 if (_worldTriggerList.empty())
209 return;
210
211 //Get random creatures
212 Trinity::Containers::RandomShuffle(_worldTriggerList);
213 _worldTriggerList.resize(21);
214
215 for (uint8 i = 0; i < 21; i++)
216 {
217 Creature* wTrigger = _worldTriggerList[i];
218 if (i < 3)
219 wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 4s);
220 else if (i < 6)
221 wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 8s);
222 else if (i < 9)
223 wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 12s);
224 else if (i < 12)
225 wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 16s);
226 else if (i < 15)
227 wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 20s);
228 else if (i < 18)
229 wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 24s);
230 else
231 wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 28s);
232 }
233 }
234
236 {
237 std::vector<Creature*> _worldTriggerList;
239
240 if (_worldTriggerList.empty())
241 return;
242
243 for (Creature* trigger : _worldTriggerList)
244 trigger->m_Events.KillAllEvents(true);
245 }
246
247 void EnterEvadeMode(EvadeReason /*why*/) override
248 {
249 events.Reset();
253 }
254
255 void JustDied(Unit* /*killer*/) override
256 {
257 events.Reset();
259 }
260
261 void UpdateAI(uint32 diff) override
262 {
263 if (!_inCombat)
264 return;
265
266 events.Update(diff);
267
269 return;
270
271 while (uint32 eventId = events.ExecuteEvent())
272 {
273 if (eventId == EVENT_SUBMERGE)
274 {
279 }
280 }
281 }
282
283private:
285};
286
287// 23418 - Essence of Suffering
289{
294
295 void Reset() override
296 {
298 events.Reset();
299 _dead = false;
300 }
301
302 void MovementInform(uint32 motionType, uint32 pointId) override
303 {
304 if (motionType != POINT_MOTION_TYPE)
305 return;
306
307 if (pointId == RELIQUARY_DESPAWN_WAYPOINT)
308 {
310 reliquary->AI()->DoAction(ACTION_ESSENCE_OF_SUFFERING_DEAD);
311
314 }
315 }
316
317 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
318 {
319 if (damage >= me->GetHealth())
320 {
321 damage = 0;
322 if (!_dead)
323 {
324 _dead = true;
326 me->AttackStop();
328 events.Reset();
331 }
332 }
333 }
334
335 void JustEngagedWith(Unit* /*who*/) override
336 {
337 me->setActive(true);
338
342 }
343
344 void KilledUnit(Unit* victim) override
345 {
346 if (victim->GetTypeId() == TYPEID_PLAYER)
348 }
349
350 void UpdateAI(uint32 diff) override
351 {
352 if (!UpdateVictim())
353 return;
354
356 return;
357
358 events.Update(diff);
359
360 while (uint32 eventId = events.ExecuteEvent())
361 {
362 switch (eventId)
363 {
364 case EVENT_SOUL_DRAIN:
366 events.Repeat(30s, 35s);
367 break;
368 case EVENT_FRENZY:
371 events.Repeat(45s, 50s);
372 break;
373 default:
374 break;
375 }
376
378 return;
379 }
380 }
381private:
382 bool _dead;
383};
384
385// 23419 - Essence of Desire
387{
392
393 void Reset() override
394 {
396 events.Reset();
397 _dead = false;
398 }
399
400 void JustEngagedWith(Unit* /*who*/) override
401 {
405
406 me->setActive(true);
408 }
409
410 void MovementInform(uint32 motionType, uint32 pointId) override
411 {
412 if (motionType != POINT_MOTION_TYPE)
413 return;
414
415 if (pointId == RELIQUARY_DESPAWN_WAYPOINT)
416 {
418 reliquary->AI()->DoAction(ACTION_ESSENCE_OF_DESIRE_DEAD);
419
422 }
423 }
424
425 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
426 {
427 if (damage >= me->GetHealth())
428 {
429 damage = 0;
430 if (!_dead)
431 {
432 _dead = true;
434 me->AttackStop();
436 events.Reset();
439 }
440 }
441 }
442
443 void KilledUnit(Unit* victim) override
444 {
445 if (victim->GetTypeId() == TYPEID_PLAYER)
447 }
448
449 void UpdateAI(uint32 diff) override
450 {
451 if (!UpdateVictim())
452 return;
453
455 return;
456
457 events.Update(diff);
458
459 while (uint32 eventId = events.ExecuteEvent())
460 {
461 switch (eventId)
462 {
465 events.Repeat(10s, 15s);
466 break;
469 events.Repeat(16s);
470 break;
471 case EVENT_DEADEN:
474 events.Repeat(31s);
475 break;
476 default:
477 break;
478 }
479
481 return;
482 }
483 }
484private:
485 bool _dead;
486};
487
488// 23420 - Essence of Anger
490{
495
496 void Reset() override
497 {
498 events.Reset();
501 }
502
514
515 void JustDied(Unit* /*killer*/) override
516 {
519 reliquary->AI()->DoAction(ACTION_KILL_SELF);
520 }
521
522 void UpdateAI(uint32 diff) override
523 {
524 if (!UpdateVictim())
525 return;
526
528 return;
529
530 events.Update(diff);
531
532 while (uint32 eventId = events.ExecuteEvent())
533 {
534 switch (eventId)
535 {
537 {
538 Unit* target = me->GetVictim();
539 if (!_targetGUID || !target)
540 return;
541
542 if (target->GetGUID() != _targetGUID)
543 {
546 _targetGUID = target->GetGUID();
548 }
549 break;
550 }
553 events.Repeat(11s);
554 break;
555 case EVENT_SPITE:
558 events.Repeat(20s);
559 break;
561 if (Unit* target = me->GetVictim())
562 {
563 _targetGUID = target->GetGUID();
565 }
566 else
567 events.Repeat(1s);
568 break;
569 case EVENT_FREED_2:
571 break;
572 default:
573 break;
574 }
575
577 return;
578 }
579 }
580
581private:
583};
584
585// 23469 - Enslaved Soul
587{
588 npc_enslaved_soul(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _dead(false) { }
589
590 void Reset() override
591 {
594 reliquary->AI()->JustSummoned(me);
595
597
598 _scheduler.Schedule(3s, [this](TaskContext const& /*context*/)
599 {
602 });
603 _dead = false;
604 }
605
606 void DoAction(int32 actionId) override
607 {
608 if (actionId == ACTION_KILL_SELF)
610 }
611
613 {
615 me->AttackStop();
618 me->m_Events.AddEventAtOffset([this]() { me->KillSelf(); }, 500ms);
619 }
620
621 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
622 {
623 if (damage >= me->GetHealth())
624 {
625 damage = 0;
626 if (!_dead)
627 {
628 _dead = true;
630 }
631 }
632 }
633
634 void UpdateAI(uint32 diff) override
635 {
636 if (!UpdateVictim())
637 return;
638
639 _scheduler.Update(diff);
640 }
641
642private:
645 bool _dead;
646};
647
648// 23417 - Reliquary Combat Trigger
650{
651 npc_reliquary_combat_trigger(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
652 {
653 SetCombatMovement(false);
654 creature->m_SightDistance = 70.0f;
656 }
657
658 bool CanAIAttack(Unit const* who) const override
659 {
660 return ScriptedAI::CanAIAttack(who) && IsInBoundary(who);
661 }
662
669
670 void MoveInLineOfSight(Unit* who) override
671 {
672 if (!me->IsEngaged() && who->GetTypeId() == TYPEID_PLAYER && !who->ToPlayer()->IsGameMaster() && CanAIAttack(who))
673 {
675 {
677 reliquary->AI()->DoAction(ACTION_START_COMBAT);
678 }
679 }
680 }
681
682 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
683 {
684 damage = 0;
685 }
686
687 void EnterEvadeMode(EvadeReason why) override
688 {
691 reliquary->AI()->EnterEvadeMode(why);
692 }
693
694 void DoAction(int32 actionId) override
695 {
696 if (actionId == ACTION_KILL_SELF)
697 me->KillSelf();
698 }
699
700 void UpdateAI(uint32 /*diff*/) override
701 {
702 if (!UpdateVictim())
703 return;
704 }
705
706private:
708};
709
710// 41350 - Aura of Desire
712{
713 bool Validate(SpellInfo const* /*spellInfo*/) override
714 {
716 }
717
718 void OnProcSpell(AuraEffect* aurEff, ProcEventInfo& eventInfo)
719 {
721 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
722 if (!damageInfo || !damageInfo->GetDamage())
723 return;
724
725 Unit* caster = eventInfo.GetActor();
726 caster->CastSpell(caster, SPELL_AURA_OF_DESIRE_DAMAGE, CastSpellExtraArgs(aurEff).AddSpellBP0(damageInfo->GetDamage() / 2));
727 }
728
729 void UpdateAmount(AuraEffect* /*aurEff*/)
730 {
731 if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1))
732 effect->ChangeAmount(effect->GetAmount() - 5);
733 }
734
740};
741
742// 41337 - Aura of Anger
744{
746 {
747 if (AuraEffect* aurEff1 = aurEff->GetBase()->GetEffect(EFFECT_1))
748 aurEff1->ChangeAmount(aurEff1->GetAmount() + 5);
749 aurEff->SetAmount(100.0 * aurEff->GetTickNumber());
750 }
751
756};
757
758// 28819 - Submerge Visual
777
778// 41376 - Spite
780{
781 bool Validate(SpellInfo const* /*spellInfo*/) override
782 {
784 }
785
786 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
787 {
788 if (Unit* caster = GetCaster())
789 caster->CastSpell(GetTarget(), SPELL_SPITE_DAMAGE, true);
790 }
791
796};
797
798// 41305 - Frenzy
800{
802 {
803 if (Creature* caster = GetCaster()->ToCreature())
804 caster->AI()->Talk(SUFF_EMOTE_ENRAGE, caster);
805 }
806
811};
812
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint32_t uint32
Definition Define.h:154
@ DONE
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_1
@ EFFECT_0
@ EFFECT_2
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_DUMMY
@ SPELL_AURA_MOD_HEALING_PCT
@ SPELL_AURA_DAMAGE_IMMUNITY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELLVALUE_MAX_TARGETS
#define AuraEffectProcFn(F, I, N)
#define AuraEffectUpdatePeriodicFn(F, I, N)
#define SpellCastFn(F)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STAND_STATE_SUBMERGED
Definition UnitDefines.h:51
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:42
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
#define RegisterBlackTempleCreatureAI(ai_name)
@ DATA_ESSENCE_OF_SUFFERING
@ DATA_RELIQUARY_COMBAT_TRIGGER
@ DATA_ESSENCE_OF_ANGER
@ DATA_ESSENCE_OF_DESIRE
@ DATA_RELIQUARY_OF_SOULS
@ NPC_ENSLAVED_SOUL
@ NPC_RELIQUARY_WORLD_TRIGGER
void AddSC_boss_reliquary_of_souls()
@ ACTION_ESSENCE_OF_DESIRE_DEAD
@ RELIQUARY_DESPAWN_WAYPOINT
@ ACTION_ESSENCE_OF_SUFFERING_DEAD
@ PHASE_ESSENCE_OF_SUFFERING
@ PHASE_ESSENCE_OF_DESIRE
@ EVENT_START_CHECK_TANKER
@ SPELL_ENSLAVED_SOUL_PASSIVE
@ SPELL_SUMMON_ESSENCE_OF_DESIRE
@ SPELL_SUMMON_ESSENCE_OF_SUFFERING
@ SPELL_AURA_OF_DESIRE_DAMAGE
@ SPELL_SUMMON_ESSENCE_OF_ANGER
@ SPELL_SUBMERGE_VISUAL
@ SPELL_AURA_OF_SUFFERING
Position const DespawnPoint
uint32 GetTickNumber() const
void SetAmount(SpellEffectValue amount)
Aura * GetBase() const
void PreventDefaultAction()
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetCaster() const
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
AuraEffect * GetEffect(uint8 effIndex) const
Aura * GetAura() const
Unit * GetTarget() const
HookList< EffectProcHandler > OnEffectProc
AuraEffect * GetEffect(uint32 index) const
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool IsInBoundary(Position const *who=nullptr) const
bool UpdateVictim()
void SetBoundary(CreatureBoundary const *boundary, bool negativeBoundaries=false)
Creature *const me
Definition CreatureAI.h:63
bool IsEngaged() const override
void SetReactState(ReactStates st)
Definition Creature.h:180
float m_SightDistance
Definition Creature.h:435
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:235
uint32 GetDamage() const
Definition Unit.h:466
EnslavedSoulEvent(Creature *owner)
bool Execute(uint64, uint32) override
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:246
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:32
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
CreatureBoundary const * GetBossBoundary(uint32 id) const
EncounterState GetBossState(uint32 id) const
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
void Clear()
Definition ObjectGuid.h:329
Player * ToPlayer()
Definition Object.h:126
bool IsGameMaster() const
Definition Player.h:1293
DamageInfo * GetDamageInfo() const
Definition Unit.h:524
Unit * GetActor() const
Definition Unit.h:513
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< CastHandler > AfterCast
Unit * GetCaster() const
void Summon(Creature const *summon)
void DoAction(int32 info, Predicate &&predicate, uint16 max=0)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
virtual bool CanAIAttack(Unit const *) const
Definition UnitAI.h:58
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
Definition Unit.h:647
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition Unit.cpp:10804
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3253
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
uint64 GetHealth() const
Definition Unit.h:800
Unit * GetVictim() const
Definition Unit.h:738
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.h:951
bool AttackStop()
Definition Unit.cpp:5984
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition Object.cpp:2663
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
void setActive(bool isActiveObject)
Definition Object.cpp:274
EventProcessor m_Events
Definition Object.h:561
void OnProcSpell(AuraEffect *aurEff, ProcEventInfo &eventInfo)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void OnApply(AuraEffect const *, AuraEffectHandleModes)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void RandomShuffle(Iterator begin, Iterator end)
Reorder the elements of the iterator range randomly.
Definition Containers.h:171
void SetCombatMovement(bool allowMovement)
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void UpdateAI(uint32 diff) override
boss_essence_of_anger(Creature *creature)
void JustEngagedWith(Unit *) override
boss_essence_of_desire(Creature *creature)
void MovementInform(uint32 motionType, uint32 pointId) override
void KilledUnit(Unit *victim) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
void UpdateAI(uint32 diff) override
boss_essence_of_suffering(Creature *creature)
void KilledUnit(Unit *victim) override
void MovementInform(uint32 motionType, uint32 pointId) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
boss_reliquary_of_souls(Creature *creature)
void UpdateAI(uint32 diff) override
void JustSummoned(Creature *summon) override
void EnterEvadeMode(EvadeReason) override
void DoAction(int32 actionId) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
npc_enslaved_soul(Creature *creature)
void DoAction(int32 actionId) override
void UpdateAI(uint32 diff) override
void DoAction(int32 actionId) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
bool CanAIAttack(Unit const *who) const override
void MoveInLineOfSight(Unit *who) override
void EnterEvadeMode(EvadeReason why) override