Modified repair method to not allow repair to go over HPMax value.