String Distance

Jelly, 11 8 bytes

OIæ%13AS

Saved 3 bytes thanks to @Martin Ender.

Try it online! or Verify all test cases.

Explanation

OIæ%13AS  Input: string Z
O         Ordinal. Convert each char in Z to its ASCII value
 I        Increments. Find the difference between each pair of values
  æ%13    Symmetric mod. Maps each to the interval (-13, 13]
      A   Absolute value of each
       S  Sum
          Return implicitly

Haskell, 57 56 bytes

q=map$(-)13.abs
sum.q.q.(zipWith(-)=<<tail).map fromEnum

Usage example: sum.q.q.(zipWith(-)=<<tail).map fromEnum $ "valleys" -> 35.

How it works:

q=map$(-)13.abs                -- helper function.
                               -- Non-pointfree: q l = map (\e -> 13 - abs e) l
                               -- foreach element e in list l: subtract the
                               -- absolute value of e from 13

               map fromEnum    -- convert to ascii values
      zipWith(-)=<<tail        -- build differences of neighbor elements
  q.q                          -- apply q twice on every element
sum                            -- sum it up

Edit: @Damien saved one byte. Thanks!


MATL, 14, 10 bytes

dt_v26\X<s

Try it online!

Thanks @Suever for saving 4 bytes!

Explanation:

d           % Take the difference between consecutive characters
 t_         % Make a copy of this array, and take the negative of each element
   v        % Join these two arrays together into a matrix with height 2
    26\     % Mod 26 of each element
       X<   % Grab the minimum of each column
         s  % Sum these. Implicitly print

Previous version:

d26\t13>26*-|s