--[[
    Script Name    : Spells/Scout/Predator/Ranger/HiddenShot.lua
    Script Author  : neatz09
    Script Date    : 2019.10.06 10:10:03
    Script Purpose : 
                   : 
--]]



function precast(Caster, Target)
    -- You must be sneaking to use this ability.
    if IsStealthed(Caster) then
        return true
    else
        SendMessage(Caster, "You must be sneaking to use this ability.", "yellow")
        return false
    end
	-- Requires bow
    local item = GetEquippedItemBySlot(Caster, 16)
    if not item or GetItemType(item) ~= 2 then
        -- no item or item is not a ranged item (no way to determine different range items currently)
        return false, 68
    end

    return true
end
-- Inflicts 480 - 800 ranged damage on target
function cast(Caster, Target, DmgType, MinVal, MaxVal)
    if MaxVal ~= nil and MinVal < MaxVal then
        SpellDamage(Target, DmgType, math.random(MinVal, MaxVal))
    else
        SpellDamage(Target, DmgType, MinVal)
    end
end