Computer keeps turning off randomly
It has happened at least 5 times in the last two weeks. Randomly, when I am using my computer it will go black (off, absolutely no backlight) and then no matter what I press, type, or move it will take 10-20 seconds to turn on and it will have everything the way I had it. It has happened at 54%, 30%, 20%, 12%, and 9% battery so it's not a thing of the battery running out cuz there is no way the number was that off that it was really at 5% when it showed 54%. I shut it off, thinking maybe it had been on for too long but that didn't seem to make a difference (usually shut it off once a week). The battery wasn't hot either, like at all.
I am coder, my computer is on all day working with codes and all the times it has happened it hasn't been running anything so the load it had was minimum (safari with a few tabs open and some text files open in sublime). I know I over use my computer but I don't have another computer to run the codes, sometimes they do ask too much of my computer and the fans go crazy but I haven't run a code like that in a few weeks now. I also have installed Mac fans controls to keep my computer cool because it would melt if I let it be with the original settings when running the codes, but if that software did anything to my hardware I would assume it would be to the fans and not the battery.
I have had my computer for around 2 and a half years, the system report says it has had 1028 battery cycles and says condition "normal". Is there anyway I can check myself for a cause? I can't really be without a computer while they check it out so if I can pin point a cause myself would be the best scenario. Also, in what kind of situation would I require to change the battery? and which one would allow me to keep using it until things become too annoying?
I have MacOS Mojave 10.14.6
Thanks!
MacBook Pro 13″, macOS 10.14