add do_attack() and refactor