If I had time I would have coded a sequence to check the number of enemies so that the last like 5-10 always dropped enough gold but I ran out of time. Sorry about the error!
Definitely a good thing to work from if you continue with the game! Has some potential with more time than 48 hours