TrinityCore
boss_assembly_of_iron.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/* ScriptData
19SDName: Assembly of Iron encounter
20SD%Complete: 60%
21SDComment: chain lightning won't cast, supercharge don't work (auras don't stack from different casters)
22SDCategory: Ulduar - Ulduar
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "MotionMaster.h"
28#include "ObjectAccessor.h"
29#include "ScriptedCreature.h"
30#include "SpellAuras.h"
31#include "SpellScript.h"
32#include "TemporarySummon.h"
33#include "ulduar.h"
34
36{
37 // General
39 SPELL_BERSERK = 47008, // Hard enrage, don't know the correct ID.
40 SPELL_KILL_CREDIT = 65195, // spell_dbc
41
42 // Steelbreaker
48
49 // Runemaster Molgeim
54 SPELL_RUNE_OF_SUMMONING = 62273, // This is the spell that summons the rune
55 SPELL_RUNE_OF_SUMMONING_SUMMON = 62020, // Spell that summons
56
57 // Stormcaller Brundir
63 SPELL_STORMSHIELD = 64187
64};
65
67{
68 // General
70
71 // Steelbreaker
75
76 // Molgeim
82
83 // Brundir
93};
94
96{
99};
100
102{
109
117
127
129{
131
132 DATA_PHASE_3 = 1
134
136{
137 public:
138 boss_steelbreaker() : CreatureScript("boss_steelbreaker") { }
139
141 {
143 {
144 Initialize();
145 }
146
148 {
149 phase = 0;
150 }
151
153
154 void Reset() override
155 {
156 _Reset();
157 Initialize();
159 }
160
161 void JustEngagedWith(Unit* who) override
162 {
169 }
170
171 uint32 GetData(uint32 type) const override
172 {
173 if (type == DATA_PHASE_3)
174 return (phase >= 3) ? 1 : 0;
175
176 return 0;
177 }
178
179 void DoAction(int32 action) override
180 {
181 switch (action)
182 {
184 me->SetFullHealth();
188 if (phase >= 2)
190 if (phase >= 3)
192 break;
195 break;
196 }
197 }
198
199 void JustDied(Unit* /*killer*/) override
200 {
201 _JustDied();
202
204 {
207 }
208 else
209 {
210 me->SetTappedBy(nullptr);
212 //DoCastAOE(SPELL_SUPERCHARGE, true);
213
215 if (Brundir->IsAlive())
216 Brundir->AI()->DoAction(ACTION_SUPERCHARGE);
217
219 if (Molgeim->IsAlive())
220 Molgeim->AI()->DoAction(ACTION_SUPERCHARGE);
221 }
222 }
223
224 void KilledUnit(Unit* who) override
225 {
226 if (who->GetTypeId() == TYPEID_PLAYER)
228
229 if (phase == 3)
231 }
232
233 void UpdateAI(uint32 diff) override
234 {
235 if (!UpdateVictim())
236 return;
237
238 events.Update(diff);
239
241 return;
242
243 while (uint32 eventId = events.ExecuteEvent())
244 {
245 switch (eventId)
246 {
247 case EVENT_BERSERK:
251 break;
256 break;
261 break;
266 break;
267 }
268
270 return;
271 }
272 }
273 };
274
275 CreatureAI* GetAI(Creature* creature) const override
276 {
277 return GetUlduarAI<boss_steelbreakerAI>(creature);
278 }
279};
280
282{
283 public:
284 boss_runemaster_molgeim() : CreatureScript("boss_runemaster_molgeim") { }
285
287 {
289 {
290 Initialize();
291 }
292
294 {
295 phase = 0;
296 }
297
299
300 void Reset() override
301 {
302 _Reset();
303 Initialize();
305 }
306
307 void JustEngagedWith(Unit* who) override
308 {
315 }
316
317 uint32 GetData(uint32 type) const override
318 {
319 if (type == DATA_PHASE_3)
320 return (phase >= 3) ? 1 : 0;
321
322 return 0;
323 }
324
325 void DoAction(int32 action) override
326 {
327 switch (action)
328 {
330 {
331 me->SetFullHealth();
336 if (phase >= 2)
338 if (phase >= 3)
340 break;
341 }
342 }
343 }
344
345 void JustDied(Unit* /*killer*/) override
346 {
347 _JustDied();
348
350 {
353 }
354 else
355 {
356 me->SetTappedBy(nullptr);
358 //DoCastAOE(SPELL_SUPERCHARGE, true);
359
361 if (Brundir->IsAlive())
362 Brundir->AI()->DoAction(ACTION_SUPERCHARGE);
363
365 if (Steelbreaker->IsAlive())
366 Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE);
367 }
368 }
369
370 void KilledUnit(Unit* who) override
371 {
372 if (who->GetTypeId() == TYPEID_PLAYER)
374 }
375
376 void UpdateAI(uint32 diff) override
377 {
378 if (!UpdateVictim())
379 return;
380
381 events.Update(diff);
382
384 return;
385
386 while (uint32 eventId = events.ExecuteEvent())
387 {
388 switch (eventId)
389 {
390 case EVENT_BERSERK:
394 break;
396 {
397 Unit* target = me;
398 switch (urand(0, 2))
399 {
400 case 1:
402 if (Steelbreaker->IsAlive())
403 target = Steelbreaker;
404 break;
405 case 2:
407 if (Brundir->IsAlive())
408 target = Brundir;
409 break;
410 default:
411 break;
412 }
415 break;
416 }
420 break;
426 break;
432 break;
433 }
434
436 return;
437 }
438 }
439 };
440
441 CreatureAI* GetAI(Creature* creature) const override
442 {
443 return GetUlduarAI<boss_runemaster_molgeimAI>(creature);
444 }
445};
446
448{
449 public:
450 boss_stormcaller_brundir() : CreatureScript("boss_stormcaller_brundir") { }
451
453 {
455 {
456 Initialize();
457 }
458
460 {
461 phase = 0;
462 }
463
465
466 void Reset() override
467 {
468 _Reset();
469 Initialize();
471 me->SetHover(false);
472 me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false); // Should be interruptable unless overridden by spell (Overload)
473 me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, false); // Reset immumity, Brundir should be stunnable by default
474 }
475
476 uint32 GetData(uint32 type) const override
477 {
478 if (type == DATA_PHASE_3)
479 return (phase >= 3) ? 1 : 0;
480
481 return 0;
482 }
483
484 void JustEngagedWith(Unit* who) override
485 {
493
494 if (Creature* trigger = me->FindNearestCreature(NPC_WORLD_TRIGGER, 100.0f))
495 m_TriggerGUID = trigger->GetGUID();
496 }
497
498 void DoAction(int32 action) override
499 {
500 switch (action)
501 {
503 {
504 me->SetFullHealth();
509 if (phase >= 2)
511 if (phase >= 3)
512 {
515 me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); // Apply immumity to stuns
516 }
517 break;
518 }
519 }
520 }
521
522 void JustDied(Unit* /*killer*/) override
523 {
524 _JustDied();
525
527 {
530 }
531 else
532 {
533 me->SetTappedBy(nullptr);
535 //DoCastAOE(SPELL_SUPERCHARGE, true);
536
538 if (Molgeim->IsAlive())
539 Molgeim->AI()->DoAction(ACTION_SUPERCHARGE);
540
542 if (Steelbreaker->IsAlive())
543 Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE);
544 }
545 }
546
547 void KilledUnit(Unit* who) override
548 {
549 if (who->GetTypeId() == TYPEID_PLAYER)
551 }
552
553 void UpdateAI(uint32 diff) override
554 {
555 if (!UpdateVictim())
556 return;
557
558 events.Update(diff);
559
561 return;
562
563 while (uint32 eventId = events.ExecuteEvent())
564 {
565 switch (eventId)
566 {
567 case EVENT_BERSERK:
571 break;
576 break;
577 case EVENT_OVERLOAD:
582 break;
586 break;
591 me->AttackStop();
592 me->SetHover(true);
593 events.DelayEvents(35s);
597 break;
598 case EVENT_FLIGHT:
600 me->GetMotionMaster()->MovePoint(0, *target);
602 break;
603 case EVENT_ENDFLIGHT:
605 me->GetMotionMaster()->MovePoint(0, 1586.920166f, 119.848984f, me->GetPositionZ());
609 break;
610 case EVENT_LAND:
611 me->SetHover(false);
614 break;
615 case EVENT_GROUND:
621 break;
624 {
625 float x = float(irand(-25, 25));
626 float y = float(irand(-25, 25));
627
628 Position pos = me->GetPosition();
629
630 pos.m_positionX += x;
631 pos.m_positionY += y;
632
633 // Prevention to go outside the room or into the walls
635 {
636 if (pos.GetExactDist2d(trigger) >= 50.0f)
637 me->GetMotionMaster()->MovePoint(0, *trigger);
638 else
639 me->GetMotionMaster()->MovePoint(0, pos);
640 }
641 }
643 break;
644 default:
645 break;
646 }
647
649 return;
650 }
651 }
652
653 private:
655 };
656
657 CreatureAI* GetAI(Creature* creature) const override
658 {
659 return GetUlduarAI<boss_stormcaller_brundirAI>(creature);
660 }
661};
662
664{
665 public:
666 spell_shield_of_runes() : SpellScriptLoader("spell_shield_of_runes") { }
667
669 {
670 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
671 {
672 if (Unit* caster = GetCaster())
673 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
674 caster->CastSpell(caster, SPELL_SHIELD_OF_RUNES_BUFF, false);
675 }
676
677 void Register() override
678 {
680 }
681 };
682
683 AuraScript* GetAuraScript() const override
684 {
686 }
687};
688
690{
691 public:
692 spell_assembly_meltdown() : SpellScriptLoader("spell_assembly_meltdown") { }
693
695 {
697 {
698 if (InstanceScript* instance = GetCaster()->GetInstanceScript())
699 if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_STEELBREAKER)))
700 Steelbreaker->AI()->DoAction(ACTION_ADD_CHARGE);
701 }
702
703 void Register() override
704 {
706 }
707 };
708
709 SpellScript* GetSpellScript() const override
710 {
712 }
713};
714
716{
717 public:
718 spell_assembly_rune_of_summoning() : SpellScriptLoader("spell_assembly_rune_of_summoning") { }
719
721 {
722 bool Validate(SpellInfo const* /*spell*/) override
723 {
725 }
726
727 void HandlePeriodic(AuraEffect const* aurEff)
728 {
731 .SetTriggeringAura(aurEff)
732 .SetOriginalCaster(GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : ObjectGuid::Empty));
733 }
734
735 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
736 {
737 if (TempSummon* summ = GetTarget()->ToTempSummon())
738 summ->DespawnOrUnsummon(1ms);
739 }
740
741 void Register() override
742 {
745 }
746 };
747
748 AuraScript* GetAuraScript() const override
749 {
751 }
752};
753
755{
756 public:
757 achievement_assembly_i_choose_you() : AchievementCriteriaScript("achievement_assembly_i_choose_you") { }
758
759 bool OnCheck(Player* /*player*/, Unit* target) override
760 {
761 return target && target->GetAI()->GetData(DATA_PHASE_3);
762 }
763};
764
766{
767 new boss_steelbreaker();
774}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ DONE
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
int32 irand(int32 min, int32 max)
Definition: Random.cpp:35
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_INSTAKILL
@ MECHANIC_STUN
@ MECHANIC_INTERRUPT
@ IMMUNITY_MECHANIC
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_SCHOOL_ABSORB
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ NPC_WORLD_TRIGGER
@ SPELL_FUSION_PUNCH
@ SPELL_ELECTRICAL_CHARGE
@ SPELL_LIGHTNING_WHIRL
@ SPELL_SUMMON_RUNE_OF_POWER
@ SPELL_SUPERCHARGE
@ SPELL_RUNE_OF_SUMMONING_SUMMON
@ SPELL_KILL_CREDIT
@ SPELL_SHIELD_OF_RUNES_BUFF
@ SPELL_STORMSHIELD
@ SPELL_OVERLOAD
@ SPELL_LIGHTNING_TENDRILS_VISUAL
@ SPELL_STATIC_DISRUPTION
@ SPELL_SHIELD_OF_RUNES
@ SPELL_HIGH_VOLTAGE
@ SPELL_CHAIN_LIGHTNING
@ SPELL_OVERWHELMING_POWER
@ SPELL_LIGHTNING_TENDRILS
@ SPELL_RUNE_OF_SUMMONING
@ SPELL_RUNE_OF_DEATH
@ ACTION_ADD_CHARGE
@ ACTION_SUPERCHARGE
@ EVENT_CHAIN_LIGHTNING
@ EVENT_LIGHTNING_BLAST
@ EVENT_ENDFLIGHT
@ EVENT_SHIELD_OF_RUNES
@ EVENT_MOVE_POSITION
@ EVENT_RUNE_OF_DEATH
@ EVENT_RUNE_OF_SUMMONING
@ EVENT_RUNE_OF_POWER
@ EVENT_OVERLOAD
@ EVENT_FUSION_PUNCH
@ EVENT_LIGHTNING_TENDRILS
@ EVENT_STATIC_DISRUPTION
@ EVENT_LIGHTNING_WHIRL
@ EVENT_OVERWHELMING_POWER
void AddSC_boss_assembly_of_iron()
@ SAY_MOLGEIM_SLAY
@ SAY_BRUNDIR_SLAY
@ SAY_STEELBREAKER_ENCOUNTER_DEFEATED
@ SAY_BRUNDIR_DEATH
@ SAY_MOLGEIM_RUNE_DEATH
@ SAY_BRUNDIR_ENCOUNTER_DEFEATED
@ SAY_MOLGEIM_AGGRO
@ SAY_MOLGEIM_DEATH
@ SAY_BRUNDIR_FLIGHT
@ SAY_MOLGEIM_SUMMON
@ SAY_MOLGEIM_BERSERK
@ SAY_BRUNDIR_BERSERK
@ SAY_BRUNDIR_SPECIAL
@ EMOTE_BRUNDIR_OVERLOAD
@ SAY_STEELBREAKER_DEATH
@ SAY_MOLGEIM_ENCOUNTER_DEFEATED
@ SAY_STEELBREAKER_POWER
@ SAY_BRUNDIR_AGGRO
@ SAY_STEELBREAKER_AGGRO
@ SAY_STEELBREAKER_SLAY
@ SAY_STEELBREAKER_BERSERK
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
Unit * GetCaster() const
Unit * GetTarget() const
HookList< EffectApplyHandler > OnEffectRemove
Definition: SpellScript.h:2035
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void SetTappedBy(Unit const *unit, bool withGroup=true)
Definition: Creature.cpp:1339
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void DelayEvents(Milliseconds delay)
Definition: EventMap.cpp:96
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:52
virtual ObjectGuid GetGuidData(uint32 type) const override
EncounterState GetBossState(uint32 id) const
void Initialize()
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
TypeID GetTypeId() const
Definition: Object.h:173
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
virtual uint32 GetData(uint32) const
Definition: UnitAI.h:73
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
Definition: Unit.cpp:7845
bool IsWithinMeleeRange(Unit const *obj) const
Definition: Unit.h:699
void SetFullHealth()
Definition: Unit.h:790
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool SetHover(bool enable, bool updateAnimTier=true)
Definition: Unit.cpp:12938
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
UnitAI * GetAI() const
Definition: Unit.h:660
Unit * GetVictim() const
Definition: Unit.h:715
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void RemoveAllAuras()
Definition: Unit.cpp:4242
bool AttackStop()
Definition: Unit.cpp:5781
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
bool OnCheck(Player *, Unit *target) override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
AuraScript * GetAuraScript() const override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
AuraScript * GetAuraScript() const override
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
float GetExactDist2d(const float x, const float y) const
Definition: Position.h:106
float m_positionX
Definition: Position.h:53
float m_positionY
Definition: Position.h:54
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
constexpr float GetPositionZ() const
Definition: Position.h:78
T const & RAID_MODE(T const &normal10, T const &normal25) const
void ResetThreatList(Unit *who=nullptr)
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
uint32 GetData(uint32 type) const override
@ DATA_ASSEMBLY_OF_IRON
Definition: ulduar.h:41
@ DATA_MOLGEIM
Definition: ulduar.h:410
@ DATA_BRUNDIR
Definition: ulduar.h:411
@ DATA_STEELBREAKER
Definition: ulduar.h:409