From e01ec7533e740ba9affcf94772695bf524e8e6a2 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Sat, 27 Aug 2022 09:46:06 -0300 Subject: [PATCH] =?UTF-8?q?fix(Scripts/TempleOfAhnQiraj):=20Princess=20Huh?= =?UTF-8?q?uran's=20Poison=20Bolts=20should=E2=80=A6=20(#12861)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(Scripts/TempleOfAhnQiraj): Princess Huhuran's Poison Bolts should hit the closest targets --- .../rev_1661569695988798600.sql | 4 ++++ .../TempleOfAhnQiraj/boss_huhuran.cpp | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1661569695988798600.sql diff --git a/data/sql/updates/pending_db_world/rev_1661569695988798600.sql b/data/sql/updates/pending_db_world/rev_1661569695988798600.sql new file mode 100644 index 000000000..4f51be928 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1661569695988798600.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_huhuran_poison_bolt'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(26052, 'spell_huhuran_poison_bolt'); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp index 75959e85a..2f3dffc3e 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp @@ -148,8 +148,30 @@ class spell_huhuran_wyvern_sting : public AuraScript } }; +// 26052 - Poison Bolt +class spell_huhuran_poison_bolt : public SpellScript +{ + PrepareSpellScript(spell_huhuran_poison_bolt); + + void FilterTargets(std::list& targets) + { + uint32 const maxTargets = GetSpellInfo()->MaxAffectedTargets; + if (targets.size() > maxTargets) + { + targets.sort(Acore::ObjectDistanceOrderPred(GetCaster())); + targets.resize(maxTargets); + } + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_huhuran_poison_bolt::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } +}; + void AddSC_boss_huhuran() { RegisterTempleOfAhnQirajCreatureAI(boss_huhuran); RegisterSpellScript(spell_huhuran_wyvern_sting); + RegisterSpellScript(spell_huhuran_poison_bolt); }