write tests for battle, and correct the battle logic