TrinityCore
Loading...
Searching...
No Matches
boss_svala.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 "Player.h"
20#include "GameObject.h"
21#include "InstanceScript.h"
22#include "MotionMaster.h"
23#include "MoveSplineInit.h"
24#include "ObjectAccessor.h"
25#include "ScriptedCreature.h"
26#include "SpellInfo.h"
27#include "SpellScript.h"
28#include "TemporarySummon.h"
29#include "utgarde_pinnacle.h"
30
32{
36
37 SPELL_CALL_FLAMES = 48258, // caster effect only, triggers event 17841
40
43 SPELL_RITUAL_STRIKE_TRIGGER = 48331, // triggers 48277 & 59930, needs NPC_RITUAL_TARGET as spell_script_target
47
52
53 // Ritual Channeler spells
56
57 // Scourge Hulk spells
61};
62
64{
65 // Svala
67
68 // Svala Sorrowgrave
75
76 // Image of Arthas
79};
80
82{
83 NPC_ARTHAS = 29280, // Image of Arthas
88 NPC_SCOURGE_HULK = 26555
89};
90
99
124
126{
129
131{
132 {296.95f, -312.76f, 86.36f, 0.0f },
133 {297.69f, -275.81f, 86.36f, 0.0f }
134};
135
136Position const ArthasPos = { 295.81f, -366.16f, 92.57f, 1.58f };
137
138struct boss_svala : public BossAI
139{
141 {
142 Initialize();
143 _introCompleted = false;
144 }
145
147 {
149 _sacrificed = false;
150 }
151
152 void Reset() override
153 {
154 _Reset();
155
156 if (_introCompleted)
157 {
159 me->SetCanMelee(true);
160 }
161 else
162 {
165 me->SetCanMelee(false);
166 }
167
168 me->SetDisableGravity(false);
169
170 Initialize();
171
173 }
174
175 void JustEngagedWith(Unit* who) override
176 {
179 }
180
181 void JustSummoned(Creature* summon) override
182 {
183 if (summon->GetEntry() == NPC_RITUAL_CHANNELER)
184 summon->CastSpell(summon, SPELL_SUMMONED_VIS, true);
185 summons.Summon(summon);
186 }
187
188 void MoveInLineOfSight(Unit* who) override
189 {
190 if (!who)
191 return;
192
194 {
197 me->SetCanMelee(false);
198
200 mirror->SetGoState(GO_STATE_READY);
201
203 {
204 arthas->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
205 arthas->SetUninteractible(true);
206 _arthasGUID = arthas->GetGUID();
207 }
209 }
210 }
211
212 void KilledUnit(Unit* who) override
213 {
214 if (who->GetTypeId() == TYPEID_PLAYER)
215 Talk(SAY_SLAY);
216 }
217
226
227 void UpdateAI(uint32 diff) override
228 {
229 if (events.IsInPhase(IDLE))
230 return;
231
233 return;
234
235 events.Update(diff);
236
238 {
239 _sacrificed = true;
242 me->SetCanMelee(false);
243 }
244
245 while (uint32 eventId = events.ExecuteEvent())
246 {
247 switch (eventId)
248 {
252 break;
255 arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_1);
257 break;
259 {
261 arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, true);
262
263 me->SetDisableGravity(true);
264 std::function<void(Movement::MoveSplineInit&)> initializer = [](Movement::MoveSplineInit& init)
265 {
266 init.MoveTo(296.614f, -346.2484f, 95.62769f);
267 init.SetFly();
268 };
269 me->GetMotionMaster()->LaunchMoveSpline(std::move(initializer));
270
271 // spectators flee event
272 std::list<Creature*> spectators;
273 GetCreatureListWithEntryInGrid(spectators, me, NPC_SPECTATOR, 100.0f);
274 for (Creature* spectator : spectators)
275 {
276 if (spectator->IsAlive())
277 {
278 spectator->SetStandState(UNIT_STAND_STATE_STAND);
279 spectator->SetWalk(false);
280 spectator->GetMotionMaster()->MovePoint(1, spectatorWP[0]);
281 }
282 }
284 break;
285 }
289 break;
293 {
294 arthas->InterruptNonMeleeSpells(true);
295 me->SetFacingToObject(arthas);
296 }
301 break;
305 break;
308 arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_2);
310 break;
313 me->SetFacingTo(1.832595f);
315 arthas->SetVisible(false);
317 break;
319 {
320 me->SetDisableGravity(false);
321 me->SetHover(true);
323
325 break;
326 }
329 mirror->SetGoState(GO_STATE_ACTIVE);
332 arthas->DespawnOrUnsummon();
335 me->SetCanMelee(true);
336 _introCompleted = true;
337 if (Unit* target = me->SelectNearestPlayer(100.0f))
338 AttackStart(target);
341 break;
345 break;
347 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
348 DoCast(target, SPELL_CALL_FLAMES);
350 break;
352 if (Unit* sacrificeTarget = SelectTarget(SelectTargetMethod::Random, 0, 80.0f, true))
353 {
356 me->AttackStop();
357 me->StopMoving();
358 me->SetDisableGravity(true);
359 instance->SetGuidData(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID());
361 DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION);
364 }
367 break;
373 break;
376 break;
378 me->SetDisableGravity(false);
380 me->SetCanMelee(true);
384 break;
385 default:
386 break;
387 }
388 }
389 }
390
391private:
395};
396
398{
400 {
401 Initialize();
402 instance = creature->GetInstanceScript();
403
404 SetCombatMovement(false);
405 }
406
408 {
409 paralyzeTimer = 1600;
410 }
411
414
415 void Reset() override
416 {
417 Initialize();
418
419 if (IsHeroic())
421 }
422
423 void UpdateAI(uint32 diff) override
424 {
426 return;
427
428 if (paralyzeTimer <= diff)
429 {
431 DoCast(victim, SPELL_PARALYZE, false);
432
433 paralyzeTimer = 200;
434 }
435 else
436 paralyzeTimer -= diff;
437 }
438};
439
441{
442 npc_spectator(Creature* creature) : ScriptedAI(creature) { }
443
444 void Reset() override { }
445
446 void MovementInform(uint32 motionType, uint32 pointId) override
447 {
448 if (motionType == POINT_MOTION_TYPE)
449 {
450 if (pointId == 1)
452 else if (pointId == 2)
454 }
455 }
456};
457
459{
460 public:
461 explicit RitualTargetCheck() { }
462
463 bool operator() (WorldObject* obj) const
464 {
465 if (InstanceScript* instance = obj->GetInstanceScript())
466 if (instance->GetGuidData(DATA_SACRIFICED_PLAYER) == obj->GetGUID())
467 return false;
468
469 return true;
470 }
471};
472
473// 48278 - Paralyze
475{
476 void FilterTargets(std::list<WorldObject*>& unitList)
477 {
478 unitList.remove_if(RitualTargetCheck());
479 }
480
485};
486
488{
489 npc_scourge_hulk(Creature* creature) : ScriptedAI(creature)
490 {
491 Initialize();
492 }
493
495 {
496 mightyBlow = urand(4000, 9000);
497 volatileInfection = urand(10000, 14000);
498 killedByRitualStrike = false;
499 }
500
503
504 void Reset() override
505 {
506 Initialize();
507 }
508
509 uint32 GetData(uint32 type) const override
510 {
511 return type == DATA_INCREDIBLE_HULK ? killedByRitualStrike : 0;
512 }
513
514 void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
515 {
516 if (damage >= me->GetHealth() && attacker && attacker->GetEntry() == NPC_SVALA_SORROWGRAVE)
518 }
519
520 void UpdateAI(uint32 diff) override
521 {
522 if (!UpdateVictim())
523 return;
524
525 if (mightyBlow <= diff)
526 {
527 if (Unit* victim = me->GetVictim())
528 if (!victim->HasUnitState(UNIT_STATE_STUNNED)) // Prevent knocking back a ritual player
529 DoCast(victim, SPELL_MIGHTY_BLOW);
530 mightyBlow = urand(12000, 17000);
531 }
532 else
533 mightyBlow -= diff;
534
535 if (volatileInfection <= diff)
536 {
538 volatileInfection = urand(13000, 17000);
539 }
540 else
541 volatileInfection -= diff;
542 }
543
544private:
546};
547
549{
550 public:
551 achievement_incredible_hulk() : AchievementCriteriaScript("achievement_incredible_hulk") { }
552
553 bool OnCheck(Player* /*player*/, Unit* target) override
554 {
555 return target && target->GetAI() && target->GetAI()->GetData(DATA_INCREDIBLE_HULK);
556 }
557};
558
@ EQUIP_UNEQUIP
Definition CreatureAI.h:57
@ EQUIP_NO_CHANGE
Definition CreatureAI.h:56
uint32_t uint32
Definition Define.h:154
@ POINT_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENEMY
@ EMOTE_ONESHOT_FLYDEATH
@ GO_STATE_READY
@ GO_STATE_ACTIVE
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:42
DamageEffectType
@ UNIT_FLAG_NON_ATTACKABLE
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ UNIT_STATE_STUNNED
Definition Unit.h:264
Creatures
Position const spectatorWP[2]
Position const ArthasPos
void AddSC_boss_svala()
@ NPC_RITUAL_TARGET
@ NPC_FLAME_BRAZIER
@ NPC_SCOURGE_HULK
@ NPC_ARTHAS
@ NPC_SPECTATOR
@ NPC_RITUAL_CHANNELER
@ DATA_INCREDIBLE_HULK
@ SAY_DEATH
@ SAY_SACRIFICE_PLAYER
@ SAY_SVALA_INTRO_0
@ SAY_AGGRO
@ SAY_SVALA_INTRO_2
@ SAY_SLAY
@ SAY_SVALA_INTRO_1
@ SAY_DIALOG_OF_ARTHAS_2
@ SAY_DIALOG_OF_ARTHAS_1
@ SPELL_RITUAL_STRIKE_TRIGGER
@ SPELL_RITUAL_PREPARATION
@ SPELL_TRANSFORMING_CHANNEL
@ H_SPELL_SINSTER_STRIKE
@ SPELL_SINSTER_STRIKE
@ H_SPELL_VOLATILE_INFECTION
@ SPELL_SUMMONED_VIS
@ SPELL_SHADOWS_IN_THE_DARK
@ SPELL_RITUAL_CHANNELER_1
@ SPELL_SVALA_TRANSFORMING1
@ SPELL_CALL_FLAMES
@ SPELL_RITUAL_DISARM
@ SPELL_RITUAL_CHANNELER_3
@ SPELL_SVALA_TRANSFORMING2
@ SPELL_RITUAL_OF_THE_SWORD
@ SPELL_PARALYZE
@ SPELL_RITUAL_STRIKE_EFF_1
@ SPELL_MIGHTY_BLOW
@ SPELL_VOLATILE_INFECTION
@ SPELL_RITUAL_STRIKE_EFF_2
@ SPELL_RITUAL_CHANNELER_2
@ SACRIFICING
@ INTRO
@ NORMAL
@ SVALADEAD
@ IDLE
@ EVENT_INTRO_SVALA_TALK_2
@ EVENT_CALL_FLAMES
@ EVENT_INTRO_ARTHAS_TALK_1
@ EVENT_INTRO_SVALA_TALK_0
@ EVENT_SINISTER_STRIKE
@ EVENT_FINISH_RITUAL
@ EVENT_INTRO_SVALA_TALK_1
@ EVENT_RITUAL_PREPARATION
@ EVENT_INTRO_TRANSFORM_0
@ EVENT_INTRO_TRANSFORM_2
@ EVENT_INTRO_TRANSFORM_1
@ EVENT_RITUAL_STRIKE
@ EVENT_SPAWN_RITUAL_CHANNELERS
@ EVENT_INTRO_ARTHAS_TALK_0
@ EVENT_INTRO_RELOCATE_SVALA
@ EVENT_INTRO_DESPAWN_ARTHAS
Yells
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetCanMelee(bool canMelee, bool fleeFromMelee=false)
void SetReactState(ReactStates st)
Definition Creature.h:174
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:593
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
bool IsInPhase(uint8 phase) const
Definition EventMap.h:222
void SetPhase(uint8 phase)
Definition EventMap.cpp:32
virtual ObjectGuid GetGuidData(uint32 type) const override
GameObject * GetGameObject(uint32 type)
void LaunchMoveSpline(std::function< void(Movement::MoveSplineInit &init)> &&initializer, uint32 id=0, MovementGeneratorPriority priority=MOTION_PRIORITY_NORMAL, MovementGeneratorType type=EFFECT_MOTION_TYPE, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
void MoveFall(uint32 id=0, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
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={})
static ObjectGuid const Empty
Definition ObjectGuid.h:314
void Clear()
Definition ObjectGuid.h:329
uint32 GetEntry() const
Definition Object.h:89
bool operator()(WorldObject *obj) const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void Summon(Creature const *summon)
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
virtual uint32 GetData(uint32 id) const
Definition UnitAI.h:74
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3231
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13577
void SetFacingToObject(WorldObject const *object, bool force=true)
Definition Unit.cpp:13307
void StopMoving()
Definition Unit.cpp:10680
UnitAI * GetAI() const
Definition Unit.h:668
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13361
uint64 GetHealth() const
Definition Unit.h:788
Unit * GetVictim() const
Definition Unit.h:726
void SetFacingTo(float const ori, bool force=true)
Definition Unit.cpp:13289
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void RemoveAllAuras()
Definition Unit.cpp:4382
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition Unit.cpp:1657
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:846
bool AttackStop()
Definition Unit.cpp:5965
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:847
Player * SelectNearestPlayer(float range) const
Definition Object.cpp:1579
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition Object.cpp:2324
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1398
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:501
virtual void SetGuidData(uint32, ObjectGuid)
Definition ZoneScript.h:92
bool OnCheck(Player *, Unit *target) override
void FilterTargets(std::list< WorldObject * > &unitList)
void Register() override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
bool IsHeroic() const
void SetEquipmentSlots(bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void SetCombatMovement(bool allowMovement)
bool HealthBelowPct(uint32 pct) const
void JustDied(Unit *) override
void Initialize()
void KilledUnit(Unit *who) override
bool _introCompleted
ObjectGuid _arthasGUID
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
void UpdateAI(uint32 diff) override
void Reset() override
void MoveInLineOfSight(Unit *who) override
boss_svala(Creature *creature)
void UpdateAI(uint32 diff) override
npc_ritual_channeler(Creature *creature)
InstanceScript * instance
void Reset() override
void UpdateAI(uint32 diff) override
uint32 GetData(uint32 type) const override
void DamageTaken(Unit *attacker, uint32 &damage, DamageEffectType, SpellInfo const *) override
npc_scourge_hulk(Creature *creature)
void Reset() override
void MovementInform(uint32 motionType, uint32 pointId) override
void Reset() override
npc_spectator(Creature *creature)
#define RegisterUtgardePinnacleCreatureAI(ai_name)
@ DATA_SACRIFICED_PLAYER
@ DATA_SVALA_SORROWGRAVE
@ DATA_UTGARDE_MIRROR
@ NPC_SVALA_SORROWGRAVE