From 2e65c0afb7bb7caaacae3c684a9f6eed3c976165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viste=28=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=29?= Date: Thu, 14 Mar 2019 15:21:31 +0300 Subject: [PATCH] Fix(Scripts/Spells): Check range to fire totem when casting Fire Nova. (#1566) * Fix(Scripts/Spells): Check range to fire totem when casting Fire Nova. --- src/server/scripts/Spells/spell_shaman.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index bc9b2a01a..3c0641ba1 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -821,13 +821,18 @@ class spell_sha_fire_nova : public SpellScriptLoader SpellCastResult CheckFireTotem() { // fire totem - if (!GetCaster()->m_SummonSlot[1]) + Unit* caster = GetCaster(); + if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1])) + { + if (!caster->IsWithinDistInMap(totem, caster->GetSpellMaxRangeForTarget(totem, GetSpellInfo()))) + return SPELL_FAILED_OUT_OF_RANGE; + return SPELL_CAST_OK; + } + else { SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_HAVE_FIRE_TOTEM); return SPELL_FAILED_CUSTOM_ERROR; } - - return SPELL_CAST_OK; } void HandleDummy(SpellEffIndex /*effIndex*/)