diff --git a/sql/updates/world/4.3.4/custom_2018_04_16_01_world.sql b/sql/updates/world/4.3.4/custom_2018_04_16_01_world.sql new file mode 100644 index 0000000000..771eb811ac --- /dev/null +++ b/sql/updates/world/4.3.4/custom_2018_04_16_01_world.sql @@ -0,0 +1,139 @@ +-- Template Updates +-- Halfus Wyrmbreaker +UPDATE `creature_template` SET `difficulty_entry_1`= 46209, `difficulty_entry_2`= 46210, `difficulty_entry_3` = 46211, `ScriptName`= 'boss_halfus_wyrmbreaker' WHERE `entry`= 44600; +UPDATE `creature_template` SET `minlevel`= 88, `maxlevel`= 88, `faction`= 16, `BaseAttackTime`= 1500, `DamageModifier`= 80, `mingold`= 2200000, `maxgold`= 2400000, `mechanic_immune_mask`= 80297855, `exp`= 3 WHERE `entry` IN (44600, 46209, 46210, 46211); +UPDATE `creature_template` SET `mingold`= 4900000, `maxgold`= 5100000 WHERE `entry` IN (46209, 46211); +-- Proto-Behemoth +UPDATE `creature_template` SET `difficulty_entry_1`= 46227, `difficulty_entry_2`= 46228, `difficulty_entry_3` = 46229, `ScriptName`= 'npc_halfus_proto_behemoth' WHERE `entry`= 44687; +UPDATE `creature_template` SET `minlevel`= 87, `maxlevel`= 87, `exp`= 3, `faction`= 16, `mechanic_immune_mask`= 617299839, `flags_extra`= 0x40000000, `InhabitType`= 12 WHERE `entry` IN (44687, 46227, 46228, 46229); +-- Enslaved Dragons +UPDATE `creature_template` SET `ScriptName`= 'npc_halfus_enslaved_dragon' WHERE `entry` IN (44645, 44652, 44650, 44797, 44641); +UPDATE `creature_template` SET `minlevel`= 87, `maxlevel`= 87, `exp`= 3, `faction`= 35, `npcflag`= 1, `DamageModifier`= 30, `flags_extra`= 0x00000200 | 0x40000000, `HoverHeight`= 7.875, `mechanic_immune_mask`= 617299839 WHERE `entry` IN (46212, 46213, 46214, 46215, 46216, 46217, 46218, 46219, 46220, 46221, 46222, 46223, 44645, 44652, 44650, 44797); +UPDATE `creature_template` SET `minlevel`= 87, `maxlevel`= 87, `exp`= 3, `faction`= 35, `npcflag`= 1, `DamageModifier`= 3.5, `flags_extra`= 0x40000000, `mechanic_immune_mask`= 617299839 WHERE `entry` IN (46224, 46225, 46226, 44641); +-- Nether Scion +UPDATE `creature_template` SET `difficulty_entry_1`= 46212, `difficulty_entry_2`= 46213, `difficulty_entry_3`= 46214 WHERE `entry`= 44645; +UPDATE `creature_template` SET `gossip_menu_id`= 12077 WHERE `entry` IN (46212, 46213, 46214, 44645); +-- Slate Dragon +UPDATE `creature_template` SET `difficulty_entry_1`= 46215, `difficulty_entry_2`= 46216, `difficulty_entry_3`= 46217 WHERE `entry`= 44652; +UPDATE `creature_template` SET `gossip_menu_id`= 12078 WHERE `entry` IN (46215, 46216, 46217); +-- Storm Rider +UPDATE `creature_template` SET `difficulty_entry_1`= 46218, `difficulty_entry_2`= 46219, `difficulty_entry_3`= 46220 WHERE `entry`= 44650; +UPDATE `creature_template` SET `gossip_menu_id`= 12079 WHERE `entry` IN (46218, 46219, 46220); +-- Time Warden +UPDATE `creature_template` SET `difficulty_entry_1`= 46221, `difficulty_entry_2`= 46222, `difficulty_entry_3`= 46223 WHERE `entry`= 44797; +UPDATE `creature_template` SET `gossip_menu_id`= 12076 WHERE `entry` IN (46221, 46222, 46223); +-- Orphaned Emerald Whelp +UPDATE `creature_template` SET `difficulty_entry_1`= 46224, `difficulty_entry_2`= 46225, `difficulty_entry_3`= 46226 WHERE `entry`= 44641; +UPDATE `creature_template` SET `gossip_menu_id`= 11884 WHERE `entry` IN (46224, 46225, 46226); +-- Cyclone Winds +UPDATE `creature_template` SET `unit_flags`= 33554432, `flags_extra`= 128, `InhabitType`= 4 WHERE `entry`= 45026; +-- Whelp Cage +UPDATE `gameobject_template` SET `ScriptName`= 'go_halfus_whelp_cage' WHERE `entry`= 205087; +UPDATE `gameobject_template_addon` SET `flags`= 16 | 32 WHERE `entry`= 205087; + +-- Texts +DELETE FROM `creature_text` WHERE `CreatureID`= 44600; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `comment`) VALUES +(44600, 0, 0, 'Cho''gall will have your heads! ALL OF THEM!', 14, 0, 100, 0, 0, 20186, 48970, 'Halfus Wyrmbreaker - Aggro'), +(44600, 1, 0, 'The wyrms will eat well tonight!', 14, 0, 100, 0, 0, 20187, 48971, 'Halfus Wyrmbreaker - Slay 1'), +(44600, 1, 1, 'The burden of the damned falls upon you!', 14, 0, 100, 0, 0, 20188, 48972, 'Halfus Wyrmbreaker - Slay 2'), +(44600, 2, 0, '%s binds the $n to his will!', 41, 0, 100, 0, 0, 20190, 48961, 'Halfus Wyrmbreaker - Bind Dragon'), +(44600, 3, 0, '%s roars furiously!', 41, 0, 100, 0, 0, 0, 48966, 'Halfus Wyrmbreaker - Furious Roar'); + +-- Spells +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_halfus_bind_will', +'spell_halfus_fireball', +'spell_halfus_stone_touch'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(84246, 'spell_halfus_bind_will'), +(86058, 'spell_halfus_fireball'), +(83719, 'spell_halfus_fireball'), +(83603, 'spell_halfus_stone_touch'); + +-- Spellclick Spells +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (44645, 44652, 44650, 44797); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES +(44645, 83589, 1, 1), +(44652, 83590, 1, 1), +(44650, 83591, 1, 1), +(44797, 83447, 1, 1); + +-- Conditions +DELETE FROM `conditions` WHERE `SourceEntry` IN (83487, 83611, 83603, 84092, 87683, 83601, 83609, 84246) AND `SourceTypeOrReferenceId`= 13; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES +(13, 1, 83487, 0, 0, 31, 0, 3, 44645, 0, 0, 0, '', 'Chain - Target Nether Scion'), +(13, 1, 83487, 0, 1, 31, 0, 3, 44652, 0, 0, 0, '', 'Chain - Target Slate Dragon'), +(13, 1, 83487, 0, 2, 31, 0, 3, 44650, 0, 0, 0, '', 'Chain - Target Storm Rider'), +(13, 1, 83487, 0, 3, 31, 0, 3, 44797, 0, 0, 0, '', 'Chain - Target Time Warden'), +(13, 7, 83611, 0, 0, 31, 0, 3, 44600, 0, 0, 0, '', 'Nether Blindness - Target Halfus Wyrmbreaker'), +(13, 1, 83603, 0, 0, 31, 0, 3, 44600, 0, 0, 0, '', 'Stone Touch - Target Halfus Wyrmbreaker'), +(13, 1, 84092, 0, 0, 31, 0, 3, 44600, 0, 0, 0, '', 'Cyclone Winds - Target Halfus Wyrmbreaker'), +(13, 1, 87683, 0, 0, 31, 0, 3, 44600, 0, 0, 0, '', 'Dragon''s Vengeance - Target Halfus Wyrmbreaker'), +(13, 1, 84246, 0, 0, 31, 0, 3, 44600, 0, 0, 0, '', 'Bind Will - Target Halfus Wyrmbreaker'), +(13, 1, 83601, 0, 0, 31, 0, 3, 44687, 0, 0, 0, '', 'Time Dilation - Target Proto-Behemoth'), +(13, 1, 83609, 0, 0, 31, 0, 3, 44687, 0, 0, 0, '', 'Atrophic Poison - Target Proto-Behemoth'); + +-- Creature Spike 44765 SAI +SET @ENTRY := 44765; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 60, 0, 100, 0, 200, 200, 0, 0, 11, 83487, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Every 0 and 0 ms (for the first time, timer between 200 and 200 ms) - Self: Cast spell Chain (83487) on Self // "); + +-- Creature Cyclone Winds 45026 SAI +SET @ENTRY := 45026; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 1, 63, 0, 100, 0, 0, 0, 0, 0, 11, 84092, 0, 0, 0, 0, 0, 11, 44600, 100, 0, 0, 0, 0, 0, "When just created - Self: Cast spell Cyclone Winds (84092) on Creature Halfus Wyrmbreaker (44600) in 100 yd // "), +(@ENTRY, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 41, 11400, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Despawn in 11400 ms // "); + +DELETE FROM `creature_loot_template` WHERE `Entry` IN (44600, 46209, 46210, 46211); +UPDATE `creature_template` SET `lootid`= `entry` WHERE `entry` IN (46209, 46210, 46211); +DELETE FROM `reference_loot_template` WHERE `Entry` IN (446000, 462100, 462101); + +INSERT INTO `reference_loot_template` (`Entry`, `Item`, `Chance`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`) VALUES +-- Normal Mode +(446000, 59483, 0, 1, 1, 1, 1), -- Wyrmbreaker's Amulet +(446000, 59484, 0, 1, 1, 1, 1), -- Book of Binding Will +(446000, 59473, 0, 1, 1, 1, 1), -- Essence of the Cyclone +(446000, 59475, 0, 1, 1, 1, 1), -- Bracers of the Bronze Flight +(446000, 59470, 0, 1, 1, 1, 1), -- Bracers of Impossible Strength +(446000, 59474, 0, 1, 1, 1, 1), -- Malevolence +(446000, 59471, 0, 1, 1, 1, 1), -- Paudrons of the Great Ettin +(446000, 59472, 0, 1, 1, 1, 1), -- Proto-Handler's Gauntlets +(446000, 59481, 0, 1, 1, 1, 1), -- Helm of the Nether Scion +(446000, 59476, 0, 1, 1, 1, 1), -- Legguards of the Emerald Brook +(446000, 59482, 0, 1, 1, 1, 1), -- Robes of the Burning Acolyte +(446000, 59469, 0, 1, 1, 1, 1), -- Storm Rider's Boots +-- Heroic Mode +(462100, 65134, 0, 1, 1, 1, 1), -- Wyrmbreaker's Amulet +(462100, 65133, 0, 1, 1, 1, 1), -- Book of Binding Will +(462100, 65140, 0, 1, 1, 1, 1), -- Essence of the Cyclone +(462100, 65138, 0, 1, 1, 1, 1), -- Bracers of the Bronze Flight +(462100, 65143, 0, 1, 1, 1, 1), -- Bracers of Impossible Strength +(462100, 65139, 0, 1, 1, 1, 1), -- Malevolence +(462100, 65142, 0, 1, 1, 1, 1), -- Paudrons of the Great Ettin +(462100, 65141, 0, 1, 1, 1, 1), -- Proto-Handler's Gauntlets +(462100, 65136, 0, 1, 1, 1, 1), -- Helm of the Nether Scion +(462100, 65137, 0, 1, 1, 1, 1), -- Legguards of the Emerald Brook +(462100, 65135, 0, 1, 1, 1, 1), -- Robes of the Burning Acolyte +(462100, 65144, 0, 1, 1, 1, 1), -- Storm Rider's Boots +-- Tier Set Token +(462101, 67424, 0, 1, 1, 1, 1), -- Chest of the Forlorn Protector +(462101, 67423, 0, 1, 1, 1, 1), -- Chest of the Forlorn Conqueror +(462101, 67425, 0, 1, 1, 1, 1); -- Chest of the Forlorn Vanquisher + +INSERT INTO `creature_loot_template` (`Entry`, `Item`, `Chance`, `LootMode`, `Reference`, `MaxCount`) VALUES +-- 10 Player Normal +(44600, 446000, 100, 1, 446000, 2), +-- 25 Player Normal +(46209, 446000, 100, 1, 446000, 4), +-- 10 Player Heroic +(46210, 462100, 100, 1, 462100, 2), +(46210, 462101, 100, 1, 462101, 1), +-- 25 Player Heroic +(46211, 462100, 100, 1, 462100, 4), +(46211, 462101, 100, 1, 462101, 2); diff --git a/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h b/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h index beddcc01bb..fef5182b3b 100644 --- a/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h +++ b/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h @@ -41,14 +41,30 @@ enum BoTDataTypes DATA_FELUDIUS = 9, DATA_TERRASTRA = 10, DATA_ARION = 11, - DATA_ELEMENTIUM_MONSTROSITY = 12 + DATA_ELEMENTIUM_MONSTROSITY = 12, + + // GameObject Types + DATA_WHELP_CAGE = 13, + + // Encounter Related + /*Halfus Wyrmbreaker*/ + DATA_UNRESPONSIVE_DRAGON_FIRST, + DATA_UNRESPONSIVE_DRAGON_SECOND, + DATA_CAST_DRAGON_BUFFS, + DATA_DRAGON_TO_BIND, + DATA_OPEN_ORPHANED_EMERALD_WHELP_CAGE +}; + +enum BoTDataStates +{ + DRAGON_BUFFS_HALFUS_WYRMBREAKER, + DRAGON_BUFFS_PROTO_BEHEMOTH, }; enum BoTCreatures { // Bosses BOSS_HALFUS_WYRMBREAKER = 44600, - BOSS_PROTO_BEHEMOTH = 44687, BOSS_THERALION = 45993, BOSS_VALIONA = 45992, BOSS_IGNACIOUS = 43686, @@ -57,7 +73,17 @@ enum BoTCreatures BOSS_ARION = 43688, BOSS_ELEMENTIUM_MONSTROSITY = 43735, BOSS_CHOGALL = 43324, - BOSS_SINESTRA = 45213 + BOSS_SINESTRA = 45213, + + // Encounter related + /*Halfus Wyrmbreaker*/ + NPC_PROTO_BEHEMOTH = 44687, + NPC_NETHER_SCION = 44645, + NPC_SLATE_DRAGON = 44652, + NPC_STORM_RIDER = 44650, + NPC_TIME_WARDEN = 44797, + NPC_ORPHANED_EMERALD_WELP = 44641, + NPC_SPIKE = 44765 }; enum BoTGameObjects @@ -68,12 +94,19 @@ enum BoTGameObjects GO_DRAGON_SIBLINGS_DOOR_EXIT = 205225, GO_ASCENDANT_COUNCIL_ENTRANCE = 205226, GO_ASCENDANT_COUNCIL_EXIT = 205227, - GO_CHOGALL_ENTRANCE = 205228 + GO_CHOGALL_ENTRANCE = 205228, + GO_WHELP_CAGE = 205087 }; -enum UnresponsiveDragonCases +enum BoTActions { - + ACTION_ENABLE_MALEVOLENT_STRIKES = 1, + ACTION_ENABLE_FRENZIED_ASSAULT = 2, + ACTION_ENABLE_SHADOW_NOVA = 3, + ACTION_ENABLE_FIREBALL_BARRAGE = 1, + ACTION_ENABLE_SCORCHING_BREATH = 2, + ACTION_CAST_DRAGONS_VENGEANCE = 3, + ACTION_MOVE_OUT_OF_CAGE = 4 }; template diff --git a/src/server/scripts/EasternKingdoms/BastionOfTwilight/boss_halfus_wyrmbreaker.cpp b/src/server/scripts/EasternKingdoms/BastionOfTwilight/boss_halfus_wyrmbreaker.cpp index c6280c51b4..e9da8a7267 100644 --- a/src/server/scripts/EasternKingdoms/BastionOfTwilight/boss_halfus_wyrmbreaker.cpp +++ b/src/server/scripts/EasternKingdoms/BastionOfTwilight/boss_halfus_wyrmbreaker.cpp @@ -20,17 +20,59 @@ #include "ScriptedCreature.h" #include "SpellScript.h" #include "SpellAuraEffects.h" +#include "PassiveAI.h" +#include "GameObject.h" +#include "GameObjectAI.h" #include "Player.h" #include "bastion_of_twilight.h" enum Spells { + // Halfus Wyrmbreaker + SPELL_FRENZIED_ASSAULT = 83693, + SPELL_MALEVOLENT_STRIKES = 39171, + SPELL_SHADOW_NOVA = 83703, + SPELL_BIND_WILL_TRIGGERED = 83432, + SPELL_PARALYSIS = 84030, + SPELL_FURIOUS_ROAR = 83710, + // Proto Behemoth + SPELL_DRAGONS_VENGEANCE = 87683, + SPELL_DANCING_FLAMES = 84106, + SPELL_SUPERHEATED_BREATH = 83956, + SPELL_FIREBALL = 86058, + SPELL_FIREBALL_BARRAGE = 83706, + SPELL_FIREBALL_BARRAGE_FAST = 83720, + SPELL_FIREBALL_BARRAGE_SLOW = 83733, + SPELL_SCORCHING_BREATH = 83707, + + // Enslaved Dragons + SPELL_UNRESPONSIVE_DRAGON = 86003, + SPELL_UNRESPONSIVE_WHELP = 86022, + SPELL_NETHER_BLINDNESS = 83611, + SPELL_STONE_TOUCH = 83603, + SPELL_CYCLONE_WINDS = 83612, + SPELL_TIME_DILATION = 83601, + SPELL_ATROPHIC_POISON = 83609, + SPELL_BIND_WILL = 84246, }; enum Events { + // Halfus Wyrmbreaker + EVENT_SHADOW_NOVA = 1, + EVENT_FURIOUS_ROAR, + // Proto-Behemoth + EVENT_FIREBALL, + EVENT_FIREBALL_BARRAGE, + EVENT_SCORCHING_BREATH, + + // Enslaved Dragons + EVENT_LIFTOFF, + EVENT_CAST_DEBUFF, + EVENT_BIND_TO_HALFUS_WILL, + EVENT_MOVE_OUT_OF_CAGE }; enum Actions @@ -40,7 +82,11 @@ enum Actions enum Texts { - SAY_AGGRO = 0, + // Halfus Wyrmbreaker + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_ANNOUNCE_BIND_DRAGON = 2, + SAY_ANNOUNCE_FURIOUS_ROAR = 3 }; class boss_halfus_wyrmbreaker : public CreatureScript @@ -52,11 +98,22 @@ class boss_halfus_wyrmbreaker : public CreatureScript { boss_halfus_wyrmbreakerAI(Creature* creature) : BossAI(creature, DATA_HALFUS_WYRMBREAKER) { + Initialize(); + } + + void Initialize() + { + _allowShadowNovaCasts = false; + _announcedEmeraldBinding = false; + _furiousRoarEnabled = false; + _furiousRoarCount = 0; } void Reset() override { _Reset(); + Initialize(); + instance->SetData(DATA_CAST_DRAGON_BUFFS, DRAGON_BUFFS_HALFUS_WYRMBREAKER); } void JustEngagedWith(Unit* /*who*/) override @@ -64,13 +121,24 @@ class boss_halfus_wyrmbreaker : public CreatureScript _JustEngagedWith(); Talk(SAY_AGGRO); instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); + + if (Creature* protoBehemoth = instance->GetCreature(DATA_PROTO_BEHEMOTH)) + protoBehemoth->SetInCombatWithZone(); + + if (_allowShadowNovaCasts) + events.ScheduleEvent(EVENT_SHADOW_NOVA, Seconds(7)); + } + + void KilledUnit(Unit* victim) override + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) override { _JustDied(); instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - //Talk(SAY_DEATH); } void EnterEvadeMode(EvadeReason /*why*/) override @@ -80,6 +148,50 @@ class boss_halfus_wyrmbreaker : public CreatureScript _DespawnAtEvade(); } + void SpellHit(Unit* caster, SpellInfo const* spell) override + { + if (!caster) + return; + + if (spell->Id == SPELL_BIND_WILL) + { + if (caster->GetEntry() == NPC_ORPHANED_EMERALD_WELP && !_announcedEmeraldBinding) + { + Talk(SAY_ANNOUNCE_BIND_DRAGON, caster); + _announcedEmeraldBinding = true; + } + else if (caster->GetEntry() != NPC_ORPHANED_EMERALD_WELP) + Talk(SAY_ANNOUNCE_BIND_DRAGON, caster); + } + } + + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) override + { + if (me->HealthBelowPct(50) && !_furiousRoarEnabled) + { + events.ScheduleEvent(EVENT_FURIOUS_ROAR, Milliseconds(1)); + _furiousRoarEnabled = true; + } + } + + void DoAction(int32 action) + { + switch (action) + { + case ACTION_ENABLE_MALEVOLENT_STRIKES: + me->AddAura(SPELL_MALEVOLENT_STRIKES, me); + break; + case ACTION_ENABLE_FRENZIED_ASSAULT: + me->AddAura(SPELL_FRENZIED_ASSAULT, me); + break; + case ACTION_ENABLE_SHADOW_NOVA: + _allowShadowNovaCasts = true; + break; + default: + break; + } + } + void UpdateAI(uint32 diff) override { if (!UpdateVictim()) @@ -87,14 +199,33 @@ class boss_halfus_wyrmbreaker : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasUnitState(UNIT_STATE_STUNNED)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { - case 0: + case EVENT_SHADOW_NOVA: + DoCastAOE(SPELL_SHADOW_NOVA); + events.Repeat(Seconds(8)); + break; + case EVENT_FURIOUS_ROAR: + if (_furiousRoarCount == 0) + Talk(SAY_ANNOUNCE_FURIOUS_ROAR); + + if (_furiousRoarCount != 2) + { + DoCastAOE(SPELL_FURIOUS_ROAR); + events.Repeat(Seconds(3)); + _furiousRoarCount++; + } + else + { + DoCastAOE(SPELL_FURIOUS_ROAR); + events.Repeat(Seconds(25)); + _furiousRoarCount = 0; + } break; default: break; @@ -103,6 +234,12 @@ class boss_halfus_wyrmbreaker : public CreatureScript DoMeleeAttackIfReady(); } + + private: + bool _allowShadowNovaCasts; + bool _announcedEmeraldBinding; + bool _furiousRoarEnabled; + uint8 _furiousRoarCount; }; CreatureAI* GetAI(Creature *creature) const override @@ -111,7 +248,377 @@ class boss_halfus_wyrmbreaker : public CreatureScript } }; +class npc_halfus_proto_behemoth : public CreatureScript +{ + public: + npc_halfus_proto_behemoth() : CreatureScript("npc_halfus_proto_behemoth") { } + + struct npc_halfus_proto_behemothAI : public PassiveAI + { + npc_halfus_proto_behemothAI(Creature* creature) : PassiveAI(creature), _instance(creature->GetInstanceScript()) { } + + void JustEngagedWith(Unit* /*who*/) override + { + _events.ScheduleEvent(EVENT_FIREBALL, Seconds(1)); + + if (me->HasAura(SPELL_DANCING_FLAMES)) + _events.ScheduleEvent(EVENT_FIREBALL_BARRAGE, Seconds(13)); + + if (me->HasAura(SPELL_SUPERHEATED_BREATH)) + _events.ScheduleEvent(EVENT_SCORCHING_BREATH, Seconds(24)); + } + + void Reset() override + { + _events.Reset(); + _instance->SetData(DATA_CAST_DRAGON_BUFFS, DRAGON_BUFFS_PROTO_BEHEMOTH); + } + + void DoAction(int32 action) override + { + switch (action) + { + case ACTION_CAST_DRAGONS_VENGEANCE: + DoCastSelf(SPELL_DRAGONS_VENGEANCE, true); + break; + case ACTION_ENABLE_SCORCHING_BREATH: + me->AddAura(SPELL_SUPERHEATED_BREATH, me); + break; + case ACTION_ENABLE_FIREBALL_BARRAGE: + me->AddAura(SPELL_DANCING_FLAMES, me); + 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_FIREBALL: + DoCastAOE(SPELL_FIREBALL); + _events.Repeat(Seconds(2) + Milliseconds(500)); + break; + case EVENT_FIREBALL_BARRAGE: + DoCastSelf(SPELL_FIREBALL_BARRAGE); + _events.Repeat(Seconds(31)); + break; + case EVENT_SCORCHING_BREATH: + DoCastSelf(SPELL_SCORCHING_BREATH); + _events.Repeat(Seconds(31)); + break; + default: + break; + } + } + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetBastionOfTwilightAI(creature); + } +}; + +class npc_halfus_enslaved_dragon : public CreatureScript +{ + public: + npc_halfus_enslaved_dragon() : CreatureScript("npc_halfus_enslaved_dragon") { } + + struct npc_halfus_enslaved_dragonAI : public ScriptedAI + { + npc_halfus_enslaved_dragonAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } + + void Reset() override + { + _events.Reset(); + + if (_instance->GetData(DATA_UNRESPONSIVE_DRAGON_FIRST) == me->GetEntry() + || _instance->GetData(DATA_UNRESPONSIVE_DRAGON_SECOND) == me->GetEntry()) + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + if (me->GetEntry() == NPC_ORPHANED_EMERALD_WELP) + DoCastSelf(SPELL_UNRESPONSIVE_WHELP, true); + else + DoCastSelf(SPELL_UNRESPONSIVE_DRAGON, true); + } + } + + void JustDied(Unit* /*killer*/) override + { + me->SetDisableGravity(false); + me->SendSetPlayHoverAnim(false); // TODO: fix unsetting hover on respawn. + + if (me->GetEntry() != NPC_ORPHANED_EMERALD_WELP) + if (Creature* protoBehemoth = _instance->GetCreature(DATA_PROTO_BEHEMOTH)) + protoBehemoth->AI()->DoAction(ACTION_CAST_DRAGONS_VENGEANCE); + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override + { + if (spell->HasEffect(SPELL_EFFECT_SEND_EVENT)) + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + me->RemoveAllAuras(); + _events.ScheduleEvent(EVENT_LIFTOFF, Milliseconds(1)); + } + else if (spell->Id == SPELL_BIND_WILL_TRIGGERED) + if (Player* player = me->SelectNearestPlayer(100.0f)) + me->AI()->AttackStart(player); + } + + void DoAction(int32 action) override + { + if (action == ACTION_MOVE_OUT_OF_CAGE) + _events.ScheduleEvent(EVENT_MOVE_OUT_OF_CAGE, Milliseconds(250)); + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_LIFTOFF: + { + Position pos = me->GetPosition(); + me->SetDisableGravity(true); + me->SendSetPlayHoverAnim(true); // TODO: fix unsetting hover on respawn. + me->GetMotionMaster()->MoveTakeoff(0, pos); + _events.ScheduleEvent(EVENT_CAST_DEBUFF, Seconds(1) + Milliseconds(750)); + break; + } + case EVENT_MOVE_OUT_OF_CAGE: + { + float angle = me->GetOrientation(); + float x = me->GetPositionX() + cos(angle) * 20.0f; + float y = me->GetPositionY() + sin(angle) * 20.0f; + float z = 888.1f; + me->GetMotionMaster()->MovePoint(0, x, y, z, true); + _events.ScheduleEvent(EVENT_CAST_DEBUFF, Seconds(2) + Milliseconds(600)); + break; + } + case EVENT_CAST_DEBUFF: + { + Creature* halfus = _instance->GetCreature(DATA_HALFUS_WYRMBREAKER); + Creature* protoBehemoth = _instance->GetCreature(DATA_PROTO_BEHEMOTH); + + if (!halfus || !protoBehemoth) + break; + + switch (me->GetEntry()) + { + case NPC_NETHER_SCION: + me->SetFacingToObject(halfus); + DoCastSelf(SPELL_NETHER_BLINDNESS, true); + break; + case NPC_SLATE_DRAGON: + me->SetFacingToObject(halfus); + DoCastSelf(SPELL_STONE_TOUCH, true); + break; + case NPC_STORM_RIDER: + me->SetFacingToObject(halfus); + DoCastSelf(SPELL_CYCLONE_WINDS, true); + break; + case NPC_TIME_WARDEN: + me->SetFacingToObject(protoBehemoth); + DoCastSelf(SPELL_TIME_DILATION, true); + break; + case NPC_ORPHANED_EMERALD_WELP: + me->SetFacingToObject(protoBehemoth); + DoCastSelf(SPELL_ATROPHIC_POISON, true); + break; + default: + break; + } + _events.ScheduleEvent(EVENT_BIND_TO_HALFUS_WILL, Seconds(1) + Milliseconds(850)); + break; + } + case EVENT_BIND_TO_HALFUS_WILL: + if (Creature* halfus = _instance->GetCreature(DATA_HALFUS_WYRMBREAKER)) + { + _instance->SetData(DATA_DRAGON_TO_BIND, me->GetEntry()); + DoCastSelf(SPELL_BIND_WILL, true); + } + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetBastionOfTwilightAI(creature); + } +}; + +class go_halfus_whelp_cage : public GameObjectScript +{ + public: + go_halfus_whelp_cage() : GameObjectScript("go_halfus_whelp_cage") { } + + struct go_halfus_whelp_cageAI : public GameObjectAI + { + go_halfus_whelp_cageAI(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { } + + bool OnReportUse(Player* /*player*/) override + { + me->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + _instance->SetData(DATA_OPEN_ORPHANED_EMERALD_WHELP_CAGE, DONE); + return true; + } + + private: + InstanceScript* _instance; + }; + + GameObjectAI* GetAI(GameObject* go) const override + { + return GetBastionOfTwilightAI(go); + } +}; + +class spell_halfus_bind_will : public SpellScriptLoader +{ + public: + spell_halfus_bind_will() : SpellScriptLoader("spell_halfus_bind_will") { } + + class spell_halfus_bind_will_SpellScript : public SpellScript + { + PrepareSpellScript(spell_halfus_bind_will_SpellScript); + + void HandleHit(SpellEffIndex effIndex) + { + if (Unit* caster = GetCaster()) + if (Unit* target = GetHitUnit()) + target->CastSpell(caster, GetSpellInfo()->Effects[effIndex].BasePoints, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_halfus_bind_will_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_halfus_bind_will_SpellScript(); + } +}; + +class spell_halfus_fireball : public SpellScriptLoader +{ + public: + spell_halfus_fireball() : SpellScriptLoader("spell_halfus_fireball") { } + + class spell_halfus_fireball_SpellScript : public SpellScript + { + PrepareSpellScript(spell_halfus_fireball_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_FIREBALL_BARRAGE_FAST, + SPELL_FIREBALL_BARRAGE_SLOW + }); + } + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + Trinity::Containers::RandomResize(targets, 1); + } + + void HandleHit(SpellEffIndex effIndex) + { + if (Unit* caster = GetCaster()) + { + if (!caster->HasAura(SPELL_TIME_DILATION)) + caster->CastSpell(GetHitUnit(), SPELL_FIREBALL_BARRAGE_FAST, true); + else + caster->CastSpell(GetHitUnit(), SPELL_FIREBALL_BARRAGE_SLOW, true); + } + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_halfus_fireball_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_halfus_fireball_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_halfus_fireball_SpellScript(); + } +}; + +class spell_halfus_stone_touch : public SpellScriptLoader +{ + public: + spell_halfus_stone_touch() : SpellScriptLoader("spell_halfus_stone_touch") { } + + class spell_halfus_stone_touch_AuraScript : public AuraScript + { + PrepareAuraScript(spell_halfus_stone_touch_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PARALYSIS }); + } + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + if (Unit* caster = GetTarget()) + caster->CastSpell(caster, SPELL_PARALYSIS, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_halfus_stone_touch_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_halfus_stone_touch_AuraScript(); + } +}; + void AddSC_boss_halfus_wyrmbreaker() { new boss_halfus_wyrmbreaker(); + new npc_halfus_proto_behemoth(); + new npc_halfus_enslaved_dragon(); + new go_halfus_whelp_cage(); + new spell_halfus_bind_will(); + new spell_halfus_fireball(); + new spell_halfus_stone_touch(); } diff --git a/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp b/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp index 54342e9278..78eba68ab0 100644 --- a/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp +++ b/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp @@ -30,7 +30,6 @@ ObjectData const creatureData[] = { { BOSS_HALFUS_WYRMBREAKER, DATA_HALFUS_WYRMBREAKER }, - { BOSS_PROTO_BEHEMOTH, DATA_PROTO_BEHEMOTH }, { BOSS_THERALION, DATA_THERALION }, { BOSS_VALIONA, DATA_VALIONA }, { BOSS_IGNACIOUS, DATA_IGNACIOUS }, @@ -40,13 +39,14 @@ ObjectData const creatureData[] = { BOSS_ELEMENTIUM_MONSTROSITY, DATA_ELEMENTIUM_MONSTROSITY }, { BOSS_CHOGALL, DATA_CHOGALL }, { BOSS_SINESTRA, DATA_SINESTRA }, + { NPC_PROTO_BEHEMOTH, DATA_PROTO_BEHEMOTH }, { 0, 0 } // END }; ObjectData const gameobjectData[] = { - //{ GO_IRON_CLAD_DOOR, DATA_IRON_CLAD_DOOR }, - { 0, 0 } // END + { GO_WHELP_CAGE, DATA_WHELP_CAGE }, + { 0, 0 } // END }; DoorData const doorData[] = @@ -61,6 +61,15 @@ DoorData const doorData[] = { 0, 0, DOOR_TYPE_ROOM } // END }; +uint32 HalfusDragonEntries[] = +{ + NPC_NETHER_SCION, + NPC_SLATE_DRAGON, + NPC_STORM_RIDER, + NPC_TIME_WARDEN, + NPC_ORPHANED_EMERALD_WELP +}; + class instance_bastion_of_twilight : public InstanceMapScript { public: @@ -74,20 +83,31 @@ class instance_bastion_of_twilight : public InstanceMapScript SetBossNumber(!map->IsHeroic() ? EncounterCountNormal : EncounterCountHeroic); // Sinestra only in heroic mode LoadDoorData(doorData); LoadObjectData(creatureData, gameobjectData); - - if (!map->IsHeroic()) - GenerateUnresponsiveDragonData(); + _unresponsiveDragonEntryFirst = 0; + _unresponsiveDragonEntrySecond = 0; + _dragonToBindEntry = 0; + _deadOrphanedEmeraldWhelps = 0; + GenerateHalfusDragonData(); } - void GenerateUnresponsiveDragonData() + void GenerateHalfusDragonData() { - } + for (uint8 i = 0; i < 5; i++) + _activetDragonEntries.insert(HalfusDragonEntries[i]); - /* - void OnPlayerEnter(Player* player) override - { + if (!instance->IsHeroic()) + { + for (uint8 i = 0; i < 2; i++) + { + uint32 entry = Trinity::Containers::SelectRandomContainerElement(_activetDragonEntries); + _activetDragonEntries.erase(entry); + if (i == 0) + _unresponsiveDragonEntryFirst = entry; + else + _unresponsiveDragonEntrySecond = entry; + } + } } - */ void OnCreatureCreate(Creature* creature) override { @@ -95,7 +115,13 @@ class instance_bastion_of_twilight : public InstanceMapScript switch (creature->GetEntry()) { - case 0: + case NPC_NETHER_SCION: + case NPC_SLATE_DRAGON: + case NPC_STORM_RIDER: + case NPC_TIME_WARDEN: + case NPC_ORPHANED_EMERALD_WELP: + case NPC_SPIKE: + _halfusEncounterGUIDs.insert(creature->GetGUID()); break; default: break; @@ -114,7 +140,58 @@ class instance_bastion_of_twilight : public InstanceMapScript switch (type) { - case 0: + case DATA_HALFUS_WYRMBREAKER: + if (state == IN_PROGRESS) + { + if (instance->IsHeroic() || HasActiveOrphanedEmeraldWhelps()) + if (GameObject* cage = GetGameObject(DATA_WHELP_CAGE)) + cage->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + + for (ObjectGuid guid : _halfusEncounterGUIDs) + { + if (Creature* creature = instance->GetCreature(guid)) + { + if (creature->GetEntry() != NPC_SPIKE + && creature->GetEntry() != _unresponsiveDragonEntryFirst + && creature->GetEntry() != _unresponsiveDragonEntrySecond) + { + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + if (creature->GetEntry() != NPC_ORPHANED_EMERALD_WELP) + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + } + } + } + } + else if (state == FAIL) + { + if (Creature* protoBehemoth = GetCreature(DATA_PROTO_BEHEMOTH)) + protoBehemoth->DespawnOrUnsummon(Milliseconds(0), Seconds(30)); + + for (ObjectGuid guid : _halfusEncounterGUIDs) + if (Creature* creature = instance->GetCreature(guid)) + creature->DespawnOrUnsummon(Milliseconds(0), Seconds(30)); + + if (GameObject* cage = GetGameObject(DATA_WHELP_CAGE)) + { + cage->SetGoState(GO_STATE_READY); + cage->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + + _deadOrphanedEmeraldWhelps = 0; + } + else if (state == DONE) + { + if (Creature* protoBehemoth = GetCreature(DATA_PROTO_BEHEMOTH)) + protoBehemoth->DespawnOrUnsummon(Milliseconds(0)); + + for (ObjectGuid guid : _halfusEncounterGUIDs) + if (Creature* creature = instance->GetCreature(guid)) + creature->DespawnOrUnsummon(Milliseconds(0)); + + if (GameObject* cage = GetGameObject(DATA_WHELP_CAGE)) + cage->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } break; default: break; @@ -124,13 +201,57 @@ class instance_bastion_of_twilight : public InstanceMapScript void OnUnitDeath(Unit* unit) override { + if (unit->GetEntry() == NPC_ORPHANED_EMERALD_WELP) + { + _deadOrphanedEmeraldWhelps++; + if (_deadOrphanedEmeraldWhelps == 8) + if (Creature* protoBehemoth = GetCreature(DATA_PROTO_BEHEMOTH)) + protoBehemoth->AI()->DoAction(ACTION_CAST_DRAGONS_VENGEANCE); + } } void SetData(uint32 type, uint32 data) override { switch (type) { - case 0: + case DATA_CAST_DRAGON_BUFFS: + if (data == DRAGON_BUFFS_HALFUS_WYRMBREAKER) + { + if (Creature* halfus = GetCreature(DATA_HALFUS_WYRMBREAKER)) + { + for (uint32 entry : _activetDragonEntries) + { + if (entry == NPC_SLATE_DRAGON) + halfus->AI()->DoAction(ACTION_ENABLE_MALEVOLENT_STRIKES); + if (entry == NPC_NETHER_SCION) + halfus->AI()->DoAction(ACTION_ENABLE_FRENZIED_ASSAULT); + if (entry == NPC_STORM_RIDER) + halfus->AI()->DoAction(ACTION_ENABLE_SHADOW_NOVA); + } + } + } + else if (data == DRAGON_BUFFS_PROTO_BEHEMOTH) + { + if (Creature* protoBehemoth = GetCreature(DATA_PROTO_BEHEMOTH)) + { + for (uint32 entry : _activetDragonEntries) + { + if (entry == NPC_ORPHANED_EMERALD_WELP) + protoBehemoth->AI()->DoAction(ACTION_ENABLE_SCORCHING_BREATH); + if (entry == NPC_TIME_WARDEN) + protoBehemoth->AI()->DoAction(ACTION_ENABLE_FIREBALL_BARRAGE); + } + } + } + break; + case DATA_DRAGON_TO_BIND: + _dragonToBindEntry = data; + break; + case DATA_OPEN_ORPHANED_EMERALD_WHELP_CAGE: + for (ObjectGuid guid : _halfusEncounterGUIDs) + if (Creature* orphanedEmeraldWhelp = instance->GetCreature(guid)) + if (orphanedEmeraldWhelp->GetEntry() == NPC_ORPHANED_EMERALD_WELP) + orphanedEmeraldWhelp->AI()->DoAction(ACTION_MOVE_OUT_OF_CAGE); break; default: break; @@ -139,30 +260,50 @@ class instance_bastion_of_twilight : public InstanceMapScript uint32 GetData(uint32 type) const override { + switch (type) + { + case DATA_UNRESPONSIVE_DRAGON_FIRST: + return _unresponsiveDragonEntryFirst; + case DATA_UNRESPONSIVE_DRAGON_SECOND: + return _unresponsiveDragonEntrySecond; + case DATA_DRAGON_TO_BIND: + return _dragonToBindEntry; + } return 0; } - /* void WriteSaveDataMore(std::ostringstream& data) override { - data << _teamInInstance << ' ' - << _foeReaper5000Intro << ' ' - << _ironCladDoorState; + data << _unresponsiveDragonEntryFirst << ' ' + << _unresponsiveDragonEntrySecond; } void ReadSaveDataMore(std::istringstream& data) override { - data >> _teamInInstance; - data >> _foeReaper5000Intro; - data >> _ironCladDoorState; + data >> _unresponsiveDragonEntryFirst; + data >> _unresponsiveDragonEntrySecond; } - */ + bool HasActiveOrphanedEmeraldWhelps() const + { + return (_unresponsiveDragonEntryFirst != NPC_ORPHANED_EMERALD_WELP + && _unresponsiveDragonEntrySecond != NPC_ORPHANED_EMERALD_WELP); + } + + /* void Update(uint32 diff) override { } + */ protected: + GuidSet _halfusEncounterGUIDs; + GuidSet _spikeGUIDs; + std::set _activetDragonEntries; + uint32 _unresponsiveDragonEntryFirst; + uint32 _unresponsiveDragonEntrySecond; + uint32 _dragonToBindEntry; + uint8 _deadOrphanedEmeraldWhelps; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override