Refactor battle.rb