add attack function