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.
This commit is contained in:
Viste(Кирилл)
2019-03-14 15:21:31 +03:00
committed by GitHub
parent 26ae2ce2d6
commit 2e65c0afb7
+8 -3
View File
@@ -821,13 +821,18 @@ class spell_sha_fire_nova : public SpellScriptLoader
SpellCastResult CheckFireTotem() SpellCastResult CheckFireTotem()
{ {
// fire totem // 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); SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_HAVE_FIRE_TOTEM);
return SPELL_FAILED_CUSTOM_ERROR; return SPELL_FAILED_CUSTOM_ERROR;
} }
return SPELL_CAST_OK;
} }
void HandleDummy(SpellEffIndex /*effIndex*/) void HandleDummy(SpellEffIndex /*effIndex*/)