added attack function