Okay, I think I've finally got this working right. What it should do now is pick the first enemy in the list that doesn't have the "Doesn't Count As Beatable Enemy" flag checked.