latest code for battle