From 338a5fe3080e8e606c58f4a2d2c1b5005ee177b9 Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Sun, 23 Jul 2023 08:27:19 +0200 Subject: [PATCH] fix(Scripts/Magtheridon): allow for Magtheridon to also break free immediately when all Hellfire Channelers are killed (#16794) * initial * oops * add space Co-authored-by: Skjalf <47818697+Nyeriah@users.noreply.github.com> * another space Co-authored-by: Skjalf <47818697+Nyeriah@users.noreply.github.com> * everything in doaction, scheduler is dumb * leftovers turns out the free say line was unused --------- --- .../hellfire-channeler-does-action-on-mag.sql | 12 ++ .../MagtheridonsLair/boss_magtheridon.cpp | 126 +++++++++++------- 2 files changed, 93 insertions(+), 45 deletions(-) create mode 100644 data/sql/updates/pending_db_world/hellfire-channeler-does-action-on-mag.sql diff --git a/data/sql/updates/pending_db_world/hellfire-channeler-does-action-on-mag.sql b/data/sql/updates/pending_db_world/hellfire-channeler-does-action-on-mag.sql new file mode 100644 index 000000000..aee6f56c7 --- /dev/null +++ b/data/sql/updates/pending_db_world/hellfire-channeler-does-action-on-mag.sql @@ -0,0 +1,12 @@ +-- +DELETE FROM `smart_scripts` WHERE `entryorguid` = 17256 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`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17256, 0, 0, 0, 0, 0, 100, 0, 20900, 28200, 12100, 19400, 0, 11, 30510, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hellfire Channeler - In Combat - Cast \'Shadow Bolt Volley\''), +(17256, 0, 1, 0, 74, 0, 100, 0, 0, 50, 14500, 15000, 30, 11, 30528, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Hellfire Channeler - On Friendly Between 0-50% Health - Cast \'Dark Mending\''), +(17256, 0, 2, 0, 0, 0, 100, 0, 6000, 12000, 17000, 28000, 0, 11, 30530, 0, 0, 0, 0, 0, 6, 30, 0, 0, 0, 0, 0, 0, 0, 'Hellfire Channeler - In Combat - Cast \'Fear\''), +(17256, 0, 3, 0, 0, 0, 100, 0, 19650, 63350, 60000, 60000, 0, 11, 30511, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 'Hellfire Channeler - In Combat - Cast \'Burning Abyssal\''), +(17256, 0, 4, 0, 1, 0, 100, 0, 3600, 3600, 3600, 3600, 0, 11, 30207, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hellfire Channeler - Out of Combat - Cast \'Shadow Grasp\''), +(17256, 0, 5, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 11, 30531, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hellfire Channeler - On Just Died - Cast \'Soul Transfer\''), +(17256, 0, 6, 0, 6, 0, 100, 512, 0, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 0, 10, 91254, 17257, 0, 0, 0, 0, 0, 0, 'Hellfire Channeler - On Just Died - Do Action on Magtheridon'), +(17256, 0, 7, 0, 4, 0, 100, 512, 0, 0, 0, 0, 0, 34, 10, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hellfire Channeler - On Aggro - Set Instance Data 10 to 1'), +(17256, 0, 8, 0, 25, 0, 100, 512, 0, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hellfire Channeler - On Reset - Set Reactstate Defensive'); diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index d537d9a50..45db5585b 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -59,7 +59,13 @@ enum Spells enum Groups { - GROUP_INTERRUPT_CHECK = 0 + GROUP_INTERRUPT_CHECK = 0, + GROUP_EARLY_RELEASE_CHECK = 1 +}; + +enum Actions +{ + ACTION_INCREASE_HELLFIRE_CHANNELER_DEATH_COUNT = 1 }; class DealDebrisDamage : public BasicEvent @@ -92,8 +98,10 @@ struct boss_magtheridon : public BossAI void Reset() override { BossAI::Reset(); + _channelersKilled = 0; _currentPhase = 0; _recentlySpoken = false; + _magReleased = false; _interruptScheduler.CancelAll(); scheduler.Schedule(90s, [this](TaskContext context) { @@ -154,60 +162,86 @@ struct boss_magtheridon : public BossAI BossAI::JustDied(killer); } + void ScheduleCombatEvents() + { + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); + me->SetReactState(REACT_AGGRESSIVE); + instance->SetData(DATA_ACTIVATE_CUBES, 1); + me->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE); + + scheduler.Schedule(9s, [this](TaskContext context) + { + DoCastVictim(SPELL_CLEAVE); + context.Repeat(1200ms, 16300ms); + }).Schedule(20s, [this](TaskContext context) + { + me->CastCustomSpell(SPELL_BLAZE, SPELLVALUE_MAX_TARGETS, 1); + context.Repeat(11s, 39s); + }).Schedule(40s, [this](TaskContext context) + { + DoCastSelf(SPELL_QUAKE); //needs fixes with custom spell + scheduler.Schedule(7s, [this](TaskContext /*context*/) + { + DoCastSelf(SPELL_BLAST_NOVA); + + _interruptScheduler.Schedule(50ms, GROUP_INTERRUPT_CHECK, [this](TaskContext context) + { + if (me->GetAuraCount(SPELL_SHADOW_GRASP_VISUAL) == 5) + { + Talk(SAY_BANISH); + me->InterruptNonMeleeSpells(true); + scheduler.CancelGroup(GROUP_INTERRUPT_CHECK); + } + else + context.Repeat(50ms); + }).Schedule(12s, GROUP_INTERRUPT_CHECK, [this](TaskContext /*context*/) + { + _interruptScheduler.CancelGroup(GROUP_INTERRUPT_CHECK); + }); + }); + context.Repeat(53s, 56s); + }).Schedule(22min, [this](TaskContext /*context*/) + { + DoCastSelf(SPELL_BERSERK, true); + }); + } + + void DoAction(int32 action) override + { + if (action == ACTION_INCREASE_HELLFIRE_CHANNELER_DEATH_COUNT) + { + _channelersKilled++; + + if (_channelersKilled >= 5 && !_magReleased) + { + Talk(SAY_EMOTE_FREE); + Talk(SAY_FREE); + scheduler.CancelGroup(GROUP_EARLY_RELEASE_CHECK); //cancel regular countdown + scheduler.Schedule(3s, [this](TaskContext) + { + _magReleased = true; //redundancy + ScheduleCombatEvents(); + }); + } + } + } + void JustEngagedWith(Unit* who) override { BossAI::JustEngagedWith(who); Talk(SAY_EMOTE_BEGIN); - scheduler.Schedule(60s, [this](TaskContext /*context*/) + scheduler.Schedule(60s, GROUP_EARLY_RELEASE_CHECK, [this](TaskContext /*context*/) { Talk(SAY_EMOTE_NEARLY); - }).Schedule(120s, [this](TaskContext /*context*/) + }).Schedule(120s, GROUP_EARLY_RELEASE_CHECK, [this](TaskContext /*context*/) { Talk(SAY_EMOTE_FREE); - }).Schedule(123s, [this](TaskContext /*context*/) + Talk(SAY_FREE); + }).Schedule(123s, GROUP_EARLY_RELEASE_CHECK, [this](TaskContext /*context*/) { - me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); - me->SetImmuneToPC(false); - me->SetReactState(REACT_AGGRESSIVE); - instance->SetData(DATA_ACTIVATE_CUBES, 1); - me->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE); - - scheduler.Schedule(9s, [this](TaskContext context) - { - DoCastVictim(SPELL_CLEAVE); - context.Repeat(1200ms, 16300ms); - }).Schedule(20s, [this](TaskContext context) - { - me->CastCustomSpell(SPELL_BLAZE, SPELLVALUE_MAX_TARGETS, 1); - context.Repeat(11s, 39s); - }).Schedule(40s, [this](TaskContext context) - { - DoCastSelf(SPELL_QUAKE); //needs fixes with custom spell - scheduler.Schedule(7s, [this](TaskContext /*context*/) - { - DoCastSelf(SPELL_BLAST_NOVA); - - _interruptScheduler.Schedule(50ms, GROUP_INTERRUPT_CHECK, [this](TaskContext context) - { - if (me->GetAuraCount(SPELL_SHADOW_GRASP_VISUAL) == 5) - { - Talk(SAY_BANISH); - me->InterruptNonMeleeSpells(true); - scheduler.CancelGroup(GROUP_INTERRUPT_CHECK); - } - else - context.Repeat(50ms); - }).Schedule(12s, GROUP_INTERRUPT_CHECK, [this](TaskContext /*context*/) - { - _interruptScheduler.CancelGroup(GROUP_INTERRUPT_CHECK); - }); - }); - context.Repeat(53s, 56s); - }).Schedule(1320s, [this](TaskContext /*context*/) - { - DoCastSelf(SPELL_BERSERK, true); - }); + ScheduleCombatEvents(); }); } @@ -227,7 +261,9 @@ struct boss_magtheridon : public BossAI private: bool _recentlySpoken; + bool _magReleased; uint8 _currentPhase; + uint8 _channelersKilled; TaskScheduler _interruptScheduler; };