TrinityCore
Loading...
Searching...
No Matches
boss_amalgam_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 "AreaTrigger.h"
19#include "AreaTriggerAI.h"
20#include "Conversation.h"
21#include "ConversationAI.h"
22#include "Creature.h"
23#include "GameObject.h"
24#include "InstanceScript.h"
25#include "MotionMaster.h"
26#include "PathGenerator.h"
27#include "ScriptedCreature.h"
28#include "ScriptMgr.h"
29#include "SharedDefines.h"
30#include "SpellAuras.h"
31#include "SpellHistory.h"
32#include "SpellScript.h"
33#include "black_rook_hold.h"
34
58
69
81
90
107
114
115constexpr Position AmalgamOfSoulsPosition = { 3252.25f, 7581.75f, 12.884051f };
116constexpr Position EtheldrinOutroPosition = { 3226.6829f, 7552.8877f, 15.355894f };
117constexpr Position VelandrasOutroPosition = { 3228.9f, 7548.45f, 14.977584f };
118constexpr Position StaellisOutroPosition = { 3233.22f, 7548.13f, 15.162442f };
119
120// 98542 - Amalgam of Souls
122{
124
125 void DespawnSoulEchoes() const
126 {
127 std::list<Creature*> soulEchoes;
128 GetCreatureListWithEntryInGrid(soulEchoes, me, NPC_SOUL_ECHO, 100.0f);
129
130 for (Creature* soulEcho : soulEchoes)
131 soulEcho->DespawnOrUnsummon();
132 }
133
134 void Reset() override
135 {
136 _Reset();
137 _callSoulsTriggered = false;
138 }
139
150
160
171
182
183 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
184 {
186 return;
187
188 _callSoulsTriggered = true;
189
190 DoStopAttack();
195
197 }
198
199 void UpdateAI(uint32 diff) override
200 {
201 if (!UpdateVictim())
202 return;
203
204 events.Update(diff);
205
207 return;
208
209 while (uint32 eventId = events.ExecuteEvent())
210 {
211 switch (eventId)
212 {
214 {
217 events.Repeat(20600ms);
218 break;
219 }
220 case EVENT_REAP_SOUL:
221 {
224 events.Repeat(13400ms);
225 break;
226 }
228 {
231 DoCast(target, SPELL_SOUL_ECHOES);
232 events.Repeat(26700ms);
233 break;
234 }
236 {
238 events.Repeat(500ms);
239 else
241 break;
242 }
243 case EVENT_SOUL_BURST:
244 {
251 break;
252 }
253 default:
254 break;
255 }
256
258 return;
259 }
260 }
261
262private:
264};
265
266// 99090 - Soul Echoes Stalker
278
279// 99664 - Restless Soul
281{
283
290
291 void MovementInform(uint32 /*type*/, uint32 id) override
292 {
293 if (id == POINT_RESTLESS_SOUL)
294 {
296 if (!amalgamOfSouls)
297 return;
298
300 }
301 }
302};
303
304// 99857 - Lord Etheldrin Ravencrest
306{
308
314
315 void MovementInform(uint32 /*type*/, uint32 id) override
316 {
317 if (id != POINT_SECRET_DOOR)
318 return;
319
320 Milliseconds delay = 1s;
321 _scheduler.Schedule(1s, [this](TaskContext const& /*task*/)
322 {
324 });
325
326 delay += 4s;
327 _scheduler.Schedule(delay, [this](TaskContext const& /*task*/)
328 {
330 {
331 velandras->CastSpell(velandras, SPELL_SECRET_DOOR_CHANNEL_MID);
332 velandras->DespawnOrUnsummon(6s);
333 }
334
335 if (Creature* staellis = me->FindNearestCreature(NPC_STAELLIS_RIVERMOOR, 100.0f))
336 {
337 staellis->CastSpell(staellis, SPELL_SECRET_DOOR_CHANNEL_LEFT);
338 staellis->DespawnOrUnsummon(6s);
339 }
340
343 });
344
345 delay += 6s;
346 _scheduler.Schedule(delay, [this](TaskContext const& /*task*/)
347 {
349 door->SetGoState(GO_STATE_ACTIVE);
350 });
351 }
352
353 void UpdateAI(uint32 diff) override
354 {
355 _scheduler.Update(diff);
356 }
357
358private:
360};
361
362// 194981 - Soul Echoes
384
385// 196930 - Soulgorge
387{
388 void OnApply(AuraEffect const* /*auraEffect*/, AuraEffectHandleModes /*mode*/) const
389 {
390 if (Creature* creatureCaster = Object::ToCreature(GetCaster()))
391 creatureCaster->DespawnOrUnsummon(3s);
392 }
393
398};
399
400// 196078 - Call Souls
402{
403 void HandleHitTarget(SpellEffIndex /*effIndex*/) const
404 {
405 if (Creature* creatureCaster = GetCaster()->ToCreature())
406 creatureCaster->SummonCreatureGroup(SUMMON_GROUP_RESTLESS_SOULS);
407 }
408
413};
414
415// 196587 - Soul Burst
417{
418 void HandleAfterCast() const
419 {
420 if (Creature* creatureCaster = GetCaster()->ToCreature())
421 {
422 creatureCaster->SetReactState(REACT_AGGRESSIVE);
423 creatureCaster->RemoveAurasDueToSpell(SPELL_SOULGORGE);
424 }
425 }
426
431};
432
433// 195254 - Swirling Scythe
434// ID - 5167
435/* THIS AREATRIGGER SHOULD ROTATE, BUT IT DOESNT, BECAUSE ROLLPITCHYAW IS NYI */
437{
439
440 void OnInitialize() override
441 {
442 Position destPos = at->GetPosition();
443 PathGenerator path(at);
444 path.CalculatePath(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ(), false);
445
446 at->InitSplines(path.GetPath());
447 }
448
449 void OnUnitEnter(Unit* unit) override
450 {
451 if (!unit->IsPlayer())
452 return;
453
455 }
456};
457
458// 196925 - Call Souls
459// ID - 5293
461{
463
464 void OnUnitEnter(Unit* unit) override
465 {
466 if (unit->GetEntry() != NPC_RESTLESS_SOUL)
467 return;
468
469 Unit* caster = at->GetCaster();
470 if (!caster)
471 return;
472
474 }
475};
476
477// 197075 - Start Split Conversation
478// ID - 754
480{
481public:
483
484 void OnStart() override
485 {
488 }
489
490 void OnUpdate(uint32 diff) override
491 {
492 _events.Update(diff);
493
494 switch (_events.ExecuteEvent())
495 {
496 case EVENT_OUTRO:
497 {
499 {
500 etheldrin->SetStandState(UNIT_STAND_STATE_STAND);
501 etheldrin->GetMotionMaster()->MovePoint(POINT_SECRET_DOOR, EtheldrinOutroPosition);
502 }
503
505 {
506 velandras->SetStandState(UNIT_STAND_STATE_STAND);
507 velandras->GetMotionMaster()->MovePoint(POINT_SECRET_DOOR, VelandrasOutroPosition);
508 }
509
511 {
512 staellis->SetStandState(UNIT_STAND_STATE_STAND);
513 staellis->GetMotionMaster()->MovePoint(POINT_SECRET_DOOR, StaellisOutroPosition);
514 }
515 break;
516 }
517 default:
518 break;
519 }
520 }
521
522private:
524};
525
LocaleConstant
Definition Common.h:51
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
float frand(float min, float max)
Definition Random.cpp:55
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
#define RegisterConversationAI(ai_name)
Definition ScriptMgr.h:1437
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ GO_STATE_ACTIVE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_CLONE_CASTER
@ SPELL_AURA_MOD_SCALE
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define SpellEffectFn(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_KNEEL
Definition UnitDefines.h:50
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:42
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ DATA_BOSS_1_POST_BOSS_DOOR
@ DATA_AMALGAM_OF_SOULS
#define RegisterBlackRookHoldCreatureAI(ai_name)
@ SPELL_SUMMON_MINIBOSS_A
@ SPELL_SECRET_DOOR_CHANNEL_LEFT
@ SPELL_SWIRLING_SCYTHE_DAMAGE
@ SPELL_SOUL_ECHOES_CLONE_CASTER
@ SPELL_START_SPLIT_CONVERSATION
@ SPELL_SOUL_ECHOES_DAMAGE
@ SPELL_CALL_SOULS_AREATRIGGER
@ SPELL_SUMMON_MINIBOSS_B
@ SPELL_SUMMON_MINIBOSS_C
@ SPELL_SECRET_DOOR_CHANNEL_MID
@ SPELL_SECRET_DOOR_CHANNEL_RIGHT
@ SPELL_SWIRLING_SCYTHE
@ SPELL_SOUL_ECHOES
@ SPELL_TRANSFORM_TIMER
constexpr uint16 RandomAnimKit[3]
constexpr Position VelandrasOutroPosition
@ EVENT_SOUL_ECHOES
@ EVENT_SWIRLING_SCYTE
@ EVENT_CHECK_ALIVE_SOULS
AmalgamOfSoulsConversation
@ NPC_STAELLIS_RIVERMOOR
@ NPC_LADY_VELANDRAS_RAVENCREST
@ NPC_LORD_ETHELDRIN_RAVENCREST
@ POINT_SECRET_DOOR
@ SAY_SWIRLING_SCYTHE
constexpr Position EtheldrinOutroPosition
constexpr Position StaellisOutroPosition
constexpr Position AmalgamOfSoulsPosition
@ SUMMON_GROUP_RESTLESS_SOULS
@ POINT_AMALGAM_OF_SOULS
@ POINT_RESTLESS_SOUL
@ SOUL_ECHOES_STALKER_ANIM_KIT_3
@ SOUL_ECHOES_STALKER_ANIM_KIT_1
@ SOUL_ECHOES_STALKER_ANIM_KIT_2
@ POINT_START_CALL_SOULS
void AddSC_boss_amalgam_of_souls()
AreaTrigger *const at
AreaTriggerAI(AreaTrigger *a, uint32 scriptId={}) noexcept
void InitSplines(std::vector< G3D::Vector3 > const &splinePoints, Optional< float > overrideSpeed={}, Optional< bool > speedIsTimeInSeconds={})
Unit * GetCaster() const
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetCaster() const
Unit * GetTarget() const
bool IsPlayer() const
Definition BaseEntity.h:173
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
Conversation *const conversation
LocaleConstant GetPrivateObjectOwnerLocale() const
Milliseconds GetLastLineEndTime(LocaleConstant locale) const
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:388
void SetReactState(ReactStates st)
Definition Creature.h:174
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void CancelEvent(uint32 eventId)
Definition EventMap.cpp:135
Creature * GetCreature(uint32 type)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
GameObject * GetGameObject(uint32 type)
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={})
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
Movement::PointsArray const & GetPath() const
bool CalculatePath(float srcX, float srcY, float srcZ, float destX, float destY, float destZ, bool forceDest=false)
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< CastHandler > AfterCast
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
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
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition Unit.cpp:10731
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
void SetAIAnimKitId(uint16 animKitId)
Definition Unit.cpp:11174
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1517
conversation_amalgam_of_souls_outro(Conversation *conversation)
void OnRemove(AuraEffect const *, AuraEffectHandleModes) const
void OnApply(AuraEffect const *, AuraEffectHandleModes) const
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
constexpr float GetPositionZ() const
Definition Position.h:89
bool IsHeroicOrHigher() const
void OnUnitEnter(Unit *unit) override
void JustEngagedWith(Unit *who) override
void MovementInform(uint32, uint32 id) override
boss_amalgam_of_souls(Creature *creature)
void EnterEvadeMode(EvadeReason) override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void MovementInform(uint32, uint32 id) override
void IsSummonedBy(WorldObject *summoner) override