Turn-based fighting

I’m working on an RPG game similar to the Final Fantasy series and I still need to learn how to create the battle system. I already know how to do character controled actions, but I need help making the enemy do random attacks and causing random damage. Any help will be appreciated.