The power going off does not damage your computer but may corrupt data if being written to a HDD at the time.
It is the power coming back on that can cause damage as there is usually a strong surge as it happens.
The minimum protection you need is a surge protector or unplug the PC when the power goes off and then plug it in again when it is restored.