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)
158 else
159 {
162 }
163
164 me->SetDisableGravity(false);
165
166 Initialize();
167
169 }
170
171 void JustEngagedWith(Unit* who) override
172 {
175 }
176
177 void JustSummoned(Creature* summon) override
178 {
179 if (summon->GetEntry() == NPC_RITUAL_CHANNELER)
180 summon->CastSpell(summon, SPELL_SUMMONED_VIS, true);
181 summons.Summon(summon);
182 }
183
184 void MoveInLineOfSight(Unit* who) override
185 {
186 if (!who)
187 return;
188
190 {
193
195 mirror->SetGoState(GO_STATE_READY);
196
198 {
200 _arthasGUID = arthas->GetGUID();
201 }
203 }
204 }
205
206 void KilledUnit(Unit* who) override
207 {
208 if (who->GetTypeId() == TYPEID_PLAYER)
209 Talk(SAY_SLAY);
210 }
211
220
221 void UpdateAI(uint32 diff) override
222 {
223 if (events.IsInPhase(IDLE))
224 return;
225
227 return;
228
229 events.Update(diff);
230
232 {
233 _sacrificed = true;
236 }
237
240
241 while (uint32 eventId = events.ExecuteEvent())
242 {
243 switch (eventId)
244 {
248 break;
251 arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_1);
253 break;
255 {
257 arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, true);
258
259 me->SetDisableGravity(true);
260 std::function<void(Movement::MoveSplineInit&)> initializer = [](Movement::MoveSplineInit& init)
261 {
262 init.MoveTo(296.614f, -346.2484f, 95.62769f);
263 init.SetFly();
264 };
265 me->GetMotionMaster()->LaunchMoveSpline(std::move(initializer));
266
267 // spectators flee event
268 std::list<Creature*> spectators;
269 GetCreatureListWithEntryInGrid(spectators, me, NPC_SPECTATOR, 100.0f);
270 for (Creature* spectator : spectators)
271 {
272 if (spectator->IsAlive())
273 {
274 spectator->SetStandState(UNIT_STAND_STATE_STAND);
275 spectator->SetWalk(false);
276 spectator->GetMotionMaster()->MovePoint(1, spectatorWP[0]);
277 }
278 }
280 break;
281 }
285 break;
289 {
290 arthas->InterruptNonMeleeSpells(true);
291 me->SetFacingToObject(arthas);
292 }
297 break;
301 break;
304 arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_2);
306 break;
309 me->SetFacingTo(1.832595f);
311 arthas->SetVisible(false);
313 break;
315 {
316 me->SetDisableGravity(false);
317 me->SetHover(true);
319
321 break;
322 }
325 mirror->SetGoState(GO_STATE_ACTIVE);
328 arthas->DespawnOrUnsummon();
331 _introCompleted = true;
332 if (Unit* target = me->SelectNearestPlayer(100.0f))
333 AttackStart(target);
336 break;
340 break;
342 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
343 DoCast(target, SPELL_CALL_FLAMES);
345 break;
347 if (Unit* sacrificeTarget = SelectTarget(SelectTargetMethod::Random, 0, 80.0f, true))
348 {
351 me->AttackStop();
352 me->StopMoving();
353 me->SetDisableGravity(true);
354 instance->SetGuidData(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID());
356 DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION);
359 }
362 break;
368 break;
371 break;
373 me->SetDisableGravity(false);
378 break;
379 default:
380 break;
381 }
382 }
383 }
384
385private:
389};
390
392{
394 {
395 Initialize();
396 instance = creature->GetInstanceScript();
397
398 SetCombatMovement(false);
399 }
400
402 {
403 paralyzeTimer = 1600;
404 }
405
408
409 void Reset() override
410 {
411 Initialize();
412
413 if (IsHeroic())
415 }
416
417 void UpdateAI(uint32 diff) override
418 {
420 return;
421
422 if (paralyzeTimer <= diff)
423 {
425 DoCast(victim, SPELL_PARALYZE, false);
426
427 paralyzeTimer = 200;
428 }
429 else
430 paralyzeTimer -= diff;
431 }
432};
433
435{
436 npc_spectator(Creature* creature) : ScriptedAI(creature) { }
437
438 void Reset() override { }
439
440 void MovementInform(uint32 motionType, uint32 pointId) override
441 {
442 if (motionType == POINT_MOTION_TYPE)
443 {
444 if (pointId == 1)
446 else if (pointId == 2)
448 }
449 }
450};
451
453{
454 public:
455 explicit RitualTargetCheck() { }
456
457 bool operator() (WorldObject* obj) const
458 {
459 if (InstanceScript* instance = obj->GetInstanceScript())
460 if (instance->GetGuidData(DATA_SACRIFICED_PLAYER) == obj->GetGUID())
461 return false;
462
463 return true;
464 }
465};
466
467// 48278 - Paralyze
482
484{
485 npc_scourge_hulk(Creature* creature) : ScriptedAI(creature)
486 {
487 Initialize();
488 }
489
491 {
492 mightyBlow = urand(4000, 9000);
493 volatileInfection = urand(10000, 14000);
494 killedByRitualStrike = false;
495 }
496
499
500 void Reset() override
501 {
502 Initialize();
503 }
504
505 uint32 GetData(uint32 type) const override
506 {
507 return type == DATA_INCREDIBLE_HULK ? killedByRitualStrike : 0;
508 }
509
510 void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
511 {
512 if (damage >= me->GetHealth() && attacker && attacker->GetEntry() == NPC_SVALA_SORROWGRAVE)
514 }
515
516 void UpdateAI(uint32 diff) override
517 {
518 if (!UpdateVictim())
519 return;
520
521 if (mightyBlow <= diff)
522 {
523 if (Unit* victim = me->GetVictim())
524 if (!victim->HasUnitState(UNIT_STATE_STUNNED)) // Prevent knocking back a ritual player
525 DoCast(victim, SPELL_MIGHTY_BLOW);
526 mightyBlow = urand(12000, 17000);
527 }
528 else
529 mightyBlow -= diff;
530
531 if (volatileInfection <= diff)
532 {
534 volatileInfection = urand(13000, 17000);
535 }
536 else
537 volatileInfection -= diff;
538
540 }
541
542private:
544};
545
547{
548 public:
549 achievement_incredible_hulk() : AchievementCriteriaScript("achievement_incredible_hulk") { }
550
551 bool OnCheck(Player* /*player*/, Unit* target) override
552 {
553 return target && target->GetAI() && target->GetAI()->GetData(DATA_INCREDIBLE_HULK);
554 }
555};
556
@ EQUIP_UNEQUIP
Definition CreatureAI.h:76
@ EQUIP_NO_CHANGE
Definition CreatureAI.h:75
uint32_t uint32
Definition Define.h:133
@ POINT_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
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:34
@ UNIT_FLAG_NON_ATTACKABLE
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ UNIT_STATE_STUNNED
Definition Unit.h:223
DamageEffectType
Definition Unit.h:352
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
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:540
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
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)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void MoveFall(uint32 id=0)
static ObjectGuid const Empty
Definition ObjectGuid.h:140
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
bool operator()(WorldObject *obj) const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void Summon(Creature const *summon)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
virtual uint32 GetData(uint32) const
Definition UnitAI.h:155
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void StopMoving(bool force=false)
Definition Unit.cpp:10312
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3093
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13503
UnitAI * GetAI() const
Definition Unit.h:800
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13286
void SetFacingToObject(WorldObject const *object, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13259
uint32 GetHealth() const
Definition Unit.h:913
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void HandleEmoteCommand(Emote emoteId)
Definition Unit.cpp:1568
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13250
void RemoveAllAuras()
Definition Unit.cpp:4157
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
bool AttackStop()
Definition Unit.cpp:5645
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
Player * SelectNearestPlayer(float distance) const
Definition Object.cpp:2161
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition Object.cpp:2856
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:1992
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
virtual void SetGuidData(uint32, ObjectGuid)
Definition ZoneScript.h:49
bool OnCheck(Player *, Unit *target) override
void FilterTargets(std::list< WorldObject * > &unitList)
PrepareSpellScript(spell_paralyze_pinnacle)
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
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