Chosen Solution

Do i need to replace my power supply or is it just the battery

The PRAM will keep your mac from booting and I have heard of instances where it can charge long enough to boot then shut the machine down but I find that instance hard to believe. I would check the power supply out for a bulging capacitor. Something that once its warmed up will cause a thermal issue and fail . this is more likely the case but that said the PRAM battery is a cheap fix and if its not the problem your not out much money for a wrong answer. Have you opened the mac to know what your diagnostic lights are doing when it fails? Hope this helps