debugging energy depletion function