Added dedicated math functions; can no longer attack NPCs without line of sight