From bb953328ee8c4d6a628327ae98731f79c713de24 Mon Sep 17 00:00:00 2001 From: Treeston Date: Wed, 29 Aug 2018 13:50:58 +0200 Subject: Scripts/Spells: Check range to fire totem when casting Fire Nova. Closes #22303. --- src/server/scripts/Spells/spell_shaman.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index e4519b03404..bb75f535ce9 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -614,14 +614,19 @@ class spell_sha_fire_nova : public SpellScriptLoader SpellCastResult CheckFireTotem() { + Unit* caster = GetCaster(); // fire totem - if (!GetCaster()->m_SummonSlot[1]) + 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*/) -- cgit v1.2.3