Macbook Pro 2012 shutsdown suddenly at 25% battery
Every battery in a MacBook has a battery processor, which, from time to time, should be recalibrated. Like this:
1. Fully charge your Mac
2. Use it until it dies
3. Once dead, wait at least 5 hours, no less, then plug it in and charge it to 100%, without using it.

The battery percentage reading on your Mac should now be more accurate.

If this doesn't fix it, don't but a new MacBook or give away this one, your MacBook just needs a new battery.