For the distance, put false at the spell option "Check if is good distance" and add condition type "C Sharp Code" with the code
Lua.LuaDoString<bool>("return IsActionInRange(" + (SpellManager.GetSpellSlotId(SpellListManager.SpellIdByName("Auto Shot")) + 1) + ")")
(of course, replace Auto Shot by your spell name in english, this code in implemented here).