At the start and every time you defeat an enemy, you are given exp. Use these to increase health, attack power or healing power. I would recommend increasing attack power as otherwise the enemy is likely to attempt to heal what you just did, which will make it last a very long time. After all your exp is gone you and the enemy take turns to either attack or heal. It is completely random what the enemy does. When the enemy's health is 0 you are given 2 exp and the enemy is given 1. When your health is 0 you are given 1 exp and the enemy is given 2.
I found this project sitting in my unshared projects and decided to fix it then share it. I'd appreciate it if someone told me all the bugs with it so I can repair it. Not at all complete. I'd be more likely to use it as an engine in games than doing anything with it as it is, though, and that would fix all the issues I have with it.