diff --git a/sql/updates/world/4.3.4/2020_03_17_00_world.sql b/sql/updates/world/4.3.4/2020_03_17_00_world.sql new file mode 100644 index 00000000000..91669fa199a --- /dev/null +++ b/sql/updates/world/4.3.4/2020_03_17_00_world.sql @@ -0,0 +1,529 @@ +SET @CGUID := 396235; +SET @OGUID := 239773; + +-- Template Updates +-- Deathwing +UPDATE `creature_template` SET `ScriptName`= 'boss_madness_of_deathwing' WHERE `entry`= 56173; +UPDATE `creature_template` SET `unit_flags2`= 134250496, `VehicleId`= 1849 WHERE `entry` IN (56173, 57969, 58000, 58001); +-- Deathwing (Health) +UPDATE `creature_template` SET `AIName`= 'NullCreatureAI' WHERE `entry`= 57962; +UPDATE `creature_template` SET `unit_flags`= 33554432, `unit_flags2`= 134250496, `RegenHealth`= 0 WHERE `entry` IN (57962, 57970, 58125, 58126); +-- Limb Tentacles +UPDATE `creature_template` SET `ScriptName`= 'npc_madness_of_deathwing_limb_tentacle' WHERE `entry` IN (56167, 56846, 56168); +UPDATE `creature_template` SET `RegenHealth`= 0 WHERE `entry` IN (56167, 56846, 56168, 57973, 58131, 58132, 57974, 58133, 58134, 57972, 58129, 58130); +-- Deatwhing Wing R +UPDATE `creature_template` SET `unit_flags`= 33554432, `unit_flags2`= 134250496, `VehicleId`= 1954, `ScriptName`= 'npc_madness_of_deathwing_cosmetic_limb' WHERE `entry`= 57695; +-- Deathwing Wing L +UPDATE `creature_template` SET `unit_flags`= 33554432, `unit_flags2`= 134250496, `VehicleId`= 1954, `ScriptName`= 'npc_madness_of_deathwing_cosmetic_limb' WHERE `entry`= 57696; +-- Deathwing Arm R +UPDATE `creature_template` SET `unit_flags`= 33554432, `unit_flags2`= 134250496, `VehicleId`= 1951, `ScriptName`= 'npc_madness_of_deathwing_cosmetic_limb' WHERE `entry`= 57686; +-- Deathwing Arm L +UPDATE `creature_template` SET `unit_flags`= 33554432, `unit_flags2`= 134250496, `VehicleId`= 1951, `ScriptName`= 'npc_madness_of_deathwing_cosmetic_limb' WHERE `entry`= 57694; +-- Cosmetic Tentacle +UPDATE `creature_template` SET `unit_flags`= 33554432, `unit_flags2`= 134217728 WHERE `entry`= 57693; +-- Mutated Corruption +UPDATE `creature_template` SET `ScriptName`= 'npc_madness_of_deathwing_mutated_corruption' WHERE `entry`= 56471; +-- Regenerative Blood +UPDATE `creature_template` SET `ScriptName`= 'npc_madness_of_deathwing_regenerative_blood' WHERE `entry`= 56263; +UPDATE `creature_template` SET `VehicleId` = 1857, `unit_class`= 4, `speed_run`= 1.71428, `unit_flags2`= 134217728 WHERE `entry` IN (56263, 57975, 58135, 58136); +-- Elementium Bolt +UPDATE `creature_template` SET `speed_run`= 7.1428, `RegenHealth`= 0, `ScriptName`= 'npc_madness_of_deathwing_elementium_bolt' WHERE `entry`= 56262; +-- Elementium Fragment +UPDATE `creature_template` SET `ScriptName`= 'npc_mandess_of_deathwing_elementium_fragment' WHERE `entry`= 56724; +UPDATE `creature_template` SET `unit_flags2`= 134217728 WHERE `entry` IN (56724, 57977, 58140, 58141); +-- Elementium Terror +UPDATE `creature_template` SET `ScriptName`= 'npc_mandess_of_deathwing_elementium_terror' WHERE `entry`= 56710; +UPDATE `creature_template` SET `unit_flags2`= 134217728 WHERE `entry` IN (56710, 57971, 58127, 58128); +-- Claw Mark +UPDATE `creature_template` SET `unit_flags2`= 34816, `flags_extra`= 128, `VehicleId`= 1994 WHERE `entry`= 56545; +-- Time Zone Target +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 56332; +-- Time Zone +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 56311; +-- Crush Target +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 56581; +-- Blistering Tentacle +UPDATE `creature_template` SET `AIName`= 'NullCreatureAI' WHERE `entry`= 56188; +UPDATE `creature_template` SET `unit_flags2`= 134217728, `RegenHealth`= 0 WHERE `entry` IN (56188, 57978, 58142, 58143); +-- Thrall +UPDATE `creature_template` SET `unit_flags`= 32768, `npcflag`= 1, `gossip_menu_id`= 13295, `VehicleId`= 1892, `flags_extra`= 512, `ScriptName`= 'npc_madness_of_deathwing_thrall' WHERE `entry`= 56103; +-- Congealing Blood Target +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 57788; +-- Hemorrhage Target +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 56359; +-- Jump Pad +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 56699; +-- Tail Tentacle Target +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 56519; +-- Cataclysm Stalker +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 56642; +-- Platform +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 56307; +-- Travel to Wyrmrest Base +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 57882; +-- Travel to the deck of The Skyfire +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 57378; +-- Ysera +UPDATE `creature_template` SET `unit_flags`= 320, `ScriptName`= 'npc_madness_of_deathwing_dragon_aspect' WHERE `entry`= 56100; +-- Alexstrasza +UPDATE `creature_template` SET `unit_flags`= 320, `ScriptName`= 'npc_madness_of_deathwing_dragon_aspect' WHERE `entry`= 56099; +-- Nozdormu +UPDATE `creature_template` SET `unit_flags`= 320, `ScriptName`= 'npc_madness_of_deathwing_dragon_aspect' WHERE `entry`= 56102; +-- Kalecgos +UPDATE `creature_template` SET `unit_flags`= 320, `ScriptName`= 'npc_madness_of_deathwing_dragon_aspect' WHERE `entry`= 56101; + +-- Addons +-- Thrall +UPDATE `creature_template_addon` SET `bytes2`= 1 WHERE `entry`= 56103; +-- Alexstrasza +UPDATE `creature_template_addon` SET `bytes1`=50331648, `bytes2`=1, `auras`='105825' WHERE `entry`=56099; +-- Nozdormu +UPDATE `creature_template_addon` SET `bytes1`=50331648, `bytes2`=1, `auras`='105823' WHERE `entry`=56102; +-- Kalecgos +UPDATE `creature_template_addon` SET `bytes1`=50331648, `bytes2`=1, `auras`='106026 106039' WHERE `entry`=56101; +-- Ysera +UPDATE `creature_template_addon` SET `bytes1`=50331648, `bytes2`=1, `auras`='106456 106463' WHERE `entry`=56100; +-- Time Zone +UPDATE `creature_template_addon` SET `auras`= '105831' WHERE `entry`= 56311; +-- Blistering Tentacle +UPDATE `creature_template_addon` SET `aiAnimKit`= 1732, `auras`= '105444' WHERE `entry` IN (56188, 57978, 58142, 58143); +-- Mutated Corruption +UPDATE `creature_template_addon` SET `meleeAnimKit`= 1716, `auras`= '110470' WHERE `entry` IN (56471, 57976, 58137, 58138); +-- Tail Tentacle +UPDATE `creature_template_addon` SET `meleeAnimKit`= 1716 WHERE `entry`= 56844; +-- Regenerative Blood +UPDATE `creature_template_addon` SET `auras`= '105842' WHERE `entry` IN (56263, 57975, 58135, 58136); +-- Claw Mark +UPDATE `creature_template_addon` SET `auras`= '106273' WHERE `entry`= 56545; +-- Elementium Fragment +UPDATE `creature_template_addon` SET `auras`= '106814' WHERE `entry` IN (56724, 57977, 58140, 58141); +-- Elementium Terror +UPDATE `creature_template_addon` SET `auras`= '105842 106728' WHERE `entry` IN (56710, 57971, 58127, 58128); + +-- Spells +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_madness_of_deathwing_presence_of_the_aspects', +'spell_madness_of_deathwing_carrying_winds_jump', +'spell_madness_of_deathwing_carrying_winds_triggered', +'spell_madness_of_deathwing_limb_emerge_visual', +'spell_madness_of_deathwing_agonizing_pain', +'spell_madness_of_deathwing_assault_aspects', +'spell_madness_of_deathwing_face_trigger', +'spell_madness_of_deathwing_summon_tail', +'spell_madness_of_deathwing_crush', +'spell_madness_of_deathwing_hemorrhage', +'spell_madness_of_deathwing_hemorrhage_script', +'spell_madness_of_deathwing_regenerative_blood_script', +'spell_madness_of_deathwing_regenerative_blood_periodic', +'spell_madness_of_deathwing_elementium_meteor_script', +'spell_madness_of_deathwing_elementium_meteor_visual', +'spell_madness_of_deathwing_burning_blood', +'spell_madness_of_deathwing_spawn_blistering_tentacles', +'spell_madness_of_deathwing_time_zone', +'spell_madness_of_deathwing_trigger_concentration', +'spell_madness_of_deathwing_concentration', +'spell_madness_of_deathwing_trigger_aspect_buffs', +'spell_madness_of_deathwing_share_health', +'spell_madness_of_deathwing_summon_elementium_terror', +'spell_madness_of_deathwing_summon_impaling_tentacle', +'spell_madness_of_deathwing_shrapnel', +'spell_madness_of_deathwing_fire_dragon_soul', +'spell_madness_of_deathwing_trigger_aspect_yell', +'spell_madness_of_deathwing_fire_dragon_soul_aspects', +'spell_madness_of_deathwing_corrupted_blood_stacker', +'spell_madness_of_deathwing_corrupted_blood', +'spell_madness_of_deathwing_spellweave', +'spell_madness_of_deathwing_elementium_blast', +'spell_madness_of_deathwing_cataclysm'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(106028, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109571, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109572, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109573, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(106027, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109622, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109623, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109624, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(106457, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109640, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109641, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109642, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(106029, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109606, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109607, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(109608, 'spell_madness_of_deathwing_presence_of_the_aspects'), +(106671, 'spell_madness_of_deathwing_carrying_winds_jump'), +(106673, 'spell_madness_of_deathwing_carrying_winds_jump'), +(106675, 'spell_madness_of_deathwing_carrying_winds_jump'), +(106677, 'spell_madness_of_deathwing_carrying_winds_jump'), +(106666, 'spell_madness_of_deathwing_carrying_winds_jump'), +(106669, 'spell_madness_of_deathwing_carrying_winds_jump'), +(106664, 'spell_madness_of_deathwing_carrying_winds_triggered'), +(109963, 'spell_madness_of_deathwing_carrying_winds_triggered'), +(109962, 'spell_madness_of_deathwing_carrying_winds_triggered'), +(109961, 'spell_madness_of_deathwing_carrying_winds_triggered'), +(107991, 'spell_madness_of_deathwing_limb_emerge_visual'), +(106548, 'spell_madness_of_deathwing_agonizing_pain'), +(107018, 'spell_madness_of_deathwing_assault_aspects'), +(106513, 'spell_madness_of_deathwing_face_trigger'), +(106239, 'spell_madness_of_deathwing_summon_tail'), +(106382, 'spell_madness_of_deathwing_crush'), +(105853, 'spell_madness_of_deathwing_hemorrhage'), +(105862, 'spell_madness_of_deathwing_hemorrhage_script'), +(105934, 'spell_madness_of_deathwing_regenerative_blood_script'), +(105932, 'spell_madness_of_deathwing_regenerative_blood_periodic'), +(105599, 'spell_madness_of_deathwing_elementium_meteor_script'), +(106242, 'spell_madness_of_deathwing_elementium_meteor_visual'), +(105401, 'spell_madness_of_deathwing_burning_blood'), +(109616, 'spell_madness_of_deathwing_burning_blood'), +(109617, 'spell_madness_of_deathwing_burning_blood'), +(109618, 'spell_madness_of_deathwing_burning_blood'), +(105551, 'spell_madness_of_deathwing_spawn_blistering_tentacles'), +(106919, 'spell_madness_of_deathwing_time_zone'), +(106940, 'spell_madness_of_deathwing_trigger_concentration'), +(106644, 'spell_madness_of_deathwing_concentration'), +(106643, 'spell_madness_of_deathwing_concentration'), +(106641, 'spell_madness_of_deathwing_concentration'), +(106642, 'spell_madness_of_deathwing_concentration'), +(106943, 'spell_madness_of_deathwing_trigger_aspect_buffs'), +(109547, 'spell_madness_of_deathwing_share_health'), +(106765, 'spell_madness_of_deathwing_summon_elementium_terror'), +(106775, 'spell_madness_of_deathwing_summon_impaling_tentacle'), +(109568, 'spell_madness_of_deathwing_summon_impaling_tentacle'), +(109958, 'spell_madness_of_deathwing_summon_impaling_tentacle'), +(109957, 'spell_madness_of_deathwing_summon_impaling_tentacle'), +(106789, 'spell_madness_of_deathwing_shrapnel'), +(110065, 'spell_madness_of_deathwing_fire_dragon_soul'), +(110067, 'spell_madness_of_deathwing_fire_dragon_soul_aspects'), +(109708, 'spell_madness_of_deathwing_trigger_aspect_yell'), +(106843, 'spell_madness_of_deathwing_corrupted_blood_stacker'), +(106834, 'spell_madness_of_deathwing_corrupted_blood'), +(109592, 'spell_madness_of_deathwing_corrupted_blood'), +(109593, 'spell_madness_of_deathwing_corrupted_blood'), +(109594, 'spell_madness_of_deathwing_corrupted_blood'), +(106043, 'spell_madness_of_deathwing_spellweave'), +(109609, 'spell_madness_of_deathwing_spellweave'), +(109610, 'spell_madness_of_deathwing_spellweave'), +(109611, 'spell_madness_of_deathwing_spellweave'), +(105723, 'spell_madness_of_deathwing_elementium_blast'), +(109600, 'spell_madness_of_deathwing_elementium_blast'), +(109601, 'spell_madness_of_deathwing_elementium_blast'), +(109602, 'spell_madness_of_deathwing_elementium_blast'), +(106523, 'spell_madness_of_deathwing_cataclysm'), +(110044, 'spell_madness_of_deathwing_cataclysm'), +(110043, 'spell_madness_of_deathwing_cataclysm'), +(110042, 'spell_madness_of_deathwing_cataclysm'); + +-- Conditions +DELETE FROM `conditions` WHERE `SourceEntry` IN (106672, 106674, 106668, 106670, 106676, 106663, 109547, 106548, 106239, 105853, 105862, 105934, 105937, 110210, 110209, 110208, 105599, 106242, 106919, 105830, 105569, 109576, 109577, 109578, 106644, 106643, 106641, 106642, 109548, 106766, 106776, 106789, 110065, 110067, 109708, 110072, 110077, 110071, 110076, 109971, 106943, 106940, 106761, 106538) AND `SourceTypeOrReferenceId`= 13; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES +(13, 1, 106672, 0, 0, 31, 0, 3, 56699, @CGUID+15, 0, 0, '', 'Carrying Winds - Target Jump Pad'), +(13, 1, 106674, 0, 0, 31, 0, 3, 56699, @CGUID+25, 0, 0, '', 'Carrying Winds - Target Jump Pad'), +(13, 1, 106668, 0, 0, 31, 0, 3, 56699, @CGUID+44, 0, 0, '', 'Carrying Winds - Target Jump Pad'), +(13, 1, 106670, 0, 0, 31, 0, 3, 56699, @CGUID+3, 0, 0, '', 'Carrying Winds - Target Jump Pad'), +(13, 1, 106676, 0, 0, 31, 0, 3, 56699, @CGUID+4, 0, 0, '', 'Carrying Winds - Target Jump Pad'), +(13, 1, 106663, 0, 0, 31, 0, 3, 56699, @CGUID+31, 0, 0, '', 'Carrying Winds - Target Jump Pad'), +(13, 3, 109547, 0, 0, 31, 0, 3, 57962, 0, 0, 0, '', 'Share Health - Target Deathwing'), +(13, 1, 109548, 0, 0, 31, 0, 3, 56173, 0, 0, 0, '', 'Share Health - Target Deathwing'), +(13, 7, 106548, 0, 0, 31, 0, 3, 56173, 0, 0, 0, '', 'Agonizing Pain - Target Deathwing'), +(13, 1, 106239, 0, 0, 31, 0, 3, 56519, 0, 0, 0, '', 'Summon Tail - Target Tail Tentacle Targte'), +(13, 1, 105853, 0, 0, 31, 0, 3, 56307, 0, 0, 0, '', 'Hemorrhage - Target Platform'), +(13, 1, 105862, 0, 0, 31, 0, 3, 56307, 0, 0, 0, '', 'Hemorrhage - Target Platform'), +(13, 1, 105934, 0, 0, 31, 0, 3, 56263, 0, 0, 0, '', 'Regenerative Blood - Target Regenerative Blood'), +(13, 1, 105937, 0, 0, 31, 0, 3, 56263, 0, 0, 0, '', 'Regenerative Blood - Target Regenerative Blood'), +(13, 1, 110210, 0, 0, 31, 0, 3, 56263, 0, 0, 0, '', 'Regenerative Blood - Target Regenerative Blood'), +(13, 1, 110209, 0, 0, 31, 0, 3, 56263, 0, 0, 0, '', 'Regenerative Blood - Target Regenerative Blood'), +(13, 1, 110208, 0, 0, 31, 0, 3, 56263, 0, 0, 0, '', 'Regenerative Blood - Target Regenerative Blood'), +(13, 1, 105599, 0, 0, 31, 0, 3, 56262, 0, 0, 0, '', 'Elementium Meteor - Target Elementium Bolt'), +(13, 1, 106242, 0, 0, 31, 0, 3, 56307, 0, 0, 0, '', 'Elementium Meteor - Target Platform'), +(13, 1, 106919, 0, 0, 31, 0, 3, 56307, 0, 0, 0, '', 'Time Zone - Target Platform'), +(13, 7, 105830, 0, 0, 31, 0, 3, 56263, 0, 0, 0, '', 'Time Zone - Target Regenerative Blood'), +(13, 7, 105830, 0, 1, 31, 0, 3, 56710, 0, 0, 0, '', 'Time Zone - Target Elementium Terror'), +(13, 1, 105569, 0, 0, 31, 0, 3, 56188, 0, 0, 0, '', 'Cauterize - Target Blistering Tentacle'), +(13, 1, 109576, 0, 0, 31, 0, 3, 56188, 0, 0, 0, '', 'Cauterize - Target Blistering Tentacle'), +(13, 1, 109577, 0, 0, 31, 0, 3, 56188, 0, 0, 0, '', 'Cauterize - Target Blistering Tentacle'), +(13, 1, 109578, 0, 0, 31, 0, 3, 56188, 0, 0, 0, '', 'Cauterize - Target Blistering Tentacle'), +(13, 1, 106644, 0, 0, 31, 0, 3, 57696, 0, 0, 0, '', 'Concentration - Target Deathwing Wing L'), +(13, 1, 106643, 0, 0, 31, 0, 3, 57694, 0, 0, 0, '', 'Concentration - Target Deathwing Arm L'), +(13, 1, 106641, 0, 0, 31, 0, 3, 57695, 0, 0, 0, '', 'Concentration - Target Deathwing Wing R'), +(13, 1, 106642, 0, 0, 31, 0, 3, 57686, 0, 0, 0, '', 'Concentration - Target Deathwing Arm R'), +(13, 1, 106766, 0, 0, 31, 0, 3, 56307, @CGUID+5, 0, 0, '', 'Elementium Terror - Target Ysera''s Platform'), +(13, 1, 106776, 0, 0, 31, 0, 3, 56307, @CGUID+5, 0, 0, '', 'Elementium Terror - Target Ysera''s Platform'), +(13, 1, 106789, 0, 0, 31, 0, 3, 56724, 0, 0, 0, '', 'Shrapnel - Target Elementium Fragment'), +(13, 1, 110065, 0, 0, 31, 0, 3, 56173, 0, 0, 0, '', 'Fire Dragon Soul - Target Deathwing'), +(13, 1, 109971, 0, 0, 31, 0, 3, 56694, 0, 0, 0, '', 'Fire Dragon Soul - Target The Dragon Soul'), +(13, 1, 110067, 0, 0, 31, 0, 3, 56100, 0, 0, 0, '', 'Fire Dragon Soul Aspects - Target Ysera'), +(13, 1, 110067, 0, 1, 31, 0, 3, 56102, 0, 0, 0, '', 'Fire Dragon Soul Aspects - Target Nozdormu'), +(13, 1, 110067, 0, 2, 31, 0, 3, 56099, 0, 0, 0, '', 'Fire Dragon Soul Aspects - Target Alexstrasza'), +(13, 1, 110067, 0, 3, 31, 0, 3, 56101, 0, 0, 0, '', 'Fire Dragon Soul Aspects - Target Kalecgos'), +(13, 1, 110072, 0, 0, 31, 0, 3, 56694, 0, 0, 0, '', 'Concentration - Target The Dragon Soul'), +(13, 1, 110077, 0, 1, 31, 0, 3, 56694, 0, 0, 0, '', 'Concentration - Target The Dragon Soul'), +(13, 1, 110071, 0, 2, 31, 0, 3, 56694, 0, 0, 0, '', 'Concentration - Target The Dragon Soul'), +(13, 1, 110076, 0, 3, 31, 0, 3, 56694, 0, 0, 0, '', 'Concentration - Target The Dragon Soul'), +(13, 1, 109708, 0, 0, 31, 0, 3, 56100, 0, 0, 0, '', 'Trigger Aspect Yell - Target Ysera'), +(13, 1, 109708, 0, 1, 31, 0, 3, 56102, 0, 0, 0, '', 'Trigger Aspect Yell - Target Nozdormu'), +(13, 1, 109708, 0, 2, 31, 0, 3, 56099, 0, 0, 0, '', 'Trigger Aspect Yell - Target Alexstrasza'), +(13, 1, 109708, 0, 3, 31, 0, 3, 56101, 0, 0, 0, '', 'Trigger Aspect Yell - Target Kalecgos'), +(13, 1, 106943, 0, 0, 31, 0, 3, 56100, 0, 0, 0, '', 'Trigger Aspect Buffs - Target Ysera'), +(13, 1, 106943, 0, 1, 31, 0, 3, 56102, 0, 0, 0, '', 'Trigger Aspect Buffs - Target Nozdormu'), +(13, 1, 106943, 0, 2, 31, 0, 3, 56099, 0, 0, 0, '', 'Trigger Aspect Buffs - Target Alexstrasza'), +(13, 1, 106943, 0, 3, 31, 0, 3, 56101, 0, 0, 0, '', 'Trigger Aspect Buffs - Target Kalecgos'), +(13, 3, 106940, 0, 0, 31, 0, 3, 56100, 0, 0, 0, '', 'Trigger Concentration - Target Ysera'), +(13, 3, 106940, 0, 1, 31, 0, 3, 56102, 0, 0, 0, '', 'Trigger Concentration - Target Nozdormu'), +(13, 3, 106940, 0, 2, 31, 0, 3, 56099, 0, 0, 0, '', 'Trigger Concentration - Target Alexstrasza'), +(13, 3, 106940, 0, 3, 31, 0, 3, 56101, 0, 0, 0, '', 'Trigger Concentration - Target Kalecgos'), +(13, 1, 106761, 0, 0, 31, 0, 3, 56307, @CGUID+5, 0, 0, '', 'Time Zone - Target Ysera''s Platform'), +(13, 1, 106538, 0, 3, 31, 0, 3, 56642, 0, 0, 0, '', 'Cataclysm - Target Cataclysm Target Stalker'); + +-- Custom Attributes +DELETE FROM `spell_custom_attr` WHERE `entry` IN (106444, 109631, 109632, 109633); +INSERT INTO `spell_custom_attr` (`entry`, `attributes`) VALUES +-- Impale +(106444, 0x2000), +(109631, 0x2000), +(109632, 0x2000), +(109633, 0x2000); + +-- Achievement Rewards +DELETE FROM `achievement_reward` WHERE `ID`= 6116; +INSERT INTO `achievement_reward` (`ID`, `TitleA`, `TitleH`) VALUES +(6116, 287, 287); + +-- Spell procs +DELETE FROM `spell_proc` WHERE `SpellId`= 106040; +INSERT INTO `spell_proc` (`SpellId`, `SpellTypeMask`, `SpellPhaseMask`, `Cooldown`) VALUES +(106040, 1, 2, 4000); + +-- Area Triggers +DELETE FROM `areatrigger_scripts` WHERE `ScriptName` IN +('at_madness_of_deathwing_carrying_winds_jump', +'at_madness_of_deathwing_carrying_winds_land'); + +INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES +(7110, 'at_madness_of_deathwing_carrying_winds_jump'), +(7111, 'at_madness_of_deathwing_carrying_winds_jump'), +(7112, 'at_madness_of_deathwing_carrying_winds_jump'), +(7113, 'at_madness_of_deathwing_carrying_winds_jump'), +(7114, 'at_madness_of_deathwing_carrying_winds_jump'), +(7115, 'at_madness_of_deathwing_carrying_winds_jump'), +(7315, 'at_madness_of_deathwing_carrying_winds_land'), +(7316, 'at_madness_of_deathwing_carrying_winds_land'), +(7317, 'at_madness_of_deathwing_carrying_winds_land'), +(7318, 'at_madness_of_deathwing_carrying_winds_land'), +(7319, 'at_madness_of_deathwing_carrying_winds_land'), +(7320, 'at_madness_of_deathwing_carrying_winds_land'); + +-- Gossips +UPDATE `gossip_menu_option` SET `OptionNpcFlag`= 1, `OptionType`= 1 WHERE `MenuId`= 13295 AND `OptionIndex`= 0; +UPDATE `gossip_menu_option_box` SET `BoxBroadcastTextId`= 57303 WHERE `MenuId`= 13295 AND `OptionIndex`= 0; + +-- Movement +DELETE FROM `creature_template_movement` WHERE `CreatureId` IN (53488, 56519, 56699, 56642, 57788, 56102, 56099, 56126, 56100, 56101, 57882, 57378, 56173, 57962, 56167, 56846, 56168, 57973, 58131, 58132, 57974, 58133, 58134, 57972, 58129, 58130, 57969, 58000, 58001, 57970, 58125, 58126, 56471, 57976, 58137, 58138, 56844, 56262, 56545, 56332, 56311, 56724, 57977, 58140, 58141); +INSERT INTO `creature_template_movement` (`CreatureId`, `Ground`, `Swim`, `Flight`, `Rooted`) VALUES +(53488, 1, 0, 1, 0), +(57378, 1, 0, 1, 0), +(56126, 1, 0, 1, 0), +(57788, 1, 0, 1, 0), +(56519, 1, 0, 1, 0), +(56642, 1, 0, 1, 0), +(56699, 1, 0, 1, 0), +(56102, 1, 0, 1, 0), +(56099, 1, 0, 1, 0), +(56100, 1, 0, 1, 0), +(56101, 1, 0, 1, 0), +(57882, 1, 0, 1, 0), +(56173, 1, 0, 1, 1), -- Deathwing +(57969, 1, 0, 1, 1), +(58000, 1, 0, 1, 1), +(58001, 1, 0, 1, 1), +(57962, 1, 0, 1, 1), -- Deathwing (Health) +(57970, 1, 0, 1, 1), +(58125, 1, 0, 1, 1), +(58126, 1, 0, 1, 1), +(56167, 0, 0, 1, 1), -- Arm Tentacle +(57973, 0, 0, 1, 1), +(58131, 0, 0, 1, 1), +(58132, 0, 0, 1, 1), +(56846, 0, 0, 1, 1), -- Arm Tentacle +(57974, 0, 0, 1, 1), +(58133, 0, 0, 1, 1), +(58134, 0, 0, 1, 1), +(56168, 0, 0, 1, 1), -- Wing Tentacle +(57972, 0, 0, 1, 1), +(58129, 0, 0, 1, 1), +(58130, 0, 0, 1, 1), +(56471, 0, 0, 1, 1), -- Mutated Corruption +(57976, 0, 0, 1, 1), +(58137, 0, 0, 1, 1), +(58138, 0, 0, 1, 1), +(56844, 0, 0, 1, 1), -- Tail Tentacle +(56262, 0, 0, 1, 0), -- Elementium Bolt +(56545, 0, 0, 1, 1), -- Claw Mark +(56332, 0, 0, 1, 1), -- Time Zone Target +(56311, 0, 0, 1, 1), -- Time Zone +(56724, 0, 0, 1, 1), -- Elementium Fragment +(57977, 0, 0, 1, 1), +(58140, 0, 0, 1, 1), +(58141, 0, 0, 1, 1); + +-- Vehicle Accessories +DELETE FROM `vehicle_template_accessory` WHERE `entry` IN (56173, 56103); +INSERT INTO `vehicle_template_accessory` (`entry`, `accessory_entry`, `seat_id`, `minion`, `description`, `summontype`, `summontimer`) VALUES +(56173, 57962, 5, 1, 'Deathwing - Deathwing', 8, 0), -- Deathwing - Deathwing +(56173, 57686, 0, 1, 'Deathwing - Deathwing Arm R', 8, 0), -- Deathwing - Deathwing Arm R +(56173, 57694, 1, 1, 'Deathwing - Deathwing Arm L', 8, 0), -- Deathwing - Deathwing Arm L +(56173, 57696, 4, 1, 'Deathwing - Deathwing Wing L', 8, 0), -- Deathwing - Deathwing Wing L +(56173, 57695, 3, 1, 'Deathwing - Deathwing Wing R', 8, 0), -- Deathwing - Deathwing Wing R +(56103, 56694, 0, 1, 'Thrall - The Dragon Soul', 8, 0); -- Thrall - The Dragon Soul + +-- Vehicle Seat Addon +DELETE FROM `vehicle_seat_addon` WHERE `SeatEntry`= 10472; +INSERT INTO `vehicle_seat_addon` (`SeatEntry`, `ExitParamX`, `ExitParamY`, `ExitParamZ`, `ExitParamO`, `ExitParamValue`) VALUES +(10472, -11929.83, 12035.63, 35.45797, 2.164208, 2); + +DELETE FROM `vehicle_seat_addon` WHERE `SeatEntry` IN (10699); +INSERT INTO `vehicle_seat_addon` (`SeatEntry`, `SeatOffsetX`, `SeatOffsetY`, `SeatOffsetZ`, `SeatOffsetO`) VALUES +(10699, 263.0887, 15.0095, 100.1493, 0); -- Deathwing - Seat 5 + +-- Spellclicks +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (56173, 56103); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES +(56173, 46598, 1, 0), +(56103, 46598, 1, 0); + +-- Texts +DELETE FROM `creature_text` WHERE `CreatureID` IN (56173, 56099, 56100, 56101, 56102, 56167, 56846, 56168, 56103); +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `comment`) VALUES +-- Deathwing +(56173, 0, 0, 'You have done NOTHING. I will tear your world APART.', 14, 0, 100, 0, 0, 26527, 55860, 'Deathwing - Aggro'), +(56173, 1, 0, '|TInterface\\Icons\\ability_deathwing_assualtaspects.blp:20|t%s begins to cast |cFFFF0000|Hspell:107018|h[Assault Aspects]|h|r!', 41, 0, 100, 0, 0, 0, 55853, 'Deathwing - Announce Assault Aspects'), +(56173, 2, 0, '|TInterface\\Icons\\ability_deathwing_assualtaspects.blp:20|t%s assaults |cFF04FC32|Hspell:107018|h[Ysera]|h|r!', 41, 0, 100, 0, 0, 0, 55850, 'Deathwing - Announce Assault Ysera'), +(56173, 3, 0, '|TInterface\\Icons\\ability_deathwing_assualtaspects.blp:20|t%s assaults |cFF5858FA|Hspell:107018|h[Kalecgos]|h|r!', 41, 0, 100, 0, 0, 0, 55851, 'Deathwing - Announce Assault Kalecgos'), +(56173, 4, 0, '|TInterface\\Icons\\ability_deathwing_assualtaspects.blp:20|t%s assaults |cFFFFFF00|Hspell:107018|h[Nozdormu]|h|r!', 41, 0, 100, 0, 0, 0, 55849, 'Deathwing - Announce Assault Nozdormu'), +(56173, 5, 0, '|TInterface\\Icons\\ability_deathwing_assualtaspects.blp:20|t%s assaults |cFFFF0000|Hspell:107018|h[Alexstrasza]|h|r!', 41, 0, 100, 0, 0, 0, 55848, 'Deathwing - Announce Assault Alexstrasza'), +(56173, 6, 0, '|TInterface\\Icons\\ability_deathwing_cataclysm.blp:20|t%s begins to cast |cFFFF0000|Hspell:106523|h[Cataclysm]|h|r! Stop Him!', 41, 0, 100, 0, 0, 0, 55535, 'Deathwing - Announce Cataclysm'), +(56173, 7, 0, '|TInterface\\Icons\\spell_fire_moltenblood.blp:20|t%s begins to |cFFFF0000|Hspell:105863|h[Hemorrhage]|h|r!', 41, 0, 100, 0, 0, 0, 55023, 'Deathwing - Announce Hemorrhage'), +(56173, 8, 0, '|TInterface\\Icons\\spell_fire_meteorstorm.blp:20|t%s begins to cast |cFFFF0000|Hspell:105651|h[Elementium Bolt]|h|r!', 41, 0, 100, 0, 0, 0, 55826, 'Deathwing - Announce Elementium Bolt'), +(56173, 9, 0, 'There is no shelter from my fury!', 14, 0, 100, 0, 0, 26354, 73802, 'Deathwing - Elementium Bolt 1'), +(56173, 9, 1, 'The sea will swallow your smoldering remains.', 14, 0, 100, 0, 0, 26356, 55781, 'Deathwing - Elementium Bolt 2'), +(56173, 9, 2, 'Your armor means nothing, your faith even less.', 14, 0, 100, 0, 0, 26355, 55780, 'Deathwing - Elementium Bolt 3'), +(56173, 10, 0, 'I AM DEATHWING, THE DESTROYER, THE END OF ALL THINGS, INEVITABLE, INDOMITABLE; I AM THE CATACLYSM!', 14, 0, 100, 0, 0, 26348, 55785, 'Deathwing - Slump'), +(56173, 11, 0, '|TInterface\\Icons\\inv_stave_2h_deathwingraiddw_d_01.blp:20|t%s falls forward, get to |cFF04FC32Ysera\'s|r platform!', 41, 0, 100, 0, 0, 0, 56720, 'Deathwing - Announce Slump'), +-- Limb Tentacles +(56167, 0, 0, '|TInterface\\Icons\\ability_warrior_bloodnova.blp:20|tThe %s is injured and sprouts |cFFFE9A2EBlistering Tentacles|r!', 41, 0, 100, 0, 0, 0, 54846, 'Limbt Tentacle - Announce Blistering Tentacles'), +(56846, 0, 0, '|TInterface\\Icons\\ability_warrior_bloodnova.blp:20|tThe %s is injured and sprouts |cFFFE9A2EBlistering Tentacles|r!', 41, 0, 100, 0, 0, 0, 54846, 'Limbt Tentacle - Announce Blistering Tentacles'), +(56168, 0, 0, '|TInterface\\Icons\\ability_warrior_bloodnova.blp:20|tThe %s is injured and sprouts |cFFFE9A2EBlistering Tentacles|r!', 41, 0, 100, 0, 0, 0, 54846, 'Limbt Tentacle - Announce Blistering Tentacles'), +-- Alextsrasza +(56099, 0, 0, 'I will cleanse whatever corruption I can; my fire will not harm you.', 14, 0, 100, 0, 0, 26498, 56772, 'Alexstrasza - Introduce Ability'), +(56099, 1, 0, 'No! Such power! Deathwing''s summoning of the final Cataclysm will destroy all life on Azeroth. Quickly, we must interrupt him!', 14, 0, 100, 0, 0, 26500, 55773, 'Alexstrasza - Cataclysm'), +(56099, 2, 0, 'He\'s completely mad!!', 14, 0, 100, 0, 0, 26499, 56774, 'Alexstrasza - Phase 2'), +(56099, 3, 0, 'Excellent work. The fire of my heart glows with a brilliant purity unmatched; every spark of it I will channel into the Dragon Soul.', 14, 0, 100, 0, 0, 26497, 56773, 'Alexstrasza - Charge Dragon Soul'), +-- Ysera +(56100, 0, 0, 'I will bring you closer to the Emerald Dream. Seek safety there when the fight becomes too intense.', 14, 0, 100, 0, 0, 26142, 56776, 'Ysera - Introduce Ability'), +(56100, 1, 0, 'Deathwing is conjuring the final Cataclysm; even the Emerald Dream trembles. If we are to stop the spell, we must attack him together.', 14, 0, 100, 0, 0, 26144, 56781, 'Ysera - Cataclysm'), +(56100, 2, 0, 'Such rage I have never seen...', 14, 0, 100, 0, 0, 26143, 56777, 'Ysera - Phase 2'), +(56100, 3, 0, 'We are one step closer. The unknowable, transcendent power of the Emerald Dream I now give unto the Dragon Soul.', 14, 0, 100, 0, 0, 26141, 56775, 'Ysera - Charge Dragon Soul'), +-- Kalecgos +(56101, 0, 0, 'I will charge you with arcane energy to blast your foes.', 14, 0, 100, 0, 0, 26259, 56752, 'Kalecgos - Introduce Ability'), +(56101, 1, 0, 'The Destroyer is gathering all his might for a blow that will split the world. Attack him, now! We must stop the final Cataclysm!', 14, 0, 100, 0, 0, 26261, 55776, 'Kalecgos - Cataclysm'), +(56101, 2, 0, 'Is he... coming apart?', 14, 0, 100, 0, 0, 26260, 56753, 'Kalecgos - Phase 2'), +(56101, 3, 0, 'Well done! I will realign the flow of mana and fill the Dragon Soul with all my arcane might.', 14, 0, 100, 0, 0, 26258, 56751, 'Kalecgos - Charge Dragon Soul'), +-- Nozdormu +(56102, 0, 0, 'I will slow the Destroyer''s attacks when I can.', 14, 0, 100, 0, 0, 25949, 55786, 'Nozdormu - Introduce Ability'), +(56102, 1, 0, 'Hurry, heroes. In mere moments Deathwing''s Cataclysm will complete what he begun and end the world. Join me in the attack, now!', 14, 0, 100, 0, 0, 25951, 55774, 'Nozdormu - Cataclysm'), +(56102, 2, 0, 'Press the attack, heroes.', 14, 0, 100, 0, 0, 25950, 56770, 'Nozdormu - Phase 2'), +(56102, 3, 0, 'It is time. I will expend everything to bind every thread here, now, around the Dragon Soul. What comes to pass will NEVER be undone.', 14, 0, 100, 0, 0, 26600, 56769, 'Nozdormu - Charge Dragon Soul'), +-- Thrall +(56103, 0, 0, 'It is done; at last the Destroyer has met his end. Now, we can begin to heal our world.', 14, 0, 100, 0, 0, 25901, 55768, 'Thrall - Pre Fight'), +(56103, 1, 0, 'Aspects! Aid the heroes as best you can.', 14, 0, 100, 0, 0, 25895, 56737, 'Thrall - Saay Phase Two'); + +UPDATE `creature_text` SET `TextRange`= 1 WHERE `CreatureID` IN (56173, 56167, 56099, 56100, 56101, 56102); + +-- Model Info +UPDATE `creature_model_info` SET `CombatReach`= 28, `BoundingRadius`= 2 WHERE `DisplayID`= 39405; +UPDATE `creature_model_info` SET `CombatReach`= 8, `BoundingRadius`= 0.25 WHERE `DisplayID`= 39347; +UPDATE `creature_model_info` SET `CombatReach`= 45, `BoundingRadius`= 0.5 WHERE `DisplayID`= 39947; + +-- Spawns +DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+69; +DELETE FROM `creature_addon` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+69; +INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `PhaseId`, `PhaseGroup`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `VerifiedBuild`) VALUES +(@CGUID+0, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12116.92, 12170.92, -2.650913, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+1, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12098.57, 12160.6, -2.65092, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+2, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12079.91, 12150.8, -2.65092, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+3, 56699, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12087.5, 12165.71, -2.650913, 1.082104, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Jump Pad (Area: The Maelstrom - Difficulty: 0) +(@CGUID+4, 56699, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12099.64, 12152.82, -2.65092, 1.082104, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Jump Pad (Area: The Maelstrom - Difficulty: 0) +(@CGUID+5, 56307, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12111.44, 12169.91, -2.650916, 5.689773, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Platform (Area: The Maelstrom - Difficulty: 0) (Auras: ) +(@CGUID+6, 57788, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12128.51, 12171.41, -2.650913, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Congealing Blood Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+7, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12031.41, 12221.06, -6.068901, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+8, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12120.56, 12133.38, -19.57082, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+9, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12046.92, 12234.78, -6.068901, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+10, 57882, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12128.2, 12181.18, 0.3175833, 5.585053, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Travel to Wyrmrest Base (Area: The Maelstrom - Difficulty: 0) (Auras: 108227 - Teleport Visual - Disabled, 108203 - Teleport Visual - Active) +(@CGUID+11, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12032.57, 12175.48, -5.714281, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+12, 57788, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12083.2, 12173.7, -4.719368, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Congealing Blood Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+13, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12140.5, 12082.68, 2.39029, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+14, 57378, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12132.63, 12172.89, 0.3175833, 5.77704, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Travel to the deck of The Skyfire (Area: The Maelstrom - Difficulty: 0) (Auras: 108227 - Teleport Visual - Disabled, 108203 - Teleport Visual - Active) +(@CGUID+15, 56699, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12047.93, 12213.88, -5.942781, 4.782202, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Jump Pad (Area: The Maelstrom - Difficulty: 0) +(@CGUID+16, 57788, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12075.18, 12133.7, -2.65092, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Congealing Blood Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+17, 57788, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12099.08, 12142.67, -2.65092, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Congealing Blood Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+18, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12020.94, 12210.8, -6.068901, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+19, 57788, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12117.79, 12155.29, -2.65092, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Congealing Blood Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+20, 56103, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12074.33, 12159.48, -2.650913, 2.844887, 604800, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Thrall (Area: The Maelstrom - Difficulty: 0) (Auras: ) (possible waypoints or random movement) +(@CGUID+21, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12119.09, 12074.42, 2.390291, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+22, 56307, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12040.33, 12232.46, -6.068902, 5.51524, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Platform (Area: The Maelstrom - Difficulty: 0) (Auras: ) +(@CGUID+23, 56100, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12157.36, 12212.52, 36.01524, 5.759586, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Ysera (Area: The Maelstrom - Difficulty: 0) (Auras: 106456 - Ysera's Presence, 106463 - The Dreamer) (possible waypoints or random movement) +(@CGUID+24, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12037.97, 12099.33, -32.49138, 0.1396263, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+25, 56699, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12118.42, 12084.9, 2.390293, 1.082104, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Jump Pad (Area: The Maelstrom - Difficulty: 0) +(@CGUID+26, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12100.41, 12072.44, 2.390291, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+27, 56307, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12139.36, 12080.59, 2.390289, 5.794493, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Platform (Area: The Maelstrom - Difficulty: 0) (Auras: ) +(@CGUID+28, 56101, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12224.83, 12128.53, 68.96001, 5.846853, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Kalecgos (Area: The Maelstrom - Difficulty: 0) (Auras: 106026 - Kalecgos' Presence, 106039 - Spellweaver) (possible waypoints or random movement) +(@CGUID+29, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12245.54, 12321.76, 1.596802, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+30, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12070.19, 12020.37, -53.17715, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+31, 56699, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -12023.02, 12228.5, -6.068902, 1.082104, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Jump Pad (Area: The Maelstrom - Difficulty: 0) +(@CGUID+32, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12313.38, 12207.58, -10.49461, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+33, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12222.05, 12108.45, 9.211418, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+34, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -11902.55, 12187.86, -36.58665, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+35, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -11964.7, 12212.82, -26.10259, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+36, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12020.5, 12299.67, -27.89029, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+37, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12166.1, 12385.22, 2.22749, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+38, 56102, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12093.81, 12311.97, 43.228, 5.427974, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Nozdormu (Area: The Maelstrom - Difficulty: 0) (Auras: 105823 - Nozdormu's Presence) (possible waypoints or random movement) +(@CGUID+39, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12158.22, 12048.96, -26.88116, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+40, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12067.77, 12040.92, -29.82544, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+41, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -11923.36, 12298.35, 1.383957, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+42, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12210.96, 12033.6, 73.0329, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+43, 56099, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -11957.31, 12338.35, 38.93643, 5.061455, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Alexstrasza (Area: The Maelstrom - Difficulty: 0) (Auras: 105825 - Alexstrasza's Presence) (possible waypoints or random movement) +(@CGUID+44, 56699, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -11972.8, 12272.76, 1.383957, 4.014257, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Jump Pad (Area: The Maelstrom - Difficulty: 0) +(@CGUID+45, 56307, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -11960.45, 12288.48, 1.383957, 4.921828, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Platform (Area: The Maelstrom - Difficulty: 0) (Auras: ) +(@CGUID+46, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -11691.89, 12003.74, 12.16883, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+47, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -11969.56, 12428.65, -9.830806, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+48, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -11903.43, 12283.83, 49.89705, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+49, 56126, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -1815.5, -2408.23, 343.8793, 0.4712389, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Target Dummy (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul) +(@CGUID+50, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12311.08, 12354.16, 38.14534, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+51, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12071.36, 12491.06, -10.69453, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+52, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12167.89, 12415.39, 25.07364, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+53, 56642, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12374.24, 12266.4, 9.704861, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Cataclysm Stalker (Area: The Maelstrom - Difficulty: 0) +(@CGUID+54, 56519, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12139.71, 12165.99, -6.672815, 6.091199, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Tail Tentacle Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+55, 56519, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12107.37, 12201.94, -5.407307, 5.166174, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Tail Tentacle Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+56, 56519, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12082.41, 12227.6, -7.630992, 0.3316126, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Tail Tentacle Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+57, 56519, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12028.85, 12265.57, -6.354803, 4.13643, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Tail Tentacle Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+58, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -11958.05, 12264.98, 1.383957, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+59, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -11960.33, 12283.85, 1.383958, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+60, 53488, 967, 5892, 5893, 15, 1, 0, 374, 0, 0, -11950.15, 12250.48, 1.383959, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Summon Enabler Stalker (Area: The Maelstrom - Difficulty: 0) (Auras: 109247 - Presence of the Dragon Soul, 99201 - Summon Enabler) +(@CGUID+61, 56519, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -11993.29, 12286.31, -2.664478, 5.916666, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Tail Tentacle Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+62, 56519, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -11929.17, 12297.82, -2.252743, 4.380776, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Tail Tentacle Target (Area: The Maelstrom - Difficulty: 0) +(@CGUID+63, 56519, 967, 5892, 5893, 15, 1, 169, 0, 0, 0, -12160.9, 12057.04, 2.390291, 0.7330383, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Tail Tentacle Target (Area: The Maelstrom - Difficulty: 0) +-- Outro spawns +(@CGUID+64, 58211, 967, 5892, 5893, 15, 1, 173, 0, 0, 0, -12066.06, 12150.39, -2.650913, 3.054326, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Aggra (Area: The Maelstrom - Difficulty: 0) +(@CGUID+65, 58210, 967, 5892, 5893, 15, 1, 173, 0, 0, 0, -12069.18, 12159.9, -2.650913, 5.235988, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Kalecgos (Area: The Maelstrom - Difficulty: 0) +(@CGUID+66, 58207, 967, 5892, 5893, 15, 1, 173, 0, 0, 0, -12077.35, 12152.27, -2.65092, 6.003932, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Alexstrasza (Area: The Maelstrom - Difficulty: 0) +(@CGUID+67, 58232, 967, 5892, 5893, 15, 1, 173, 0, 0, 0, -12067.72, 12146.38, -2.650914, 3.054326, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Thrall (Area: The Maelstrom - Difficulty: 0) +(@CGUID+68, 58209, 967, 5892, 5893, 15, 1, 173, 0, 0, 0, -12073.81, 12156.58, -2.650914, 5.550147, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Ysera (Area: The Maelstrom - Difficulty: 0) +(@CGUID+69, 58208, 967, 5892, 5893, 15, 1, 173, 0, 0, 0, -12078.41, 12147.46, -2.65092, 0.1745329, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595); -- Nozdormu (Area: The Maelstrom - Difficulty: 0) + +DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID+0 AND @OGUID+3; +DELETE FROM `gameobject_addon` WHERE `guid` BETWEEN @OGUID+0 AND @OGUID+3; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `PhaseId`, `PhaseGroup`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `VerifiedBuild`) VALUES +(@OGUID+1, 210147, 967, 5892, 5960, 15, 169, 0, -11890.66, 12286.22, -7.097955, 5.750861, 0, 0, -0.263031, 0.9647874, 7200, 255, 1, 15595), -- Dragon Soul - Deathwing - Lightning Object 4 (Area: Deathwing - Difficulty: 0) +(@OGUID+2, 210151, 967, 5892, 5960, 15, 169, 0, -12078.56, 12023.13, -25.95958, 5.585054, 0, 0, -0.34202, 0.9396927, 7200, 255, 1, 15595), -- Dragon Soul - Deathwing - Lightning Object 1 (Area: Deathwing - Difficulty: 0) +(@OGUID+3, 210150, 967, 5892, 5893, 15, 169, 0, -11717.32, 11946.83, -103.3597, 2.687807, 0, 0, 0.97437, 0.2249513, 7200, 255, 1, 15595); -- Dragon Soul - Deathwing - Lightning Object 2 (Area: The Maelstrom - Difficulty: 0) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index d1414e63f5b..496160a5783 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -5198,6 +5198,40 @@ void SpellMgr::LoadSpellInfoCorrections() // ENDOF THRONE OF THE FOUR WINDS SPELLS + // DRAGON SOUL SPELLS + + ApplySpellFix({ + 106028, // Alexstrasza's Presence + 109571, + 109572, + 109573, + 106457, // Ysera's Presence + 109640, + 109641, + 109642, + 106027, // Nozdormu's Presence + 109622, + 109623, + 109624, + 106029, // Kalecgos' Presence + 109606, + 109607, + 109608, + 106040, // Spellweaving + 106464 // Enter the Dream + }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + }); + + // Root + ApplySpellFix({ 105451 }, [](SpellInfo* spellInfo) + { + spellInfo->Effects[EFFECT_0].ApplyAuraName = SPELL_AURA_MOD_ROOT; + }); + + // ENDOF DRAGON SOUL SPELLS + // Disenchant ApplySpellFix({ 13262 }, [](SpellInfo* spellInfo) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/boss_madness_of_deathwing.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/boss_madness_of_deathwing.cpp new file mode 100644 index 00000000000..1decac8e0b3 --- /dev/null +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/boss_madness_of_deathwing.cpp @@ -0,0 +1,2719 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "dragon_soul.h" +#include "CreatureAI.h" +#include "GameObject.h" +#include "Group.h" +#include "InstanceScript.h" +#include "Map.h" +#include "MoveSpline.h" +#include "MoveSplineInit.h" +#include "Optional.h" +#include "PassiveAI.h" +#include "PhasingHandler.h" +#include "Player.h" +#include "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" +#include "SpellMgr.h" +#include "Spell.h" +#include "TemporarySummon.h" +#include "Vehicle.h" + +#include + +enum Texts +{ + // Deathwing + SAY_AGGRO = 0, + SAY_ANNOUNCE_ASSAULT_ASPECTS = 1, + SAY_ANNOUNCE_ASSAULT_YSERA = 2, + SAY_ANNOUNCE_ASSAULT_KALECGOS = 3, + SAY_ANNOUNCE_ASSAULT_NOZDORMU = 4, + SAY_ANNOUNCE_ASSAULT_ALEXSTRASZA = 5, + SAY_ANNOUNCE_CATACLYSM = 6, + SAY_ANNOUNCE_HEMORRHAGE = 7, + SAY_ANNOUNCE_ELEMENTIUM_BOLT = 8, + SAY_ELEMENTIUM_BOLT = 9, + SAY_SLUMP = 10, + SAY_ANNOUNCE_SLUMP = 11, + + // Limb Tentacles + SAY_ANNOUNCE_BLISTERING_TENTACLES = 0, + + // Dragon Aspects + SAY_INTRODUCE_ABILITY = 0, + SAY_CATACLYSM = 1, + SAY_PHASE_TWO = 2, + SAY_CHARGE_DRAGON_SOUL = 3, + + // Thrall + SAY_PRE_FIGHT = 0, + SAY_AID_CHAMPIONS = 1 +}; + +enum Spells +{ + // Deathwing + SPELL_ROOT = 105451, + SPELL_SHARE_HEALTH_1 = 109547, + SPELL_SHARE_HEALTH_2 = 109548, + SPELL_TRIGGER_ASPECT_BUFFS = 106943, + SPELL_ASSAULT_ASPECTS = 107018, + SPELL_FACE_TRIGGER = 106513, + SPELL_FACE_MID_LEFT = 106510, + SPELL_FACE_MID_RIGHT = 106511, + SPELL_FACE_RIGHT = 106512, + SPELL_FACE_LEFT = 106509, + SPELL_SUMMON_TAIL = 106239, + SPELL_CATACLYSM = 106523, + SPELL_CATACLYSM_VISUAL = 106538, + SPELL_HEMORRHAGE_SUMMON_TARGET = 105853, + SPELL_REGENERATIVE_BLOOD_PERIODIC = 105932, + SPELL_REGENERATIVE_BLOOD_SCRIPT = 105934, + SPELL_REGENERATIVE_BLOOD_HEAL = 105937, + SPELL_ELEMENTIUM_BOLT = 105651, + SPELL_SLUMP = 106708, + SPELL_CORRUPTED_BLOOD_STACKER = 106843, + SPELL_SUMMON_ELEMENTIUM_TERROR = 106765, + SPELL_SUMMON_IMPALING_TENTACLE = 106775, + SPELL_SHRAPNEL_PERIODIC = 106818, + SPELL_SLUMP_OUTRO = 110062, + SPELL_DEATH = 110101, + SPELL_DEATHWING_KILL_CREDIT = 111533, + SPELL_TIME_ZONE_PHASE_TWO = 106761, + + // Limb Tentacle + SPELL_LIMB_EMERGE_VISUAL = 107991, + SPELL_AGONIZING_PAIN = 106548, + SPELL_TRIGGER_CONCENTRATION = 106940, + SPELL_BURNING_BLOOD = 105401, + SPELL_SPAWN_BLISTERING_TENTACLES = 105551, + + // Mutated Corruption + SPELL_CRUSH_TARGETING = 106382, + SPELL_CRUSH = 106385, + SPELL_IMPALE = 106400, + + // Hemorrhage Target + SPELL_HEMORRHAGE_PERIODIC = 105861, + + // Regenerative Blood + SPELL_DEGENERATIVE_BITE = 105842, + + // Elementium Bolt + SPELL_ELEMENTIUM_METEOR_VISUAL = 106242, + SPELL_ELEMENTIUM_BLAST = 105723, + SPELL_ELEMENTIUM_BLAST_PERIODIC = 110628, + SPELL_ELEMENTIUM_METEOR_TRANSFORM = 106991, + SPELL_ELEMENTIUM_METEOR_TRANSFORM_DEATH = 110663, + + // Claw Mark + SPELL_CLAW_MARK = 106273, + + // Elementium Fragment + SPELL_SHRAPNEL = 106791, + + // Thrall + SPELL_ASTRAL_RECALL = 108537, + SPELL_ASTRAL_RECALL_OUTRO = 110063, + SPELL_FIRE_DRAGON_SOUL_ASPECTS = 110067, + SPELL_TRIGGER_ASPECT_YELL = 109708, + SPELL_FIRE_DRAGON_SOUL = 109971, + SPELL_PLAY_MOVIE = 107000, + + // Dragon Aspects + SPELL_TIME_ZONE = 106919, + SPELL_TIME_ZONE_MISSILE = 105799, + SPELL_TIME_ZONE_MISSILE_PHASE_TWO = 107055, + SPELL_CAUTERIZE = 105565, + SPELL_CONCENTRATION_KALECGOS = 106644, + SPELL_CONCENTRATION_YSERA = 106643, + SPELL_CONCENTRATION_ALEXSTRASZA = 106641, + SPELL_CONCENTRATION_NOZDORMU = 106642, + SPELL_CONCENTRATION_KALECGOS_OUTRO = 110072, + SPELL_CONCENTRATION_YSERA_OUTRO = 110077, + SPELL_CONCENTRATION_ALEXSTRASZA_OUTRO = 110071, + SPELL_CONCENTRATION_NOZDORMU_OUTRO = 110076, + SPELL_YSERAS_PRESENCE = 106456, + SPELL_THE_DREAMER = 106463, + SPELL_KALECGOS_PRESENCE = 106026, + SPELL_SPELLWEAVER = 106039, + SPELL_NOZDORMUS_PRESENCE = 105823, + SPELL_ALEXSTRASZAS_PRESENCE = 105825, + + // Cosmetic Limbs + SPELL_SUMMON_COSMETIC_TENTACLE = 108970, + + // Jump Pad + SPELL_CARRYING_WINDS_JUMP_YSERA_TO_NOZDORMU = 106673, + SPELL_CARRYING_WINDS_JUMP_YSERA_TO_KALECGOS = 106675, + SPELL_CARRYING_WINDS_JUMP_NOZDORMU_TO_ALEXSTRASZA = 106669, + SPELL_CARRYING_WINDS_JUMP_NOZDORMU_TO_YSERA = 106671, + SPELL_CARRYING_WINDS_JUMP_KALECGOS_TO_YSERA = 106677, + SPELL_CARRYING_WINDS_JUMP_ALEXSTRASZA_TO_NOZDORMU = 106666, + + // Player + SPELL_CARRYING_WINDS_DUMMY_YSERA_TO_NOZDORMU = 106672, + SPELL_CARRYING_WINDS_DUMMY_YSERA_TO_KALECGOS = 106674, + SPELL_CARRYING_WINDS_DUMMY_NOZDORMU_TO_ALEXSTRASZA = 106668, + SPELL_CARRYING_WINDS_DUMMY_NOZDORMU_TO_YSERA = 106670, + SPELL_CARRYING_WINDS_DUMMY_KALECGOS_TO_YSERA = 106676, + SPELL_CARRYING_WINDS_DUMMY_ALEXSTRASZA_TO_NOZDORMU = 106663 +}; + +#define SPELL_TETANUS RAID_MODE(106730, 109603, 109604, 109605) +#define SPELL_DEGENERATIVE_BITE RAID_MODE(105841, 109625, 109626, 109627) + +enum Events +{ + // Deathwing + EVENT_ASSAULT_ASPECTS = 1, + EVENT_FACE_PLATFORM, + EVENT_SEND_ENCOUNTER_FRAME, + EVENT_SUMMON_TAIL, + EVENT_CATACLYSM, + EVENT_HEMORRHAGE, + EVENT_REGENERATIVE_BLOOD, + EVENT_ELEMENTIUM_BOLT, + EVENT_SUMMON_ELEMENTIUM_TERROR, + EVENT_SUMMON_ELEMENTIUM_FRAGMENTS, + EVENT_PREPARE_TIME_ZONE, + EVENT_DISENGAGE, + + // Mutated Corruption + EVENT_CRUSH_TARGETING, + EVENT_CRUSH, + EVENT_IMPALE, + + // Elemetium Bolt + EVENT_LAUNCH_ELEMENTIUM_BOLT, + EVENT_ELEMENTUIM_BLAST, + + // Dragon Aspects + EVENT_TIME_ZONE, + EVENT_TIME_ZONE_PHASE_TWO, + EVENT_CAUTERIZE, + EVENT_TALK_PHASE_TWO, + EVENT_TALK_CHARGE_DRAGON_SOUL, + + // Thrall + EVENT_FACE_TOWARDS_DEATHWING, + EVENT_TALK_AID_CHAMPIONS, + EVENT_FIRE_DRAGON_SOUL, + EVENT_PLAY_MOVIE +}; + +enum Actions +{ + // Deathwing + ACTION_ASSAULT_PLATFORM = 0, + ACTION_LIMB_TENTACLE_DAMAGED = 1, + ACTION_DEATH = 2, + + // Dragon Aspects + ACTION_ASSAULTED = 0, + ACTION_LIMB_KILLED = 1, + ACTION_CATACLYSM_IN_PROGRESS = 2, + ACTION_CREATE_TIME_ZONE = 3, + ACTION_CAUTERIZE = 4, + ACTION_TALK_PHASE_TWO = 5, + ACTION_TALK_CHARGE_DRAGON_SOUL = 6, + ACTION_CAST_TIME_ZONE = 7, + + // Elemetium Bolt + ACTION_LAUNCH_ELEMENTIUM_BOLT = 0, + + // Thrall + ACTION_TALK_ASPECT_AID = 0, + ACTION_FIRE_DRAGON_SOUL = 1 +}; + +enum Phases +{ + PHASE_ONE = 1, + PHASE_TWO = 2, + PHASE_OUTRO = 3 +}; + +enum AreaTriggers +{ + AT_JUMP_YSERA_TO_KALECGOS = 7114, + AT_JUMP_KALECGOS_TO_YSERA = 7115, + AT_JUMP_YSERA_TO_NOZDORMU = 7113, + AT_JUMP_NOZDORMU_TO_YSERA = 7112, + AT_JUMP_NOZDORMU_TO_ALEXSTRASZA = 7111, + AT_JUMP_ALEXSTRASZA_TO_NOZDORMU = 7110, + + AT_LAND_NOZDORMU_TO_ALEXSTRASZA = 7315, + AT_LAND_ALEXSTRASZA_TO_NOZDORMU = 7316, + AT_LAND_YSERA_TO_NOZDORMU = 7317, + AT_LAND_NOZDORMU_TO_YSERA = 7318, + AT_LAND_KALECGOS_TO_YSERA = 7319, + AT_LAND_YSERA_TO_KALECGOS = 7320 +}; + +enum AnimKits +{ + // Deathwing + ANIM_KIT_EMERGE_DEATHWING = 1792, + + // Mutated Corruption + ANIM_KIT_EMERGE_MUTATED_CORRUPTION = 1703, + ANIM_KIT_CRUSH = 1711, + + // Tail Tentacle + ANIM_KIT_SUBMERGE = 1704 +}; + +enum SpellVisualKits +{ + // Limb Tentacles + SPELL_VISUAL_KIT_LIMB_EMERGE_1 = 22447, + SPELL_VISUAL_KIT_LIMB_EMERGE_2 = 22449, + SPELL_VISUAL_KIT_LIMB_EMERGE_3 = 22446 +}; + +enum EncounterFrames +{ + ENCOUNTER_FRAME_INDEX_DEATHWING = 1, + ENCOUNTER_FRAME_INDEX_MUTATED_CORRUPTION = 1, + ENCOUNTER_FRAME_INDEX_LIMB_TENTACLE = 2 +}; + +enum Gossips +{ + // Thrall + GOSSIP_MENU_START_ENCOUNTER = 13295 +}; + +enum Sounds +{ + // Deathwing + SOUND_ID_DRAGON_ROAR = 26348, + + // Thrall + MUSIC_ID_OUTRO = 26600 +}; + +enum Data +{ + // Deathwing + DATA_PLAYERS_ON_PLATFORM = 0, + DATA_ASSAULTED_ASPECT = 1, + DATA_CURRENT_LIMB = 2, + DATA_CURRENT_PLATFORM = 3, + DATA_NOZDORMU_AVAILABLE = 4, + + // Dragon Aspects + DATA_FOCUSED_LIMB = 0 +}; + +enum Seats +{ + // Deathwing + SEAT_ID_ELEMENTIUM_BOLT = 2, + + // Claw Mark + SEAT_ID_CLAW_MARK = 0 +}; + +enum MovePoints +{ + // Elementium Bolt + POINT_ID_ELEMENTIUM_BOLT_1 = 1, + POINT_ID_ELEMENTIUM_BOLT_2 = 2, + + // Dragon Aspects + POINT_ID_CONCENTRATION = 1 +}; + +enum PhaseGroups +{ + PHASE_GROUP_ENCOUNTER_1 = 374 +}; + +// Using own types to avoid order dependencies in header file +enum DragonAspectForLimb +{ + DRAGON_ASPECT_YSERA = 0, + DRAGON_ASPECT_KALECGOS = 1, + DRAGON_ASPECT_NOZDORMU = 2, + DRAGON_ASPECT_ALEXSTRASZA = 3, + MAX_DRAGON_ASPECTS +}; + +struct LimbTentacleInfo +{ + ObjectGuid TentacleGUID; + ObjectGuid PlatformGUID; + bool TentacleEngaged = false; + bool TentacleKilled = false; +}; + +typedef std::array LimbTentacleData; + +Position const DeathwingSummonPositon = { -11903.93f, 11989.14f, -113.204f, 2.164208f }; +Position const TailTentacleSummonPosition = { -11857.02f, 11795.57f, -73.95494f, 2.234021f }; +Position const ElementiumFragmentSummonPosition = { -12100.54f, 12173.62f, -2.734246f, 5.096362f }; +QuaternionData const ElementiumFragmentRotation = { 0.f, 0.f, -0.5591927f, 0.8290377f }; + +std::array LimbTentacleSummonPositions = +{ + Position(-12065.03f, 12127.18f, -3.294598f, 2.338741f), + Position(-12097.79f, 12067.37f, 13.48882f, 2.216568f), + Position(-12005.8f, 12190.35f, -6.593992f, 2.129302f), + Position(-11941.15f, 12248.89f, 12.14991f, 1.989675f) +}; + +std::array PlatformForAspectReferencePositions = +{ + Position(-12098.29f, 12160.51f), + Position(-12126.18f, 12076.84f), + Position(-12036.16f, 12220.41f), + Position(-11959.66f, 12271.25f) +}; + +std::array LimbTentacleEntryForDragonAspect = +{ + NPC_ARM_TENTACLE_1, + NPC_WING_TENTACLE, + NPC_ARM_TENTACLE_2, + NPC_WING_TENTACLE +}; + +static constexpr uint8 const MaxElemetiumBoltPathPoints = 2; +std::array ElementiumBoltPathYsera = +{ + Position(-12087.66f, 12152.32f, 2.34034f), + Position(-12103.51f, 12164.05f, 0.3335648f) +}; + +std::array ElementiumBoltPathNozdormu = +{ + Position(-12025.88f, 12206.73f, -0.640686f), + Position(-12035.51f, 12223.88f, -3.067535f) +}; + +std::array ElementiumBoltPathAlexstrasza = +{ + Position(-11956.88f, 12258.96f, 5.361959f), + Position(-11959.26f, 12278.64f, 4.414875f) +}; + +std::array ElementiumBoltPathKalecgos = +{ + Position(-12110.38f, 12074.37f, 6.96521f), + Position(-12138.4f, 12080.39f, 5.359306f) +}; + +Movement::PointsArray YseraPath = +{ + { -12108.63f, 12175.13f, 61.51709f }, + { -12091.56f, 12151.19f, 61.51709f }, + { -12088.4f, 12130.21f, 70.17785f } +}; + +Movement::PointsArray KalecgosPath = +{ + { -12089.22f, 12073.72f, 57.31396f }, + { -12042.77f, 12021.11f, 57.31396f }, + { -12059.66f, 11976.04f, 57.31396f } +}; + +Movement::PointsArray NozdormuPath = +{ + { -12035.02f, 12225.6f, 62.73143f }, + { -12021.92f, 12179.42f, 83.76831f } +}; + +Movement::PointsArray AlexstraszaPath = +{ + {-11958.91f, 12276.78f, 54.98875f }, + {-11911.33f, 12205.85f, 54.98875f }, + {-11865.57f, 12193.88f, 54.98875f } +}; + +struct boss_madness_of_deathwing : public BossAI +{ + boss_madness_of_deathwing(Creature* creature) : BossAI(creature, DATA_MADNESS_OF_DEATHWING), _firstAssault(true) + { + me->SetReactState(REACT_PASSIVE); + _playersAtAspects = { }; + } + + void JustAppeared() override + { + DoCastSelf(SPELL_ROOT); + DoZoneInCombat(); + } + + void JustEngagedWith(Unit* /*who*/) override + { + _JustEngagedWith(); + DoSummon(NPC_TAIL_TENTACLE, TailTentacleSummonPosition, 0, TEMPSUMMON_MANUAL_DESPAWN); + + Talk(SAY_AGGRO); + SetupLimbs(); + DoCastSelf(SPELL_SHARE_HEALTH_1); + me->PlayOneShotAnimKitId(ANIM_KIT_EMERGE_DEATHWING); + + events.SetPhase(PHASE_ONE); + events.ScheduleEvent(EVENT_ASSAULT_ASPECTS, 5s, 0, PHASE_ONE); + } + + void EnterEvadeMode(EvadeReason /*why*/) override + { + _EnterEvadeMode(); + + DespawnLimbs(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + + if (Creature* health = instance->GetCreature(DATA_DEATHWING_MADNESS_OF_DEATHWING)) + if (!health->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, health); + + if (Creature* thrall = instance->GetCreature(DATA_THRALL_MADNESS_OF_DEATHWING)) + thrall->DespawnOrUnsummon(0ms, 30s); + + for (ObjectGuid guid : _mutatedCorruptionGUIDs) + if (Creature* corruption = ObjectAccessor::GetCreature(*me, guid)) + if (corruption->IsAIEnabled) + corruption->AI()->EnterEvadeMode(); + + if (events.IsInPhase(PHASE_TWO)) + if (Creature* deathwing = GetPhaseTwoDeathwing()) + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, deathwing); + + for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; i++) + if (Creature* aspect = GetDragonAspect(i)) + aspect->DespawnOrUnsummon(0ms, 30s); + + summons.DespawnAll(); + _DespawnAtEvade(); + } + + void JustSummoned(Creature* summon) override + { + switch (summon->GetEntry()) + { + case NPC_ARM_TENTACLE_1: + case NPC_ARM_TENTACLE_2: + case NPC_WING_TENTACLE: + case NPC_DEATHWING_MADNESS_OF_DEATHWING: + break; + case NPC_MUTATED_CORRUPTION: + _mutatedCorruptionGUIDs.push_back(summon->GetGUID()); + break; + case NPC_TAIL_TENTACLE: + summon->PlayOneShotAnimKitId(ANIM_KIT_EMERGE_MUTATED_CORRUPTION); // no idea what blizz has fucked up here + summons.Summon(summon); + break; + case NPC_HEMORRHAGE_TARGET: + summon->CastSpell(summon, SPELL_HEMORRHAGE_PERIODIC); + summons.Summon(summon); + break; + case NPC_ELEMENTIUM_BOLT: + summon->EnterVehicle(me, SEAT_ID_ELEMENTIUM_BOLT); + summons.Summon(summon); + break; + default: + summons.Summon(summon); + break; + } + } + + void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override + { + switch (summon->GetEntry()) + { + case NPC_ARM_TENTACLE_1: + case NPC_ARM_TENTACLE_2: + case NPC_WING_TENTACLE: + LimbTentacleDied(summon); + break; + default: + break; + } + } + + void SetData(uint32 type, uint32 data) override + { + if (type >= DATA_PLAYERS_ON_PLATFORM && type < DATA_PLAYERS_ON_PLATFORM + MAX_DRAGON_ASPECTS) + { + uint8 dragonAspect = std::max(0, type - DATA_PLAYERS_ON_PLATFORM); + _playersAtAspects[dragonAspect] = data; + } + } + + uint32 GetData(uint32 type) const override + { + switch (type) + { + case DATA_ASSAULTED_ASPECT: + return _assaultedDragonAspect; + case DATA_NOZDORMU_AVAILABLE: + return uint8(!_limbData[DRAGON_ASPECT_NOZDORMU].TentacleKilled); + default: + return 0; + } + + return 0; + } + + ObjectGuid GetGUID(int32 type) const override + { + switch (type) + { + case DATA_CURRENT_LIMB: + return _limbData[_assaultedDragonAspect].TentacleGUID; + case DATA_CURRENT_PLATFORM: + return _limbData[_assaultedDragonAspect].PlatformGUID; + default: + return ObjectGuid::Empty; + } + + return ObjectGuid::Empty; + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) override + { + // Deathwing does not really die + if (damage >= me->GetHealth()) + damage = me->GetHealth() - 1; + + if (!events.IsInPhase(PHASE_OUTRO) && me->HealthBelowPctDamaged(1, damage)) + { + events.SetPhase(PHASE_OUTRO); + StartDeathSequence(); + } + } + + void DoAction(int32 action) override + { + switch (action) + { + case ACTION_ASSAULT_PLATFORM: + { + int8 preferedAspect = -1; + int8 lastCheckedPlatform = -1; + for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; ++i) + { + // Limb has been killed already. Skip Platform. + if (_limbData[i].TentacleKilled) + continue; + + if (preferedAspect == -1 || _playersAtAspects[i] > _playersAtAspects[lastCheckedPlatform]) + preferedAspect = i; + + lastCheckedPlatform = i; + } + + // This should never happen but just in case + if (preferedAspect == -1) + return; + + AssaultAspect(preferedAspect); + break; + } + case ACTION_LIMB_TENTACLE_DAMAGED: + if (!_limbData[DRAGON_ASPECT_ALEXSTRASZA].TentacleKilled) + if (Creature* alexstrasza = GetDragonAspect(DRAGON_ASPECT_ALEXSTRASZA)) + if (alexstrasza->IsAIEnabled) + alexstrasza->AI()->DoAction(ACTION_CAUTERIZE); + break; + case ACTION_DEATH: + me->PlayDirectSound(SOUND_ID_DRAGON_ROAR); + DoCastSelf(SPELL_DEATH); + events.ScheduleEvent(EVENT_DISENGAGE, 9s, 0, PHASE_OUTRO); + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) override + { + if (!events.IsInPhase(PHASE_OUTRO)) + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_ASSAULT_ASPECTS: + if (_firstAssault) + { + DoCastSelf(SPELL_SHARE_HEALTH_1); + DoCastAOE(SPELL_TRIGGER_ASPECT_BUFFS); + events.ScheduleEvent(EVENT_FACE_PLATFORM, 18s, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_SEND_ENCOUNTER_FRAME, 11s, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_CATACLYSM, 1min + 55s, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_HEMORRHAGE, 1min + 26s, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_ELEMENTIUM_BOLT, 41s, 0, PHASE_ONE); + _firstAssault = false; + } + else + { + events.ScheduleEvent(EVENT_FACE_PLATFORM, 14s, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_CATACLYSM, 2min + 13s, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_HEMORRHAGE, 1min + 43s, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_ELEMENTIUM_BOLT, 58s, 0, PHASE_ONE); + } + + DoCastAOE(SPELL_ASSAULT_ASPECTS); + Talk(SAY_ANNOUNCE_ASSAULT_ASPECTS); + break; + case EVENT_FACE_PLATFORM: + { + int32 facingSpellID = 0; + switch (_assaultedDragonAspect) + { + case DRAGON_ASPECT_YSERA: + facingSpellID = SPELL_FACE_MID_LEFT; + break; + case DRAGON_ASPECT_KALECGOS: + facingSpellID = SPELL_FACE_LEFT; + break; + case DRAGON_ASPECT_NOZDORMU: + facingSpellID = SPELL_FACE_MID_RIGHT; + break; + case DRAGON_ASPECT_ALEXSTRASZA: + facingSpellID = SPELL_FACE_RIGHT; + break; + default: + break; + } + + me->CastCustomSpell(SPELL_FACE_TRIGGER, SPELLVALUE_BASE_POINT0, facingSpellID); + + // Nozdormu creates a time zone at the same moment when Deathwing faces a platform + if (!_limbData[DRAGON_ASPECT_NOZDORMU].TentacleKilled) + if (Creature* nozdormu = GetDragonAspect(DRAGON_ASPECT_NOZDORMU)) + if (nozdormu->IsAIEnabled) + nozdormu->AI()->DoAction(ACTION_CREATE_TIME_ZONE); + break; + } + case EVENT_SEND_ENCOUNTER_FRAME: + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, ENCOUNTER_FRAME_INDEX_DEATHWING); + break; + case EVENT_SUMMON_TAIL: + DoCastSelf(SPELL_SUMMON_TAIL); + break; + case EVENT_CATACLYSM: + Talk(SAY_ANNOUNCE_CATACLYSM); + DoCastAOE(SPELL_CATACLYSM); + if (Creature* aspect = GetDragonAspect(_assaultedDragonAspect)) + if (aspect->IsAIEnabled) + aspect->AI()->DoAction(ACTION_CATACLYSM_IN_PROGRESS); + break; + case EVENT_HEMORRHAGE: + Talk(SAY_ANNOUNCE_HEMORRHAGE); + DoCastAOE(SPELL_HEMORRHAGE_SUMMON_TARGET); + events.ScheduleEvent(EVENT_REGENERATIVE_BLOOD, 2s + 500ms, 0, PHASE_ONE); + break; + case EVENT_REGENERATIVE_BLOOD: + DoCastSelf(SPELL_REGENERATIVE_BLOOD_PERIODIC); + break; + case EVENT_ELEMENTIUM_BOLT: + Talk(SAY_ANNOUNCE_ELEMENTIUM_BOLT); + Talk(SAY_ELEMENTIUM_BOLT); + DoCastSelf(SPELL_ELEMENTIUM_BOLT); + break; + case EVENT_SUMMON_ELEMENTIUM_TERROR: + if (Creature* deathwing = GetPhaseTwoDeathwing()) + deathwing->CastSpell(deathwing, SPELL_SUMMON_ELEMENTIUM_TERROR); + break; + case EVENT_SUMMON_ELEMENTIUM_FRAGMENTS: + if (Creature* deathwing = GetPhaseTwoDeathwing()) + deathwing->CastSpell(deathwing, SPELL_SUMMON_IMPALING_TENTACLE); + break; + case EVENT_PREPARE_TIME_ZONE: + DoCastSelf(SPELL_TIME_ZONE_PHASE_TWO); + if (Creature* nozdormu = GetDragonAspect(DRAGON_ASPECT_NOZDORMU)) + if (nozdormu->IsAIEnabled) + nozdormu->AI()->DoAction(ACTION_CAST_TIME_ZONE); + break; + case EVENT_DISENGAGE: + summons.DespawnAll(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + me->DespawnOrUnsummon(); + break; + default: + break; + } + } + } + +private: + bool _firstAssault; + uint8 _assaultedDragonAspect; + LimbTentacleData _limbData; + std::array _playersAtAspects; + GuidVector _mutatedCorruptionGUIDs; + + void SetupLimbs() + { + for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; ++i) + { + if (Creature* limb = DoSummon(LimbTentacleEntryForDragonAspect[i], LimbTentacleSummonPositions[i], 0, TEMPSUMMON_MANUAL_DESPAWN)) + { + _limbData[i].TentacleGUID = limb->GetGUID(); + + if (Creature* platform = limb->FindNearestCreature(NPC_PLATFORM, 55.f)) + _limbData[i].PlatformGUID = platform->GetGUID(); + } + } + } + + void DespawnLimbs() + { + for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; ++i) + { + if (Creature* limb = ObjectAccessor::GetCreature(*me, _limbData[i].TentacleGUID)) + { + if (_limbData[i].TentacleEngaged) + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, limb); + + limb->DespawnOrUnsummon(); + } + } + } + + Creature* GetDragonAspect(uint8 aspectId) + { + uint32 type = 0; + switch (aspectId) + { + case DRAGON_ASPECT_YSERA: + type = DATA_YSERA_MADNESS_OF_DEATHWING; + break; + case DRAGON_ASPECT_KALECGOS: + type = DATA_KALECGOS_MADNESS_OF_DEATHWING; + break; + case DRAGON_ASPECT_NOZDORMU: + type = DATA_NOZDORMU_MADNESS_OF_DEATHWING; + break; + case DRAGON_ASPECT_ALEXSTRASZA: + type = DATA_ALEXSTRASZA_MADNESS_OF_DEATHWING; + break; + default: + break; + } + + return instance->GetCreature(type); + } + + Creature* GetPhaseTwoDeathwing() + { + return instance->GetCreature(DATA_DEATHWING_MADNESS_OF_DEATHWING); + } + + void AssaultAspect(uint8 aspectId) + { + uint8 announcementTextID = 0; + switch (aspectId) + { + case DRAGON_ASPECT_YSERA: + announcementTextID = SAY_ANNOUNCE_ASSAULT_YSERA; + break; + case DRAGON_ASPECT_KALECGOS: + announcementTextID = SAY_ANNOUNCE_ASSAULT_KALECGOS; + break; + case DRAGON_ASPECT_NOZDORMU: + announcementTextID = SAY_ANNOUNCE_ASSAULT_NOZDORMU; + break; + case DRAGON_ASPECT_ALEXSTRASZA: + announcementTextID = SAY_ANNOUNCE_ASSAULT_ALEXSTRASZA; + break; + default: + break; + } + + _assaultedDragonAspect = aspectId; + Talk(announcementTextID); + + if (Creature* aspect = GetDragonAspect(aspectId)) + if (aspect->IsAIEnabled) + aspect->AI()->DoAction(ACTION_ASSAULTED); + + if (Creature* limb = ObjectAccessor::GetCreature(*me, _limbData[aspectId].TentacleGUID)) + { + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, limb, ENCOUNTER_FRAME_INDEX_LIMB_TENTACLE); + _limbData[aspectId].TentacleEngaged = true; + } + + events.ScheduleEvent(EVENT_SUMMON_TAIL, 500ms); + } + + void LimbTentacleDied(Creature* limb) + { + for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; ++i) + { + if (limb->GetGUID() != _limbData[i].TentacleGUID) + continue; + + // Mark tentacle as defeated + _limbData[i].TentacleKilled = true; + + // Send disengage encounter frame packet in case it has been engaged before it got killed + bool engaged = _limbData[i].TentacleEngaged; + InstanceScript* ins = instance; + limb->m_Events.AddEventAtOffset([limb, engaged, ins]() + { + if (engaged) + ins->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, limb); + + limb->DespawnOrUnsummon(); + }, 3s + 600ms); + + // Despawn time zones + summons.DespawnEntry(NPC_TIME_ZONE); + + // Clean up auras + for (uint32 spellId : { SPELL_FACE_LEFT, SPELL_FACE_MID_LEFT, SPELL_FACE_MID_RIGHT, SPELL_FACE_RIGHT, SPELL_REGENERATIVE_BLOOD_PERIODIC }) + me->RemoveAurasDueToSpell(spellId); + + // Cancel pending events + events.CancelEvent(EVENT_CATACLYSM); + events.CancelEvent(EVENT_HEMORRHAGE); + events.CancelEvent(EVENT_ELEMENTIUM_BOLT); + events.CancelEvent(EVENT_FACE_PLATFORM); + + // Prepare our next assault + events.ScheduleEvent(EVENT_ASSAULT_ASPECTS, 6s + 500ms, 0, PHASE_ONE); + + // Clean up our summon list to reduce performance impact + summons.RemoveNotExisting(); + } + + uint8 destroyedLimbs = 0; + for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; ++i) + if (_limbData[i].TentacleKilled) + ++destroyedLimbs; + + if (destroyedLimbs >= 4) + { + summons.DespawnEntry(NPC_COSMETIC_TENTACLE); + me->RemoveAurasDueToSpell(SPELL_AGONIZING_PAIN); + DoCastSelf(SPELL_SLUMP); + DoCastAOE(SPELL_TRIGGER_ASPECT_BUFFS); + Talk(SAY_SLUMP); + Talk(SAY_ANNOUNCE_SLUMP); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (Creature* deathwing = GetPhaseTwoDeathwing()) + { + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, deathwing, ENCOUNTER_FRAME_INDEX_DEATHWING); + deathwing->ResetPlayerDamageReq(); + deathwing->CastSpell(deathwing, SPELL_CORRUPTED_BLOOD_STACKER); + deathwing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + uint8 aspectID = urand(DRAGON_ASPECT_YSERA, DRAGON_ASPECT_ALEXSTRASZA); + if (Creature* aspect = GetDragonAspect(aspectID)) + if (aspect->IsAIEnabled) + aspect->AI()->DoAction(ACTION_TALK_PHASE_TWO); + + if (Creature* thrall = instance->GetCreature(DATA_THRALL_MADNESS_OF_DEATHWING)) + if (thrall->IsAIEnabled) + thrall->AI()->DoAction(ACTION_TALK_ASPECT_AID); + + events.SetPhase(PHASE_TWO); + events.ScheduleEvent(EVENT_SUMMON_ELEMENTIUM_FRAGMENTS, 11s, 0, PHASE_TWO); + events.ScheduleEvent(EVENT_PREPARE_TIME_ZONE, 26s, 0, PHASE_TWO); + events.ScheduleEvent(EVENT_SUMMON_ELEMENTIUM_TERROR, 36s, 0, PHASE_TWO); + } + } + + void StartDeathSequence() + { + if (Creature* tail = instance->GetCreature(DATA_TAIL_TENTACLE_MADNESS_OF_DEATHWING)) + tail->PlayOneShotAnimKitId(ANIM_KIT_SUBMERGE); + + summons.DespawnEntry(NPC_ELEMENTIUM_FRAGMENT); + summons.DespawnEntry(NPC_ELEMENTIUM_TERROR); + summons.DespawnEntry(NPC_TIME_ZONE); + summons.DespawnEntry(NPC_TAIL_TENTACLE); + + me->RemoveAurasDueToSpell(SPELL_SHRAPNEL_PERIODIC); + me->PlayDirectSound(SOUND_ID_DRAGON_ROAR); + DoCastSelf(SPELL_SLUMP_OUTRO); + + instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DEATHWING_KILL_CREDIT, 0, me); + instance->instance->PermBindAllPlayers(); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TETANUS); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_DEGENERATIVE_BITE); + + if (Creature* thrall = instance->GetCreature(DATA_THRALL_MADNESS_OF_DEATHWING)) + if (thrall->IsAIEnabled) + thrall->AI()->DoAction(ACTION_FIRE_DRAGON_SOUL); + + Player* recipient = nullptr; + if (Creature* deathwing = GetPhaseTwoDeathwing()) + { + recipient = deathwing->GetLootRecipient(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, deathwing); + deathwing->DespawnOrUnsummon(); + } + + if (recipient) + { + recipient->RewardPlayerAndGroupAtKill(me, false); + + uint32 gameobjectId = 0; + switch (GetDifficulty()) + { + case RAID_DIFFICULTY_10MAN_NORMAL: + gameobjectId = GO_ELEMENTIUM_FRAGMENT_10_NORMAL; + break; + case RAID_DIFFICULTY_25MAN_NORMAL: + gameobjectId = GO_ELEMENTIUM_FRAGMENT_25_NORMAL; + if (recipient->GetGroup() && recipient->GetGroup()->isLFRGroup()) + gameobjectId = GO_ELEMENTIUM_FRAGMENT_25_LFR; + break; + case RAID_DIFFICULTY_10MAN_HEROIC: + gameobjectId = GO_ELEMENTIUM_FRAGMENT_10_HEROIC; + break; + case RAID_DIFFICULTY_25MAN_HEROIC: + gameobjectId = GO_ELEMENTIUM_FRAGMENT_25_HEROIC; + break; + default: + break; + } + + if (gameobjectId) + if (GameObject* fragment = me->SummonGameObject(gameobjectId, ElementiumFragmentSummonPosition, ElementiumFragmentRotation, WEEK, GO_SUMMON_TIMED_DESPAWN)) + PhasingHandler::AddPhaseGroup(fragment, PHASE_GROUP_ENCOUNTER_1, false); + } + + instance->SetBossState(DATA_DEATHWING_MADNESS_OF_DEATHWING, DONE); + } +}; + +struct npc_madness_of_deathwing_limb_tentacle : public NullCreatureAI +{ + npc_madness_of_deathwing_limb_tentacle(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript()), _summons(me), + _bleeding(false), _blisteringTentacleCount(0) { } + + void JustAppeared() override + { + DoCastSelf(SPELL_LIMB_EMERGE_VISUAL); + } + + void JustDied(Unit* /*killer*/) override + { + DoCastSelf(SPELL_AGONIZING_PAIN); + DoCastAOE(SPELL_TRIGGER_CONCENTRATION); + _summons.DespawnAll(); + } + + void JustSummoned(Creature* summon) override + { + switch (summon->GetEntry()) + { + case NPC_BLISTERING_TENTACLE: + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + deathwing->AI()->JustSummoned(summon); + + summon->CastSpell(me, VEHICLE_SPELL_RIDE_HARDCODED); + summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); + _summons.Summon(summon); + break; + default: + break; + } + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) override + { + // Oneshot cases + if (damage >= me->GetHealth()) + return; + + if (!_bleeding && me->HealthBelowPctDamaged(90, damage)) + { + DoCastSelf(SPELL_BURNING_BLOOD); + _bleeding = true; + } + + uint8 healthPct = 75; + if (_blisteringTentacleCount == 1) + healthPct = 50; + else if (_blisteringTentacleCount == 2) + healthPct = 25; + + if (me->HealthBelowPctDamaged(healthPct, damage) && _blisteringTentacleCount < 3) + { + DoCastSelf(SPELL_SPAWN_BLISTERING_TENTACLES); + Talk(SAY_ANNOUNCE_BLISTERING_TENTACLES, me); + ++_blisteringTentacleCount; + + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + deathwing->AI()->DoAction(ACTION_LIMB_TENTACLE_DAMAGED); + } + } + +private: + InstanceScript* _instance; + SummonList _summons; + bool _bleeding; + uint8 _blisteringTentacleCount; +}; + +struct npc_madness_of_deathwing_mutated_corruption : public ScriptedAI +{ + npc_madness_of_deathwing_mutated_corruption(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript()) + { + me->SetReactState(REACT_PASSIVE); + } + + void InitializeAI() override + { + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + deathwing->AI()->JustSummoned(me); + } + + void JustAppeared() override + { + me->PlayOneShotAnimKitId(ANIM_KIT_EMERGE_MUTATED_CORRUPTION); + _instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, ENCOUNTER_FRAME_INDEX_MUTATED_CORRUPTION); + + me->m_Events.AddEventAtOffset([this]() + { + if (Player* player = me->SelectNearestPlayer(50.f)) + AttackStart(player); + me->SetReactState(REACT_AGGRESSIVE); + }, 800ms); + + _events.ScheduleEvent(EVENT_CRUSH_TARGETING, 5s); + _events.ScheduleEvent(EVENT_IMPALE, 10s + 500ms); + } + + void EnterEvadeMode(EvadeReason /*why*/) override + { + _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + me->DespawnOrUnsummon(); + } + + void JustDied(Unit* /*killer*/) override + { + _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + me->DespawnOrUnsummon(2s); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CRUSH_TARGETING: + DoCastAOE(SPELL_CRUSH_TARGETING); + _events.ScheduleEvent(EVENT_CRUSH, 500ms); + _events.Repeat(14s); + break; + case EVENT_CRUSH: + if (Creature* crush = me->FindNearestCreature(NPC_CRUSH_TARGET, 50.f)) + { + me->SetFacingToObject(crush, true); + me->PlayOneShotAnimKitId(ANIM_KIT_CRUSH); + DoCastSelf(SPELL_CRUSH); + } + break; + case EVENT_IMPALE: + DoCastVictim(SPELL_IMPALE); + _events.Repeat(36s); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + +private: + InstanceScript* _instance; + EventMap _events; +}; + +struct npc_madness_of_deathwing_regenerative_blood : public ScriptedAI +{ + npc_madness_of_deathwing_regenerative_blood(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript()) { } + + void InitializeAI() override + { + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + deathwing->AI()->JustSummoned(me); + } + + void JustDied(Unit* /*killer*/) override + { + me->DespawnOrUnsummon(4s); + } + + void JustAppeared() override + { + if (Player* player = me->SelectNearestPlayer(50.f)) + AttackStart(player); + } + +private: + InstanceScript* _instance; +}; + +struct npc_madness_of_deathwing_elementium_bolt : public NullCreatureAI +{ + npc_madness_of_deathwing_elementium_bolt(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript()) + { + _elementiumBoltPoints = { }; + } + + void JustDied(Unit* /*killer*/) override + { + DoCastSelf(SPELL_ELEMENTIUM_METEOR_TRANSFORM_DEATH); + me->DespawnOrUnsummon(2s); + } + + void DoAction(int32 action) override + { + switch (action) + { + case ACTION_LAUNCH_ELEMENTIUM_BOLT: + { + uint8 assaultedAspect = 0; + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + assaultedAspect = deathwing->AI()->GetData(DATA_ASSAULTED_ASPECT); + + switch (assaultedAspect) + { + case DRAGON_ASPECT_YSERA: + _elementiumBoltPoints = ElementiumBoltPathYsera; + break; + case DRAGON_ASPECT_KALECGOS: + _elementiumBoltPoints = ElementiumBoltPathKalecgos; + break; + case DRAGON_ASPECT_NOZDORMU: + _elementiumBoltPoints = ElementiumBoltPathNozdormu; + break; + case DRAGON_ASPECT_ALEXSTRASZA: + _elementiumBoltPoints = ElementiumBoltPathAlexstrasza; + break; + default: + break; + } + + _events.ScheduleEvent(EVENT_LAUNCH_ELEMENTIUM_BOLT, 400ms); + break; + } + default: + break; + } + } + + void JustSummoned(Creature* summon) override + { + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + deathwing->AI()->JustSummoned(summon); + + me->EnterVehicle(summon, SEAT_ID_CLAW_MARK); + } + + void MovementInform(uint32 type, uint32 pointId) override + { + if (type != EFFECT_MOTION_TYPE) + return; + + switch (pointId) + { + case POINT_ID_ELEMENTIUM_BOLT_1: + MoveToPosition(POINT_ID_ELEMENTIUM_BOLT_2, _elementiumBoltPoints[1], true); + break; + case POINT_ID_ELEMENTIUM_BOLT_2: + _events.ScheduleEvent(EVENT_ELEMENTUIM_BLAST, 1s); + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_LAUNCH_ELEMENTIUM_BOLT: + DoCastSelf(SPELL_ELEMENTIUM_METEOR_VISUAL); + + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + { + if (deathwing->AI()->GetData(DATA_NOZDORMU_AVAILABLE)) + MoveToPosition(POINT_ID_ELEMENTIUM_BOLT_1, _elementiumBoltPoints[0]); + else + MoveToPosition(POINT_ID_ELEMENTIUM_BOLT_2, _elementiumBoltPoints[1]); + } + break; + case EVENT_ELEMENTUIM_BLAST: + // DoCast helpers block casts because if the casting state but we have to keep the cast intact + me->CastSpell(me, SPELL_ELEMENTIUM_BLAST); + me->CastSpell(me, SPELL_ELEMENTIUM_BLAST_PERIODIC); + me->CastSpell(me, SPELL_ELEMENTIUM_METEOR_TRANSFORM); + break; + default: + break; + } + } + } + +private: + InstanceScript* _instance; + EventMap _events; + std::array _elementiumBoltPoints; + + void MoveToPosition(uint32 pointId, Position const position, bool timeZoneAvailable = false) + { + Movement::MoveSplineInit init(me); + init.MoveTo(position.GetPositionX(), position.GetPositionY(), position.GetPositionZ(), false); + init.SetFly(); + if (timeZoneAvailable) + init.SetVelocity(2.5f); + + me->GetMotionMaster()->LaunchMoveSpline(std::move(init), pointId); + } +}; + +struct npc_madness_of_deathwing_thrall : public ScriptedAI +{ + npc_madness_of_deathwing_thrall(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript()) { } + + void Reset() override + { + _instance->SetBossState(DATA_MADNESS_OF_DEATHWING, NOT_STARTED); + } + + bool GossipSelect(Player* /*player*/, uint32 menuId, uint32 /*optionIndex*/) override + { + if (_instance->GetBossState(DATA_MADNESS_OF_DEATHWING) == IN_PROGRESS) + return false; + + if (menuId == GOSSIP_MENU_START_ENCOUNTER) + { + DoCastSelf(SPELL_ASTRAL_RECALL); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + DoSummon(BOSS_MADNESS_OF_DEATHWING, DeathwingSummonPositon, 0, TEMPSUMMON_MANUAL_DESPAWN); + _events.ScheduleEvent(EVENT_FACE_TOWARDS_DEATHWING, 3s); + } + + return true; + } + + void DoAction(int32 action) override + { + switch (action) + { + case ACTION_TALK_ASPECT_AID: + _events.ScheduleEvent(EVENT_TALK_AID_CHAMPIONS, 31s); + break; + case ACTION_FIRE_DRAGON_SOUL: + _events.Reset(); + me->SendMovementSetSplineAnim(Movement::AnimType::FlyToGround); + me->SetDisableGravity(true); + me->SendSetPlayHoverAnim(true); + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + DoCastAOE(SPELL_FIRE_DRAGON_SOUL_ASPECTS); + DoCastAOE(SPELL_TRIGGER_ASPECT_YELL); + DoCastSelf(SPELL_ASTRAL_RECALL_OUTRO); + _events.ScheduleEvent(EVENT_FIRE_DRAGON_SOUL, 2s + 600ms); + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FACE_TOWARDS_DEATHWING: + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + me->SetFacingToObject(deathwing); + break; + case EVENT_TALK_AID_CHAMPIONS: + Talk(SAY_AID_CHAMPIONS); + break; + case EVENT_FIRE_DRAGON_SOUL: + DoCastSelf(SPELL_FIRE_DRAGON_SOUL); + me->PlayDirectMusic(MUSIC_ID_OUTRO); + _events.ScheduleEvent(EVENT_PLAY_MOVIE, 31s); + break; + case EVENT_PLAY_MOVIE: + DoCastAOE(SPELL_PLAY_MOVIE); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SendMovementSetSplineAnim(Movement::AnimType::ToGround); + me->SendSetPlayHoverAnim(false); + me->SetDisableGravity(false); + + if (Creature* ysera = _instance->GetCreature(DATA_YSERA_MADNESS_OF_DEATHWING)) + ysera->DespawnOrUnsummon(); + + if (Creature* kalecgos = _instance->GetCreature(DATA_KALECGOS_MADNESS_OF_DEATHWING)) + kalecgos->DespawnOrUnsummon(); + + if (Creature* nozdormu = _instance->GetCreature(DATA_NOZDORMU_MADNESS_OF_DEATHWING)) + nozdormu->DespawnOrUnsummon(); + + if (Creature* alexstrasza = _instance->GetCreature(DATA_ALEXSTRASZA_MADNESS_OF_DEATHWING)) + alexstrasza->DespawnOrUnsummon(); + + _instance->DoCastSpellOnPlayers(SPELL_CALM_MAELSTROM_SKYBOX); + me->DespawnOrUnsummon(100ms); + break; + default: + break; + } + } + } + +private: + InstanceScript* _instance; + EventMap _events; +}; + +struct npc_madness_of_deathwing_dragon_aspect : public NullCreatureAI +{ + npc_madness_of_deathwing_dragon_aspect(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript()), _summons(me) { } + + void DoAction(int32 action) override + { + switch (action) + { + case ACTION_ASSAULTED: + Talk(SAY_INTRODUCE_ABILITY); + break; + case ACTION_LIMB_KILLED: + _events.Reset(); + me->InterruptNonMeleeSpells(true); + ConcentrateOnLimb(); + break; + case ACTION_CATACLYSM_IN_PROGRESS: + Talk(SAY_CATACLYSM); + break; + case ACTION_CREATE_TIME_ZONE: + DoCastSelf(SPELL_TIME_ZONE); + _events.ScheduleEvent(EVENT_TIME_ZONE, 700ms); + break; + case ACTION_CAUTERIZE: + // We're going to use a event here in case of multiple cauterize calls within a short time window + _events.ScheduleEvent(EVENT_CAUTERIZE, 1ms); + break; + case ACTION_TALK_PHASE_TWO: + _events.ScheduleEvent(EVENT_TALK_PHASE_TWO, 16s); + break; + case ACTION_TALK_CHARGE_DRAGON_SOUL: + Talk(SAY_CHARGE_DRAGON_SOUL); + break; + case ACTION_CAST_TIME_ZONE: + _events.ScheduleEvent(EVENT_TIME_ZONE_PHASE_TWO, 200ms); + break; + default: + break; + } + } + + void JustSummoned(Creature* summon) override + { + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + deathwing->AI()->JustSummoned(summon); + } + + void MovementInform(uint32 type, uint32 pointId) override + { + if (type != EFFECT_MOTION_TYPE) + return; + + switch (pointId) + { + case POINT_ID_CONCENTRATION: + if (Creature* limb = ObjectAccessor::GetCreature(*me, _focusedLimbGUID)) + me->SetFacingToObject(limb); + break; + default: + break; + } + } + + void SetGUID(ObjectGuid const& guid, int32 type) override + { + switch (type) + { + case DATA_FOCUSED_LIMB: + _focusedLimbGUID = guid; + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_TIME_ZONE: + if (Creature* target = me->FindNearestCreature(NPC_TIME_ZONE_TARGET, 300.f)) + DoCast(target, SPELL_TIME_ZONE_MISSILE); + break; + case EVENT_CAUTERIZE: + DoCastSelf(SPELL_CAUTERIZE); + break; + case EVENT_TALK_PHASE_TWO: + Talk(SAY_PHASE_TWO); + break; + case EVENT_TIME_ZONE_PHASE_TWO: + if (Creature* target = me->FindNearestCreature(NPC_TIME_ZONE_TARGET, 300.f)) + DoCast(target, SPELL_TIME_ZONE_MISSILE_PHASE_TWO); + break; + default: + break; + } + } + } + +private: + InstanceScript* _instance; + EventMap _events; + SummonList _summons; + ObjectGuid _focusedLimbGUID; + + void ConcentrateOnLimb() + { + uint32 concentrationSpellID = 0; + Movement::PointsArray path; + + switch (me->GetEntry()) + { + case NPC_YSERA_MADNESS_OF_DEATHWING: + me->RemoveAurasDueToSpell(SPELL_YSERAS_PRESENCE); + me->RemoveAurasDueToSpell(SPELL_THE_DREAMER); + concentrationSpellID = SPELL_CONCENTRATION_YSERA; + path = YseraPath; + break; + case NPC_KALECGOS_MADNESS_OF_DEATHWING: + me->RemoveAurasDueToSpell(SPELL_KALECGOS_PRESENCE); + me->RemoveAurasDueToSpell(SPELL_SPELLWEAVER); + concentrationSpellID = SPELL_CONCENTRATION_KALECGOS; + path = KalecgosPath; + break; + case NPC_NOZDORMU_MADNESS_OF_DEATHWING: + me->RemoveAurasDueToSpell(SPELL_NOZDORMUS_PRESENCE); + concentrationSpellID = SPELL_CONCENTRATION_NOZDORMU; + path = NozdormuPath; + break; + case NPC_ALEXSTRASZA_MADNESS_OF_DEATHWING: + me->RemoveAurasDueToSpell(SPELL_ALEXSTRASZAS_PRESENCE); + concentrationSpellID = SPELL_CONCENTRATION_ALEXSTRASZA; + path = AlexstraszaPath; + break; + default: + break; + } + + DoCastSelf(concentrationSpellID); + path.insert(path.begin(), G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + + Movement::MoveSplineInit init(me); + init.MovebyPath(path); + init.SetFly(); + init.SetSmooth(); + init.SetUncompressed(); + me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_ID_CONCENTRATION); + } +}; + +struct npc_madness_of_deathwing_cosmetic_limb : public NullCreatureAI +{ + npc_madness_of_deathwing_cosmetic_limb(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript()) { } + + void JustSummoned(Creature* summon) override + { + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + deathwing->AI()->JustSummoned(summon); + + summon->CastSpell(me, VEHICLE_SPELL_RIDE_HARDCODED); + } + +private: + InstanceScript* _instance; +}; + +struct npc_mandess_of_deathwing_elementium_fragment : public ScriptedAI +{ + npc_mandess_of_deathwing_elementium_fragment(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript()) + { + me->SetReactState(REACT_PASSIVE); + } + + void JustAppeared() override + { + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + { + deathwing->AI()->JustSummoned(me); + deathwing->CastSpell(deathwing, SPELL_SHRAPNEL_PERIODIC); + } + + me->m_Events.AddEventAtOffset([this]() + { + me->SetReactState(REACT_AGGRESSIVE); + }, 2s); + } + + void JustDied(Unit* /*killer*/) override + { + me->DespawnOrUnsummon(6s); + } + + void UpdateAI(uint32 /*diff*/) override + { + UpdateVictim(); + } + +private: + InstanceScript* _instance; +}; + +struct npc_mandess_of_deathwing_elementium_terror: public ScriptedAI +{ + npc_mandess_of_deathwing_elementium_terror(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript()) { } + + void JustAppeared() override + { + if (Creature* deathwing = _instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + deathwing->AI()->JustSummoned(me); + + if (Player* player = me->SelectNearestPlayer(50.f)) + AttackStart(player); + } + + void JustDied(Unit* /*killer*/) override + { + me->DespawnOrUnsummon(3s + 200ms); + } + +private: + InstanceScript* _instance; +}; + +class spell_madness_of_deathwing_presence_of_the_aspects : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_presence_of_the_aspects); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + targets.remove_if([](WorldObject* target)->bool + { + if (target->IsPlayer()) + return false; + + if (target->IsCreature()) + if (TempSummon* summon = target->ToUnit()->ToTempSummon()) + return !summon->GetOwnerGUID().IsPlayer(); + + return true; + }); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_presence_of_the_aspects::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); + } +}; + +class spell_madness_of_deathwing_carrying_winds_jump : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_carrying_winds_jump); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_carrying_winds_jump::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_carrying_winds_triggered : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_carrying_winds_triggered); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + printf("spellId to remove : %i \n", GetEffectValue()); + GetHitUnit()->RemoveAurasDueToSpell(GetEffectValue()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_carrying_winds_triggered::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_limb_emerge_visual : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_limb_emerge_visual); + + void HandleDummyEffect(SpellEffIndex /*effIndex*/) + { + uint32 visualKitId = RAND(SPELL_VISUAL_KIT_LIMB_EMERGE_1, SPELL_VISUAL_KIT_LIMB_EMERGE_2, SPELL_VISUAL_KIT_LIMB_EMERGE_3); + GetHitUnit()->SendPlaySpellVisualKit(visualKitId, 0, 0); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_limb_emerge_visual::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +class spell_madness_of_deathwing_agonizing_pain : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_agonizing_pain); + + void HandleDamage(SpellEffIndex /*effIndex*/) + { + Unit* target = GetHitUnit(); + int32 damage = CalculatePct(target->GetMaxHealth(), GetEffectValue()); + if (!target->HealthBelowPctDamaged(25, damage)) + target->PlayDirectSound(SOUND_ID_DRAGON_ROAR); + + SetHitDamage(damage); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_agonizing_pain::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } +}; + +class spell_madness_of_deathwing_assault_aspects : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_assault_aspects); + + void CountPlayers(std::list& targets) + { + std::array playersOnPlatform = { }; + + // First we count our players + for (WorldObject const* target : targets) + { + float closestDistance = 100.f; + uint8 platform = 0; + for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; ++i) + { + float dist = target->GetExactDist2d(PlatformForAspectReferencePositions[i]); + if (dist <= closestDistance) + { + closestDistance = dist; + platform = i; + } + } + + ++playersOnPlatform[platform]; + } + + // All players count, inform Deathwing about the numbers + if (Creature* caster = GetCaster()->ToCreature()) + { + if (!caster->IsAIEnabled) + return; + + for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; ++i) + caster->AI()->SetData(DATA_PLAYERS_ON_PLATFORM + i, playersOnPlatform[i]); + } + } + + void NotifyDeathwing() + { + if (Creature* caster = GetCaster()->ToCreature()) + if (caster->IsAIEnabled) + caster->AI()->DoAction(ACTION_ASSAULT_PLATFORM); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_assault_aspects::CountPlayers, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + AfterCast += SpellCastFn(spell_madness_of_deathwing_assault_aspects::NotifyDeathwing); + } +}; + +class spell_madness_of_deathwing_face_trigger : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_face_trigger); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_face_trigger::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_summon_tail : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_summon_tail); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + if (Creature* caster = GetCaster()->ToCreature()) + { + if (!caster->IsAIEnabled) + return; + + InstanceScript* instance = caster->GetInstanceScript(); + if (!instance) + return; + + uint32 aspectId = caster->AI()->GetData(DATA_ASSAULTED_ASPECT); + + targets.remove_if([aspectId](WorldObject const* target)->bool + { + return target->GetExactDist2d(PlatformForAspectReferencePositions[aspectId]) >= 50.f; + }); + } + + if (targets.size() > 1) + Trinity::Containers::RandomResize(targets, 1); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_summon_tail::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } +}; + +class spell_madness_of_deathwing_crush : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_crush); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + if (Creature* caster = GetCaster()->ToCreature()) + { + InstanceScript* instance = caster->GetInstanceScript(); + if (!instance) + return; + + if (Creature* deathwing = instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + { + uint32 aspectId = deathwing->AI()->GetData(DATA_ASSAULTED_ASPECT); + targets.remove_if([aspectId](WorldObject const* target)->bool + { + return target->GetExactDist2d(PlatformForAspectReferencePositions[aspectId]) >= 50.f; + }); + } + } + + if (targets.size() > 1) + Trinity::Containers::RandomResize(targets, 1); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_crush::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } +}; + +class spell_madness_of_deathwing_hemorrhage : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_hemorrhage); + + void SetDest(SpellDestination& dest) + { + if (Creature* caster = GetCaster()->ToCreature()) + if (caster->IsAIEnabled) + if (Creature* platform = ObjectAccessor::GetCreature(*caster, caster->AI()->GetGUID(DATA_CURRENT_PLATFORM))) + dest.Relocate(platform->GetPosition()); + } + + void Register() override + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_madness_of_deathwing_hemorrhage::SetDest, EFFECT_0, TARGET_DEST_NEARBY_ENTRY); + } +}; + +class spell_madness_of_deathwing_hemorrhage_script : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_hemorrhage_script); + + void SetTarget(WorldObject*& target) + { + InstanceScript* instance = GetCaster()->GetInstanceScript(); + if (!instance) + return; + + if (Creature* deathwing = instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + if (Creature* limb = ObjectAccessor::GetCreature(*GetCaster(), deathwing->AI()->GetGUID(DATA_CURRENT_LIMB))) + target = limb; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetCaster()) + GetHitUnit()->CastSpell(caster, GetEffectValue()); + } + + void Register() override + { + OnObjectTargetSelect += SpellObjectTargetSelectFn(spell_madness_of_deathwing_hemorrhage_script::SetTarget, EFFECT_0, TARGET_UNIT_NEARBY_ENTRY); + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_hemorrhage_script::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_regenerative_blood_periodic : public AuraScript +{ + PrepareAuraScript(spell_madness_of_deathwing_regenerative_blood_periodic); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_REGENERATIVE_BLOOD_SCRIPT, + SPELL_REGENERATIVE_BLOOD_HEAL + }); + } + + void HandlePeriodic(AuraEffect const* aurEff) + { + Unit* target = GetTarget(); + + _basePoints++; + if (aurEff->GetTickNumber() == 11 || aurEff->GetTickNumber() == 20) + { + _basePoints -= 10; + target->CastSpell(target, SPELL_REGENERATIVE_BLOOD_HEAL); + } + + int32 bp = _basePoints * 10; + target->CastCustomSpell(SPELL_REGENERATIVE_BLOOD_SCRIPT, SPELLVALUE_BASE_POINT0, bp, target); + + if (aurEff->GetTickNumber() >= 20) + Remove(); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_madness_of_deathwing_regenerative_blood_periodic::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } +private: + int32 _basePoints = 0; +}; + +class spell_madness_of_deathwing_regenerative_blood_script : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_regenerative_blood_script); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->SetPower(POWER_ENERGY, GetEffectValue()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_regenerative_blood_script::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_elementium_meteor_script: public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_elementium_meteor_script); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Creature* target = GetHitCreature()) + { + target->ExitVehicle(); + if (target->IsAIEnabled) + target->AI()->DoAction(ACTION_LAUNCH_ELEMENTIUM_BOLT); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_elementium_meteor_script::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_elementium_meteor_visual : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_elementium_meteor_visual); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + Creature* caster = GetCaster()->ToCreature(); + if (!caster) + return; + + InstanceScript* instance = caster->GetInstanceScript(); + if (!instance) + return; + + if (Creature* deathwing = instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + { + ObjectGuid guid = deathwing->AI()->GetGUID(DATA_CURRENT_PLATFORM); + targets.remove_if([guid](WorldObject const* target)->bool + { + return target->GetGUID() != guid; + }); + } + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_elementium_meteor_visual::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } +}; + +class spell_madness_of_deathwing_burning_blood : public AuraScript +{ + PrepareAuraScript(spell_madness_of_deathwing_burning_blood); + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + Unit* target = GetTarget(); + float lostHealthPct = 100.f - target->GetHealthPct(); + + uint8 stackDiff = std::max(0, uint8(lostHealthPct) - GetStackAmount()); + if (stackDiff) + target->CastCustomSpell(GetSpellInfo()->Id, SPELLVALUE_AURA_STACK, stackDiff, target); + + uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, target); + int32 bp = sSpellMgr->AssertSpellInfo(spellId)->Effects[EFFECT_0].CalcValue() * GetStackAmount(); + target->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, bp, target, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_madness_of_deathwing_burning_blood::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + +class spell_madness_of_deathwing_spawn_blistering_tentacles : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_spawn_blistering_tentacles); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* target = GetHitUnit(); + if (Vehicle* vehicle = target->GetVehicleKit()) + for (uint8 i = 0; i < 6; i++) + if (vehicle->HasEmptySeat(i)) + target->CastSpell(target, GetEffectValue()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_spawn_blistering_tentacles::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_time_zone : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_time_zone); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + Creature* caster = GetCaster()->ToCreature(); + if (!caster) + return; + + InstanceScript* instance = caster->GetInstanceScript(); + if (!instance) + return; + + if (Creature* deathwing = instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + { + ObjectGuid guid = deathwing->AI()->GetGUID(DATA_CURRENT_PLATFORM); + targets.remove_if([guid](WorldObject const* target)->bool + { + return target->GetGUID() != guid; + }); + } + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_time_zone::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } +}; + +class spell_madness_of_deathwing_trigger_concentration : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_trigger_concentration); + + bool Load() override + { + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + { + if (Creature* deathwing = instance->GetCreature(DATA_MADNESS_OF_DEATHWING)) + { + uint8 aspectId = deathwing->AI()->GetData(DATA_ASSAULTED_ASPECT); + uint32 type = 0; + switch (aspectId) + { + case DRAGON_ASPECT_YSERA: + type = DATA_YSERA_MADNESS_OF_DEATHWING; + break; + case DRAGON_ASPECT_KALECGOS: + type = DATA_KALECGOS_MADNESS_OF_DEATHWING; + break; + case DRAGON_ASPECT_NOZDORMU: + type = DATA_NOZDORMU_MADNESS_OF_DEATHWING; + break; + case DRAGON_ASPECT_ALEXSTRASZA: + type = DATA_ALEXSTRASZA_MADNESS_OF_DEATHWING; + break; + default: + break; + } + + if (Creature const* aspect = instance->GetCreature(type)) + _aspectGUID = aspect->GetGUID(); + } + } + return true; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Creature* creature = GetHitCreature(); + if (!creature || creature->GetGUID() != _aspectGUID) + return; + + if (creature->IsAIEnabled) + creature->AI()->DoAction(ACTION_LIMB_KILLED); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_trigger_concentration::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +private: + ObjectGuid _aspectGUID; +}; + +class spell_madness_of_deathwing_concentration : public AuraScript +{ + PrepareAuraScript(spell_madness_of_deathwing_concentration); + + void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (Creature* creature = caster->ToCreature()) + if (creature->IsAIEnabled) + creature->AI()->SetGUID(GetTarget()->GetGUID(), DATA_FOCUSED_LIMB); + + GetTarget()->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + for (uint8 i = 0; i < 2; ++i) + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_COSMETIC_TENTACLE); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_madness_of_deathwing_concentration::AfterApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_madness_of_deathwing_concentration::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +class spell_madness_of_deathwing_trigger_aspect_buffs : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_trigger_aspect_buffs); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_YSERAS_PRESENCE, + SPELL_KALECGOS_PRESENCE, + SPELL_NOZDORMUS_PRESENCE, + SPELL_ALEXSTRASZAS_PRESENCE, + SPELL_THE_DREAMER, + SPELL_SPELLWEAVER + }); + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* target = GetHitUnit(); + uint32 presenceSpellID = 0; + + target->InterruptNonMeleeSpells(true); + switch (target->GetEntry()) + { + case NPC_YSERA_MADNESS_OF_DEATHWING: + presenceSpellID = SPELL_YSERAS_PRESENCE; + target->CastSpell(target, SPELL_THE_DREAMER); + break; + case NPC_KALECGOS_MADNESS_OF_DEATHWING: + presenceSpellID = SPELL_KALECGOS_PRESENCE; + target->CastSpell(target, SPELL_SPELLWEAVER); + break; + case NPC_NOZDORMU_MADNESS_OF_DEATHWING: + presenceSpellID = SPELL_NOZDORMUS_PRESENCE; + break; + case NPC_ALEXSTRASZA_MADNESS_OF_DEATHWING: + presenceSpellID = SPELL_ALEXSTRASZAS_PRESENCE; + break; + default: + break; + } + + if (presenceSpellID) + target->CastSpell(target, presenceSpellID); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_trigger_aspect_buffs::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_share_health : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_share_health); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SHARE_HEALTH_2 }); + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_SHARE_HEALTH_2); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_share_health::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_summon_elementium_terror : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_summon_elementium_terror); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + for (uint8 i = 0; i < 2; ++i) + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_summon_elementium_terror::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_summon_impaling_tentacle : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_summon_impaling_tentacle); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* target = GetHitUnit(); + uint8 summonCount = target->GetMap()->Is25ManRaid() ? 8 : 3; + for (uint8 i = 0; i < summonCount; ++i) + target->CastSpell(target, GetEffectValue()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_summon_impaling_tentacle::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_shrapnel : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_shrapnel); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SHRAPNEL }); + } + + void FilterFragments(std::list& targets) + { + for (WorldObject const* target : targets) + _fragmentGUIDs.push_back(target->GetGUID()); + } + + void FilterPlayers(std::list& targets) + { + targets.remove_if([](WorldObject const* target)->bool + { + return !target->IsPlayer(); + }); + + for (WorldObject const* target : targets) + _targetGUIDs.push_back(target->GetGUID()); + } + + void HandleShrapnels() + { + Unit* caster = GetCaster(); + if (!caster) + return; + + if (_targetGUIDs.size() > _fragmentGUIDs.size()) + Trinity::Containers::RandomResize(_targetGUIDs, _fragmentGUIDs.size()); + + for (uint8 i = 0; i < _targetGUIDs.size(); i++) + { + if (Unit* target = ObjectAccessor::GetUnit(*caster, _targetGUIDs[i])) + if (Creature* fragment = ObjectAccessor::GetCreature(*caster, _fragmentGUIDs[i])) + fragment->CastSpell(target, SPELL_SHRAPNEL); + } + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_shrapnel::FilterFragments, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_shrapnel::FilterPlayers, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + AfterCast += SpellCastFn(spell_madness_of_deathwing_shrapnel::HandleShrapnels); + } +private: + GuidVector _targetGUIDs; + GuidVector _fragmentGUIDs; +}; + +class spell_madness_of_deathwing_fire_dragon_soul: public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_fire_dragon_soul); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Creature* deathwing = GetHitCreature()) + if (deathwing->IsAIEnabled) + deathwing->AI()->DoAction(ACTION_DEATH); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_fire_dragon_soul::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_fire_dragon_soul_aspects : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_fire_dragon_soul_aspects); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_CONCENTRATION_YSERA_OUTRO, + SPELL_CONCENTRATION_KALECGOS_OUTRO, + SPELL_CONCENTRATION_NOZDORMU_OUTRO, + SPELL_CONCENTRATION_ALEXSTRASZA_OUTRO, + SPELL_YSERAS_PRESENCE, + SPELL_KALECGOS_PRESENCE, + SPELL_NOZDORMUS_PRESENCE, + SPELL_ALEXSTRASZAS_PRESENCE, + SPELL_THE_DREAMER, + SPELL_SPELLWEAVER + }); + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Creature* target = GetHitCreature(); + if (!target) + return; + + uint32 concentrationSpellID = 0; + switch (target->GetEntry()) + { + case NPC_YSERA_MADNESS_OF_DEATHWING: + concentrationSpellID = SPELL_CONCENTRATION_YSERA_OUTRO; + target->RemoveAurasDueToSpell(SPELL_YSERAS_PRESENCE); + target->RemoveAurasDueToSpell(SPELL_THE_DREAMER); + break; + case NPC_KALECGOS_MADNESS_OF_DEATHWING: + concentrationSpellID = SPELL_CONCENTRATION_KALECGOS_OUTRO; + target->RemoveAurasDueToSpell(SPELL_KALECGOS_PRESENCE); + target->RemoveAurasDueToSpell(SPELL_SPELLWEAVER); + break; + case NPC_NOZDORMU_MADNESS_OF_DEATHWING: + concentrationSpellID = SPELL_CONCENTRATION_NOZDORMU_OUTRO; + target->RemoveAurasDueToSpell(SPELL_NOZDORMUS_PRESENCE); + break; + case NPC_ALEXSTRASZA_MADNESS_OF_DEATHWING: + concentrationSpellID = SPELL_CONCENTRATION_ALEXSTRASZA_OUTRO; + target->RemoveAurasDueToSpell(SPELL_ALEXSTRASZAS_PRESENCE); + break; + default: + break; + } + + target->CastSpell(target, concentrationSpellID); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_fire_dragon_soul_aspects::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_trigger_aspect_yell : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_trigger_aspect_yell); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + Trinity::Containers::RandomResize(targets, 1); + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Creature* target = GetHitCreature(); + if (!target) + return; + + if (target->IsAIEnabled) + target->AI()->DoAction(ACTION_TALK_CHARGE_DRAGON_SOUL); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_trigger_aspect_yell::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_trigger_aspect_yell::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +class spell_madness_of_deathwing_corrupted_blood_stacker : public AuraScript +{ + PrepareAuraScript(spell_madness_of_deathwing_corrupted_blood_stacker); + + void HandlePeriodic(AuraEffect const* aurEff) + { + Unit* target = GetTarget(); + uint8 currentPower = target->GetPower(POWER_ALTERNATE_POWER); + uint8 targetPower = std::max(0, 20 - uint8(target->GetHealthPct())); + + // At 15, 10 and 5% health, Deathwing hemorrhages, doubling the current corruption + if ((targetPower >= 5 && _hemorrHageSteps == 0) || (targetPower >= 10 && _hemorrHageSteps == 1) || (targetPower >= 15 && _hemorrHageSteps == 2)) + { + target->SetPower(POWER_ALTERNATE_POWER, targetPower * 2); + ++_hemorrHageSteps; + return; + } + + if (!(aurEff->GetTickNumber() % 2)) + { + // Slowly ramp down to our actual power + if (currentPower > targetPower) + targetPower = currentPower - 1; + + target->SetPower(POWER_ALTERNATE_POWER, targetPower); + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_madness_of_deathwing_corrupted_blood_stacker::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } +private: + uint8 _hemorrHageSteps = 0; +}; + +class spell_madness_of_deathwing_corrupted_blood: public AuraScript +{ + PrepareAuraScript(spell_madness_of_deathwing_corrupted_blood); + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + if (AuraEffect* bonusEffect = GetEffect(EFFECT_1)) + { + uint8 stacks = GetTarget()->GetPower(POWER_ALTERNATE_POWER); + int32 amount = bonusEffect->GetBaseAmount() + (bonusEffect->GetBaseAmount() * stacks); + bonusEffect->SetAmount(amount); + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_madness_of_deathwing_corrupted_blood::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + +class spell_madness_of_deathwing_spellweave : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_spellweave); + + void FilterFragments(std::list& targets) + { + targets.remove_if([this](WorldObject const* target)->bool + { + return target == GetExplTargetUnit(); + }); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_madness_of_deathwing_spellweave::FilterFragments, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); + } +}; + +class spell_madness_of_deathwing_elementium_blast : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_elementium_blast); + + void HandleDamage(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + int32 damage = GetHitDamage(); + if (!damage) + return; + + float distance = caster->GetExactDist2d(GetHitUnit()); + + // Guessed formular based on sniff data + damage = (damage / distance) * 3.5f; + SetHitDamage(damage); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_madness_of_deathwing_elementium_blast::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } +}; + +class spell_madness_of_deathwing_cataclysm : public SpellScript +{ + PrepareSpellScript(spell_madness_of_deathwing_cataclysm); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_CATACLYSM_VISUAL }); + } + + void HandleVisual() + { + GetCaster()->CastSpell(GetCaster(), SPELL_CATACLYSM_VISUAL); + } + + void Register() override + { + AfterCast += SpellCastFn(spell_madness_of_deathwing_cataclysm::HandleVisual); + } +}; + + +class at_madness_of_deathwing_carrying_winds_jump : public AreaTriggerScript +{ +public: + at_madness_of_deathwing_carrying_winds_jump() : AreaTriggerScript("at_madness_of_deathwing_carrying_winds_jump") { } + + bool OnTrigger(Player* player, AreaTriggerEntry const* areaTrigger) + { + uint32 spellId = 0; + switch (areaTrigger->ID) + { + case AT_JUMP_ALEXSTRASZA_TO_NOZDORMU: + spellId = SPELL_CARRYING_WINDS_JUMP_ALEXSTRASZA_TO_NOZDORMU; + break; + case AT_JUMP_KALECGOS_TO_YSERA: + spellId = SPELL_CARRYING_WINDS_JUMP_KALECGOS_TO_YSERA; + break; + case AT_JUMP_NOZDORMU_TO_ALEXSTRASZA: + spellId = SPELL_CARRYING_WINDS_JUMP_NOZDORMU_TO_ALEXSTRASZA; + break; + case AT_JUMP_NOZDORMU_TO_YSERA: + spellId = SPELL_CARRYING_WINDS_JUMP_NOZDORMU_TO_YSERA; + break; + case AT_JUMP_YSERA_TO_KALECGOS: + spellId = SPELL_CARRYING_WINDS_JUMP_YSERA_TO_KALECGOS; + break; + case AT_JUMP_YSERA_TO_NOZDORMU: + spellId = SPELL_CARRYING_WINDS_JUMP_YSERA_TO_NOZDORMU; + break; + default: + break; + } + + if (!spellId) + return false; + + if (Creature* pad = player->FindNearestCreature(NPC_JUMP_PAD, 30.f)) + pad->CastSpell(player, spellId); + + return true; + } +}; + +class at_madness_of_deathwing_carrying_winds_land : public AreaTriggerScript +{ +public: + at_madness_of_deathwing_carrying_winds_land() : AreaTriggerScript("at_madness_of_deathwing_carrying_winds_land") { } + + bool OnTrigger(Player* player, AreaTriggerEntry const* areaTrigger) + { + uint32 spellId = 0; + + switch (areaTrigger->ID) + { + case AT_LAND_ALEXSTRASZA_TO_NOZDORMU: + spellId = SPELL_CARRYING_WINDS_DUMMY_ALEXSTRASZA_TO_NOZDORMU; + break; + case AT_LAND_KALECGOS_TO_YSERA: + spellId = SPELL_CARRYING_WINDS_DUMMY_KALECGOS_TO_YSERA; + break; + case AT_LAND_NOZDORMU_TO_ALEXSTRASZA: + spellId = SPELL_CARRYING_WINDS_DUMMY_NOZDORMU_TO_ALEXSTRASZA; + break; + case AT_LAND_NOZDORMU_TO_YSERA: + spellId = SPELL_CARRYING_WINDS_DUMMY_NOZDORMU_TO_YSERA; + break; + case AT_LAND_YSERA_TO_KALECGOS: + spellId = SPELL_CARRYING_WINDS_DUMMY_YSERA_TO_KALECGOS; + break; + case AT_LAND_YSERA_TO_NOZDORMU: + spellId = SPELL_CARRYING_WINDS_DUMMY_YSERA_TO_NOZDORMU; + break; + default: + break; + } + + if (!spellId || !player->HasAura(spellId)) + return false; + + if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId)) + if (uint32 triggerSpellId = spell->Effects[EFFECT_0].TriggerSpell) + player->CastCustomSpell(triggerSpellId, SPELLVALUE_BASE_POINT1, spellId, player, true); + + return true; + } +}; + +void AddSC_boss_madness_of_deathwing() +{ + RegisterDragonSoulCreatureAI(boss_madness_of_deathwing); + RegisterDragonSoulCreatureAI(npc_madness_of_deathwing_limb_tentacle); + RegisterDragonSoulCreatureAI(npc_madness_of_deathwing_mutated_corruption); + RegisterDragonSoulCreatureAI(npc_madness_of_deathwing_regenerative_blood); + RegisterDragonSoulCreatureAI(npc_madness_of_deathwing_elementium_bolt); + RegisterDragonSoulCreatureAI(npc_madness_of_deathwing_thrall); + RegisterDragonSoulCreatureAI(npc_madness_of_deathwing_dragon_aspect); + RegisterDragonSoulCreatureAI(npc_madness_of_deathwing_cosmetic_limb); + RegisterDragonSoulCreatureAI(npc_mandess_of_deathwing_elementium_fragment); + RegisterDragonSoulCreatureAI(npc_mandess_of_deathwing_elementium_terror); + RegisterSpellScript(spell_madness_of_deathwing_presence_of_the_aspects); + RegisterSpellScript(spell_madness_of_deathwing_carrying_winds_jump); + RegisterSpellScript(spell_madness_of_deathwing_carrying_winds_triggered); + RegisterSpellScript(spell_madness_of_deathwing_limb_emerge_visual); + RegisterSpellScript(spell_madness_of_deathwing_agonizing_pain); + RegisterSpellScript(spell_madness_of_deathwing_assault_aspects); + RegisterSpellScript(spell_madness_of_deathwing_face_trigger); + RegisterSpellScript(spell_madness_of_deathwing_summon_tail); + RegisterSpellScript(spell_madness_of_deathwing_crush); + RegisterSpellScript(spell_madness_of_deathwing_hemorrhage); + RegisterSpellScript(spell_madness_of_deathwing_hemorrhage_script); + RegisterSpellScript(spell_madness_of_deathwing_regenerative_blood_script); + RegisterAuraScript(spell_madness_of_deathwing_regenerative_blood_periodic); + RegisterSpellScript(spell_madness_of_deathwing_elementium_meteor_script); + RegisterSpellScript(spell_madness_of_deathwing_elementium_meteor_visual); + RegisterAuraScript(spell_madness_of_deathwing_burning_blood); + RegisterSpellScript(spell_madness_of_deathwing_spawn_blistering_tentacles); + RegisterSpellScript(spell_madness_of_deathwing_time_zone); + RegisterSpellScript(spell_madness_of_deathwing_trigger_concentration); + RegisterAuraScript(spell_madness_of_deathwing_concentration); + RegisterSpellScript(spell_madness_of_deathwing_trigger_aspect_buffs); + RegisterSpellScript(spell_madness_of_deathwing_share_health); + RegisterSpellScript(spell_madness_of_deathwing_summon_elementium_terror); + RegisterSpellScript(spell_madness_of_deathwing_summon_impaling_tentacle); + RegisterSpellScript(spell_madness_of_deathwing_shrapnel); + RegisterSpellScript(spell_madness_of_deathwing_fire_dragon_soul); + RegisterSpellScript(spell_madness_of_deathwing_fire_dragon_soul_aspects); + RegisterSpellScript(spell_madness_of_deathwing_trigger_aspect_yell); + RegisterAuraScript(spell_madness_of_deathwing_corrupted_blood_stacker); + RegisterAuraScript(spell_madness_of_deathwing_corrupted_blood); + RegisterSpellScript(spell_madness_of_deathwing_spellweave); + RegisterSpellScript(spell_madness_of_deathwing_elementium_blast); + RegisterSpellScript(spell_madness_of_deathwing_cataclysm); + new at_madness_of_deathwing_carrying_winds_jump(); + new at_madness_of_deathwing_carrying_winds_land(); +} diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/dragon_soul.h b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/dragon_soul.h index 604f0286498..24c4e0ddff0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/dragon_soul.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/dragon_soul.h @@ -35,15 +35,60 @@ enum DSDataTypes DATA_ULTRAXION = 4, DATA_WARMASTER_BLACKHORN = 5, DATA_SPINE_OF_DEATHWING = 6, - DATA_MADNESS_OF_DEATHWING = 7 + DATA_MADNESS_OF_DEATHWING = 7, + + // Additional Data + DATA_DEATHWING_MADNESS_OF_DEATHWING, + DATA_THRALL_MADNESS_OF_DEATHWING, + DATA_YSERA_MADNESS_OF_DEATHWING, + DATA_ALEXSTRASZA_MADNESS_OF_DEATHWING, + DATA_NOZDORMU_MADNESS_OF_DEATHWING, + DATA_KALECGOS_MADNESS_OF_DEATHWING, + DATA_TAIL_TENTACLE_MADNESS_OF_DEATHWING }; enum DSCreatures { + // Bosses + BOSS_MADNESS_OF_DEATHWING = 56173, + + /*Madness of Deathwing*/ + NPC_DEATHWING_MADNESS_OF_DEATHWING = 57962, + NPC_ARM_TENTACLE_1 = 56167, + NPC_ARM_TENTACLE_2 = 56846, + NPC_WING_TENTACLE = 56168, + NPC_TAIL_TENTACLE = 56844, + NPC_MUTATED_CORRUPTION = 56471, + NPC_CRUSH_TARGET = 56581, + NPC_PLATFORM = 56307, + NPC_HEMORRHAGE_TARGET = 56359, + NPC_ELEMENTIUM_BOLT = 56262, + NPC_BLISTERING_TENTACLE = 56188, + NPC_TIME_ZONE_TARGET = 56332, + NPC_TIME_ZONE = 56311, + NPC_COSMETIC_TENTACLE = 57693, + NPC_ELEMENTIUM_FRAGMENT = 56724, + NPC_ELEMENTIUM_TERROR = 56710, + NPC_JUMP_PAD = 56699, + NPC_THRALL_MADNESS_OF_DEATHWING = 56103, + NPC_YSERA_MADNESS_OF_DEATHWING = 56100, + NPC_ALEXSTRASZA_MADNESS_OF_DEATHWING = 56099, + NPC_NOZDORMU_MADNESS_OF_DEATHWING = 56102, + NPC_KALECGOS_MADNESS_OF_DEATHWING = 56101 }; enum DSGameObjectIds { + GO_ELEMENTIUM_FRAGMENT_10_NORMAL = 210079, + GO_ELEMENTIUM_FRAGMENT_25_NORMAL = 210218, + GO_ELEMENTIUM_FRAGMENT_25_LFR = 210220, + GO_ELEMENTIUM_FRAGMENT_10_HEROIC = 210219, + GO_ELEMENTIUM_FRAGMENT_25_HEROIC = 210217 +}; + +enum DSSpells +{ + SPELL_CALM_MAELSTROM_SKYBOX = 109480 }; template diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/instance_dragon_soul.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/instance_dragon_soul.cpp index 76f0a36f212..dbb29a29ded 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/instance_dragon_soul.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/instance_dragon_soul.cpp @@ -21,7 +21,15 @@ ObjectData const creatureData[] = { - { 0, 0 } // END + { BOSS_MADNESS_OF_DEATHWING, DATA_MADNESS_OF_DEATHWING }, + { NPC_DEATHWING_MADNESS_OF_DEATHWING, DATA_DEATHWING_MADNESS_OF_DEATHWING }, + { NPC_THRALL_MADNESS_OF_DEATHWING, DATA_THRALL_MADNESS_OF_DEATHWING }, + { NPC_YSERA_MADNESS_OF_DEATHWING, DATA_YSERA_MADNESS_OF_DEATHWING }, + { NPC_ALEXSTRASZA_MADNESS_OF_DEATHWING, DATA_ALEXSTRASZA_MADNESS_OF_DEATHWING }, + { NPC_NOZDORMU_MADNESS_OF_DEATHWING, DATA_NOZDORMU_MADNESS_OF_DEATHWING }, + { NPC_KALECGOS_MADNESS_OF_DEATHWING, DATA_KALECGOS_MADNESS_OF_DEATHWING }, + { NPC_TAIL_TENTACLE, DATA_TAIL_TENTACLE_MADNESS_OF_DEATHWING }, + { 0, 0 } // END }; ObjectData const gameobjectData[] = @@ -48,6 +56,29 @@ public: LoadDoorData(doorData); LoadObjectData(creatureData, gameobjectData); } + + void OnCreatureCreate(Creature* creature) override + { + InstanceScript::OnCreatureCreate(creature); + + switch (creature->GetEntry()) + { + case NPC_YSERA_MADNESS_OF_DEATHWING: + case NPC_ALEXSTRASZA_MADNESS_OF_DEATHWING: + case NPC_NOZDORMU_MADNESS_OF_DEATHWING: + case NPC_KALECGOS_MADNESS_OF_DEATHWING: + creature->setActive(true); // Ugly as fuck but the boss area is just too big... + break; + default: + break; + } + } + + void OnPlayerEnter(Player* player) override + { + if (GetBossState(DATA_MADNESS_OF_DEATHWING) == DONE) + player->CastSpell(player, SPELL_CALM_MAELSTROM_SKYBOX); + } }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp index 5eb5d7c86dc..e20e9c71e68 100644 --- a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp +++ b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp @@ -50,7 +50,8 @@ void AddSC_instance_culling_of_stratholme(); void AddSC_instance_end_time(); //CoT End Time void AddSC_instance_well_of_eternity(); //CoT Well of Eternity void AddSC_instance_hour_of_twilight(); //CoT Hour of Twilight -void AddSC_instance_dragon_soul(); +void AddSC_instance_dragon_soul(); //CoT Dragon Soul +void AddSC_boss_madness_of_deathwing(); void AddSC_instance_dire_maul(); //Dire Maul void AddSC_instance_ragefire_chasm(); //Ragefire Chasm void AddSC_boss_celebras_the_cursed(); //Maraudon @@ -181,7 +182,8 @@ void AddKalimdorScripts() AddSC_instance_end_time(); //CoT End Time AddSC_instance_well_of_eternity(); //CoT Well of Eternity AddSC_instance_hour_of_twilight(); //CoT Hour of Twilight - AddSC_instance_dragon_soul(); + AddSC_instance_dragon_soul(); //CoT Dragon Soul + AddSC_boss_madness_of_deathwing(); AddSC_instance_dire_maul(); //Dire Maul AddSC_instance_ragefire_chasm(); //Ragefire Chasm AddSC_boss_celebras_the_cursed(); //Maraudon