Check out my game Golden Sun Apocalypse, it has turned based battles. (
viewtopic.php?f=4&t=7677 )
What you basically have to do is create a giant loop, with a LOT of timers, and a LOT of "chain" reactions, and 1 variable keeps track of what stage of the battle your in, like "choose move" mode, or fight mode. I could give a big explanation, but it would take too long.