They are designed for war. They have to assume that it will be hit at some point - you still want it to return as many of the highly trained people on board back home as possible. If you can repair it so much the better. They can't always meet this goal (the enemy goal is to make that impossible), but it is a design goal of any reasonable navy.