gamehelp16/thegoldfactory — pull request #1 by Stevie-O (2013-12-17 13:57:43+00:00)
Title: Fix for game slowness after many battles, and "instant death" if new battle starts within 5 seconds of previous one

While waiting to build up my gold and iron bar supplies, I decided to tackle two problems I'd observed with the game:

First, the game seemed to get slower and slower as time went on. I could save my game, then reload the page, and the game would suddenly go much faster!

Second was the acknowledged issue that if, after winning or losing a battle, you started a new one within about 5 seconds, you would immediately die.

The first problem was caused by the timers that show/hide the various battle buttons (skill, health, other potions). I made modifications so that these buttons are not controlled by any timers at all.

The second problem was due to the fact that when the battle ended, the "enemyattack" timers were not cancelled. I resolved this problem by making sure that the timer is aborted when the battle is won or lost.