TrinityCore
Loading...
Searching...
No Matches
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 "SpellMgr.h"
32#include "SpellScript.h"
33#include "TemporarySummon.h"
34#include "ulduar.h"
35
37{
38 // General
40 SPELL_BERSERK = 47008, // Hard enrage, don't know the correct ID.
41 SPELL_KILL_CREDIT = 65195, // spell_dbc
42
43 // Steelbreaker
49
50 // Runemaster Molgeim
55 SPELL_RUNE_OF_SUMMONING = 62273, // This is the spell that summons the rune
56 SPELL_RUNE_OF_SUMMONING_SUMMON = 62020, // Spell that summons
57
58 // Stormcaller Brundir
64 SPELL_STORMSHIELD = 64187
65};
66
95
101
128
130{
132
133 DATA_PHASE_3 = 1
135
137{
138 public:
139 boss_steelbreaker() : CreatureScript("boss_steelbreaker") { }
140
142 {
144 {
145 Initialize();
146 }
147
149 {
150 phase = 0;
151 }
152
154
155 void Reset() override
156 {
157 _Reset();
158 Initialize();
160 }
161
171
172 uint32 GetData(uint32 type) const override
173 {
174 if (type == DATA_PHASE_3)
175 return (phase >= 3) ? 1 : 0;
176
177 return 0;
178 }
179
180 void DoAction(int32 action) override
181 {
182 switch (action)
183 {
185 me->SetFullHealth();
189 if (phase >= 2)
191 if (phase >= 3)
193 break;
196 break;
197 }
198 }
199
200 void JustDied(Unit* /*killer*/) override
201 {
202 _JustDied();
203
205 {
208 }
209 else
210 {
211 me->SetLootRecipient(nullptr);
213 //DoCastAOE(SPELL_SUPERCHARGE, true);
214
216 if (Brundir->IsAlive())
217 Brundir->AI()->DoAction(ACTION_SUPERCHARGE);
218
220 if (Molgeim->IsAlive())
221 Molgeim->AI()->DoAction(ACTION_SUPERCHARGE);
222 }
223 }
224
225 void KilledUnit(Unit* who) override
226 {
227 if (who->GetTypeId() == TYPEID_PLAYER)
229
230 if (phase == 3)
232 }
233
234 void UpdateAI(uint32 diff) override
235 {
236 if (!UpdateVictim())
237 return;
238
239 events.Update(diff);
240
242 return;
243
244 while (uint32 eventId = events.ExecuteEvent())
245 {
246 switch (eventId)
247 {
248 case EVENT_BERSERK:
252 break;
257 break;
262 break;
267 break;
268 }
269
271 return;
272 }
273
275 }
276 };
277
278 CreatureAI* GetAI(Creature* creature) const override
279 {
280 return GetUlduarAI<boss_steelbreakerAI>(creature);
281 }
282};
283
285{
286 public:
287 boss_runemaster_molgeim() : CreatureScript("boss_runemaster_molgeim") { }
288
290 {
295
297 {
298 phase = 0;
299 }
300
302
303 void Reset() override
304 {
305 _Reset();
306 Initialize();
308 }
309
319
320 uint32 GetData(uint32 type) const override
321 {
322 if (type == DATA_PHASE_3)
323 return (phase >= 3) ? 1 : 0;
324
325 return 0;
326 }
327
328 void DoAction(int32 action) override
329 {
330 switch (action)
331 {
333 {
334 me->SetFullHealth();
339 if (phase >= 2)
341 if (phase >= 3)
343 break;
344 }
345 }
346 }
347
348 void JustDied(Unit* /*killer*/) override
349 {
350 _JustDied();
351
353 {
356 }
357 else
358 {
359 me->SetLootRecipient(nullptr);
361 //DoCastAOE(SPELL_SUPERCHARGE, true);
362
364 if (Brundir->IsAlive())
365 Brundir->AI()->DoAction(ACTION_SUPERCHARGE);
366
368 if (Steelbreaker->IsAlive())
369 Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE);
370 }
371 }
372
373 void KilledUnit(Unit* who) override
374 {
375 if (who->GetTypeId() == TYPEID_PLAYER)
377 }
378
379 void UpdateAI(uint32 diff) override
380 {
381 if (!UpdateVictim())
382 return;
383
384 events.Update(diff);
385
387 return;
388
389 while (uint32 eventId = events.ExecuteEvent())
390 {
391 switch (eventId)
392 {
393 case EVENT_BERSERK:
397 break;
399 {
400 Unit* target = me;
401 switch (urand(0, 2))
402 {
403 case 1:
405 if (Steelbreaker->IsAlive())
406 target = Steelbreaker;
407 break;
408 case 2:
410 if (Brundir->IsAlive())
411 target = Brundir;
412 break;
413 default:
414 break;
415 }
418 break;
419 }
423 break;
429 break;
435 break;
436 }
437
439 return;
440 }
441
443 }
444 };
445
446 CreatureAI* GetAI(Creature* creature) const override
447 {
448 return GetUlduarAI<boss_runemaster_molgeimAI>(creature);
449 }
450};
451
453{
454 public:
455 boss_stormcaller_brundir() : CreatureScript("boss_stormcaller_brundir") { }
456
458 {
463
465 {
466 phase = 0;
467 }
468
470
471 void Reset() override
472 {
473 _Reset();
474 Initialize();
476 me->SetHover(false);
477 me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false); // Should be interruptable unless overridden by spell (Overload)
478 me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, false); // Reset immumity, Brundir should be stunnable by default
479 }
480
481 uint32 GetData(uint32 type) const override
482 {
483 if (type == DATA_PHASE_3)
484 return (phase >= 3) ? 1 : 0;
485
486 return 0;
487 }
488
489 void JustEngagedWith(Unit* who) override
490 {
498
499 if (Creature* trigger = me->FindNearestCreature(NPC_WORLD_TRIGGER, 100.0f))
500 m_TriggerGUID = trigger->GetGUID();
501 }
502
503 void DoAction(int32 action) override
504 {
505 switch (action)
506 {
508 {
509 me->SetFullHealth();
514 if (phase >= 2)
516 if (phase >= 3)
517 {
520 me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); // Apply immumity to stuns
521 }
522 break;
523 }
524 }
525 }
526
527 void JustDied(Unit* /*killer*/) override
528 {
529 _JustDied();
530
532 {
535 }
536 else
537 {
538 me->SetLootRecipient(nullptr);
540 //DoCastAOE(SPELL_SUPERCHARGE, true);
541
543 if (Molgeim->IsAlive())
544 Molgeim->AI()->DoAction(ACTION_SUPERCHARGE);
545
547 if (Steelbreaker->IsAlive())
548 Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE);
549 }
550 }
551
552 void KilledUnit(Unit* who) override
553 {
554 if (who->GetTypeId() == TYPEID_PLAYER)
556 }
557
558 void UpdateAI(uint32 diff) override
559 {
560 if (!UpdateVictim())
561 return;
562
563 events.Update(diff);
564
566 return;
567
568 while (uint32 eventId = events.ExecuteEvent())
569 {
570 switch (eventId)
571 {
572 case EVENT_BERSERK:
576 break;
581 break;
582 case EVENT_OVERLOAD:
587 break;
591 break;
596 me->AttackStop();
597 me->SetHover(true);
598 events.DelayEvents(35s);
602 break;
603 case EVENT_FLIGHT:
605 me->GetMotionMaster()->MovePoint(0, *target);
607 break;
608 case EVENT_ENDFLIGHT:
610 me->GetMotionMaster()->MovePoint(0, 1586.920166f, 119.848984f, me->GetPositionZ());
614 break;
615 case EVENT_LAND:
616 me->SetHover(false);
619 break;
620 case EVENT_GROUND:
621 me->RemoveAurasDueToSpell(sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHTNING_TENDRILS, me));
626 break;
629 {
630 float x = float(irand(-25, 25));
631 float y = float(irand(-25, 25));
632
633 Position pos = me->GetPosition();
634
635 pos.m_positionX += x;
636 pos.m_positionY += y;
637
638 // Prevention to go outside the room or into the walls
640 {
641 if (pos.GetExactDist2d(trigger) >= 50.0f)
642 me->GetMotionMaster()->MovePoint(0, *trigger);
643 else
644 me->GetMotionMaster()->MovePoint(0, pos);
645 }
646 }
648 break;
649 default:
650 break;
651 }
652
654 return;
655 }
656
658 }
659
660 private:
662 };
663
664 CreatureAI* GetAI(Creature* creature) const override
665 {
666 return GetUlduarAI<boss_stormcaller_brundirAI>(creature);
667 }
668};
669
671{
672 public:
673 spell_shield_of_runes() : SpellScriptLoader("spell_shield_of_runes") { }
674
691
692 AuraScript* GetAuraScript() const override
693 {
695 }
696};
697
699{
700 public:
701 spell_assembly_meltdown() : SpellScriptLoader("spell_assembly_meltdown") { }
702
704 {
706
708 {
709 if (InstanceScript* instance = GetCaster()->GetInstanceScript())
710 if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_STEELBREAKER)))
711 Steelbreaker->AI()->DoAction(ACTION_ADD_CHARGE);
712 }
713
718 };
719
720 SpellScript* GetSpellScript() const override
721 {
723 }
724};
725
764
766{
767 public:
768 achievement_assembly_i_choose_you() : AchievementCriteriaScript("achievement_assembly_i_choose_you") { }
769
770 bool OnCheck(Player* /*player*/, Unit* target) override
771 {
772 return target && target->GetAI()->GetData(DATA_PHASE_3);
773 }
774};
775
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ DONE
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
int32 irand(int32 min, int32 max)
Definition Random.cpp:35
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_INSTAKILL
@ MECHANIC_STUN
@ MECHANIC_INTERRUPT
@ IMMUNITY_MECHANIC
@ AURA_REMOVE_BY_EXPIRE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_SCHOOL_ABSORB
@ SPELL_AURA_PERIODIC_DUMMY
#define sSpellMgr
Definition SpellMgr.h:738
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ 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_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_SHIELD_OF_RUNES
@ EVENT_MOVE_POSITION
@ EVENT_RUNE_OF_DEATH
@ EVENT_RUNE_OF_SUMMONING
@ EVENT_RUNE_OF_POWER
@ EVENT_FUSION_PUNCH
@ EVENT_LIGHTNING_TENDRILS
@ EVENT_STATIC_DISRUPTION
@ EVENT_LIGHTNING_WHIRL
@ EVENT_OVERWHELMING_POWER
void AddSC_boss_assembly_of_iron()
@ SAY_STEELBREAKER_ENCOUNTER_DEFEATED
@ SAY_MOLGEIM_RUNE_DEATH
@ SAY_BRUNDIR_ENCOUNTER_DEFEATED
@ SAY_MOLGEIM_BERSERK
@ SAY_BRUNDIR_BERSERK
@ SAY_BRUNDIR_SPECIAL
@ EMOTE_BRUNDIR_OVERLOAD
@ SAY_STEELBREAKER_DEATH
@ SAY_MOLGEIM_ENCOUNTER_DEFEATED
@ SAY_STEELBREAKER_POWER
@ SAY_STEELBREAKER_AGGRO
@ SAY_STEELBREAKER_SLAY
@ SAY_STEELBREAKER_BERSERK
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
HookList< EffectApplyHandler > OnEffectRemove
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetLootRecipient(Unit *unit, bool withGroup=true)
void Update(uint32 time)
Definition EventMap.h:67
void DelayEvents(Milliseconds delay)
Definition EventMap.cpp:95
EventId ExecuteEvent()
Definition EventMap.cpp:73
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:52
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
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
EncounterState GetBossState(uint32 id) const
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
static ObjectGuid const Empty
Definition ObjectGuid.h:140
TypeID GetTypeId() const
Definition Object.h:93
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
ObjectGuid GetSummonerGUID() const
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:844
void SetFullHealth()
Definition Unit.h:927
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13503
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:11964
TempSummon * ToTempSummon()
Definition Unit.h:1794
UnitAI * GetAI() const
Definition Unit.h:800
bool IsSummon() const
Definition Unit.h:882
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:8142
void RemoveAllAuras()
Definition Unit.cpp:4157
bool AttackStop()
Definition Unit.cpp:5645
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2099
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool OnCheck(Player *, Unit *target) override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
PrepareSpellScript(spell_assembly_meltdown_SpellScript)
SpellScript * GetSpellScript() const override
AuraScript * GetAuraScript() const override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_shield_of_runes_AuraScript)
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:109
float m_positionX
Definition Position.h:56
float GetPositionZ() const
Definition Position.h:81
float m_positionY
Definition Position.h:57
void GetPosition(float &x, float &y) const
Definition Position.h:84
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:40
@ DATA_MOLGEIM
Definition ulduar.h:425
@ DATA_BRUNDIR
Definition ulduar.h:426
@ DATA_STEELBREAKER
Definition ulduar.h:424