rolled attacking nearest into a function to allow for future reuse