From e020c3ac5e276f91af57a7c4b2bde43883dabc4f Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 13 Mar 2021 18:12:14 +0100 Subject: [PATCH] Scripts/Deepholm: scripted Xariona world boss --- .../world/4.3.4/2021_03_13_01_world.sql | 11 + src/server/game/Spells/SpellMgr.cpp | 6 + .../Maelstrom/maelstrom_script_loader.cpp | 2 + .../scripts/Maelstrom/zone_deepholm.cpp | 190 ++++++++++++++++++ 4 files changed, 209 insertions(+) create mode 100644 sql/updates/world/4.3.4/2021_03_13_01_world.sql create mode 100644 src/server/scripts/Maelstrom/zone_deepholm.cpp diff --git a/sql/updates/world/4.3.4/2021_03_13_01_world.sql b/sql/updates/world/4.3.4/2021_03_13_01_world.sql new file mode 100644 index 00000000000..a964c288776 --- /dev/null +++ b/sql/updates/world/4.3.4/2021_03_13_01_world.sql @@ -0,0 +1,11 @@ +UPDATE `creature_template` SET `unit_flags`= 0x40 | 0x8000, `unit_flags2`= 0x800 | 0x400000, `VehicleId`= 1543, `mechanic_immune_mask`= 650854271, `flags_extra`= 0x40000000, `ScriptName`= 'npc_deepholm_xariona' WHERE `entry`= 50061; +UPDATE `creature_addon` SET `auras`= '', `bytes1`= 50331648 WHERE `guid`= 396407; +UPDATE `creature_template` SET `flags_extra`= 128, `AIName`= 'NullCreatureAI' WHERE `entry`= 50431; + +UPDATE `creature_template_movement` SET `Ground`= 2 WHERE `CreatureId`= 50061; + +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_deepholm_twilight_buffet_targeting'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(95385, 'spell_deepholm_twilight_buffet_targeting'); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index f37aedd29c8..dfe87892175 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -5776,6 +5776,12 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->Effects[EFFECT_0].SpellClassMask[1] = 0; }); + // Zero Power + ApplySpellFix({ 87239 }, [](SpellInfo* spellInfo) + { + spellInfo->Effects[EFFECT_1].MiscValue = 3; + }); + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo* spellInfo = mSpellInfoMap[i]; diff --git a/src/server/scripts/Maelstrom/maelstrom_script_loader.cpp b/src/server/scripts/Maelstrom/maelstrom_script_loader.cpp index 463efc0d9f6..2ec7cf98344 100644 --- a/src/server/scripts/Maelstrom/maelstrom_script_loader.cpp +++ b/src/server/scripts/Maelstrom/maelstrom_script_loader.cpp @@ -17,6 +17,7 @@ // This is where scripts' loading functions should be declared: void AddSC_kezan(); +void AddSC_deepholm(); void AddSC_instance_stonecore(); // Stonecore void AddSC_stonecore(); void AddSC_boss_corborus(); @@ -29,6 +30,7 @@ void AddSC_boss_high_priestess_azil(); void AddMaelstromScripts() { AddSC_kezan(); + AddSC_deepholm(); AddSC_instance_stonecore(); // Stonecore AddSC_stonecore(); AddSC_boss_corborus(); diff --git a/src/server/scripts/Maelstrom/zone_deepholm.cpp b/src/server/scripts/Maelstrom/zone_deepholm.cpp new file mode 100644 index 00000000000..b43370bd123 --- /dev/null +++ b/src/server/scripts/Maelstrom/zone_deepholm.cpp @@ -0,0 +1,190 @@ +/* +* 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 "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" + +enum Xariona +{ + // Events + EVENT_FURY_OF_THE_TWILIGHT_FLIGHT = 1, + EVENT_TWILIGHT_BREATH, + EVENT_TWILIGHT_BUFFET, + EVENT_UNLEASHED_MAGIC, + EVENT_TWILIGHT_FISSURE, + EVENT_TWILIGHT_ZONE, + + // Spells + SPELL_ZERO_POWER = 87239, + SPELL_ROGUE_CLASS_CRIT_DODGE_DEBUFF = 73059, + SPELL_FURY_OF_THE_TWILIGHT_FLIGHT = 93554, + SPELL_TWILIGHT_BREATH = 93544, + SPELL_TWILIGHT_BUFFET_TARGETING = 95385, + SPELL_UNLEASHED_MAGIC = 93556, + SPELL_TWILIGHT_FISSURE = 93546, + SPELL_VOID_BLAST = 93545, + SPELL_TWILIGHT_ZONE = 93553, + + // Creatures + NPC_TWILIGHT_FISSURE = 50431, +}; + +struct npc_deepholm_xariona : public ScriptedAI +{ + npc_deepholm_xariona(Creature* creature) : ScriptedAI(creature), _furyOfTheTwilightFlightCount(0) + { + me->SetPowerType(POWER_ENERGY); + me->SetMaxPower(POWER_ENERGY, 100); + } + + void JustEnteredCombat(Unit* /*who*/) override + { + me->SetHomePosition(me->GetPosition()); + } + + void JustAppeared() override + { + DoCastSelf(SPELL_ZERO_POWER); + DoCastSelf(SPELL_ROGUE_CLASS_CRIT_DODGE_DEBUFF); + } + + void JustEngagedWith(Unit* who) override + { + _events.ScheduleEvent(EVENT_FURY_OF_THE_TWILIGHT_FLIGHT, 1s); + _events.ScheduleEvent(EVENT_TWILIGHT_BREATH, 14s); + _events.ScheduleEvent(EVENT_TWILIGHT_BUFFET, 13s); + _events.ScheduleEvent(EVENT_TWILIGHT_FISSURE, 29s); + _events.ScheduleEvent(EVENT_TWILIGHT_ZONE, 31s); + } + + void JustSummoned(Creature* summon) override + { + switch (summon->GetEntry()) + { + case NPC_TWILIGHT_FISSURE: + summon->m_Events.AddEventAtOffset([summon]() + { + summon->CastSpell(summon, SPELL_VOID_BLAST); + summon->DespawnOrUnsummon(4s); + }, 4s); // Tooltip states 5 seconds but sniffs say 4 + break; + default: + break; + } + } + + void EnterEvadeMode(EvadeReason /*why*/) override + { + me->DespawnOrUnsummon(0s, 30s); + } + + 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_FURY_OF_THE_TWILIGHT_FLIGHT: + DoCastSelf(SPELL_FURY_OF_THE_TWILIGHT_FLIGHT); + ++_furyOfTheTwilightFlightCount; + if (_furyOfTheTwilightFlightCount < 2) + _events.Repeat(30s + 500ms); + else + _events.ScheduleEvent(EVENT_UNLEASHED_MAGIC, 32s); + break; + case EVENT_TWILIGHT_BREATH: + DoCastVictim(SPELL_TWILIGHT_BREATH); + _events.Repeat(18s, 20s); + break; + case EVENT_TWILIGHT_BUFFET: + DoCastAOE(SPELL_TWILIGHT_BUFFET_TARGETING, CastSpellExtraArgs().AddSpellMod(SPELLVALUE_MAX_TARGETS, 1)); + _events.Repeat(23s, 25s); + break; + case EVENT_UNLEASHED_MAGIC: + DoCastAOE(SPELL_UNLEASHED_MAGIC); + _furyOfTheTwilightFlightCount = 0; + _events.DelayEvents(5s); + _events.ScheduleEvent(EVENT_FURY_OF_THE_TWILIGHT_FLIGHT, 1ms); + break; + case EVENT_TWILIGHT_FISSURE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.f, true)) + DoCast(target, SPELL_TWILIGHT_FISSURE); + _events.Repeat(29s); + break; + case EVENT_TWILIGHT_ZONE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 55.f, true)) + DoCast(target, SPELL_TWILIGHT_ZONE); + _events.Repeat(31s); + break; + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + + DoMeleeAttackIfReady(); + } + +private: + EventMap _events; + uint8 _furyOfTheTwilightFlightCount; +}; + +// 95385 - Twilight Buffet Targeting +class spell_deepholm_twilight_buffet_targeting : public SpellScript +{ + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + // Xariona never hits her current victim with Twilight Buffed + targets.remove_if([&](WorldObject* target) + { + return GetCaster()->GetVictim() == target; + }); + } + + void HandleDummyEffect(SpellEffIndex effIndex) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(GetHitUnit(), GetSpellInfo()->Effects[effIndex].BasePoints, true); + } + + void Register() override + { + OnObjectAreaTargetSelect.Register(&spell_deepholm_twilight_buffet_targeting::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnEffectHitTarget.Register(&spell_deepholm_twilight_buffet_targeting::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +void AddSC_deepholm() +{ + RegisterCreatureAI(npc_deepholm_xariona); + RegisterSpellScript(spell_deepholm_twilight_buffet_targeting); +}