battle function in main()