Split battle code into separate functions.