Am I missing something or don't you actually want something like this
&& !xIS_SET(ch->act, ACT_SENTINEL)
&& !xIS_SET(ch->act, ACT_PROTOTYPE)
&& (door = number_bits(5)) <= 9
&& (pexit = get_exit(ch->in_room, door)) != NULL
&& ( !IS_SET(pexit->exit_info, EX_CLOSED) || (IS_AFFECTED(ch, AFF_PASS_DOOR) && !IS_SET(pexit->exit_info, EX_NOPASSDOOR)) )
&& !IS_SET(pexit->to_room->room_flags, ROOM_NO_MOB)
&& !IS_SET(pexit->to_room->room_flags, ROOM_DEATH)
&& (!xIS_SET(ch->act, ACT_STAY_AREA) || pexit->to_room->area == ch->in_room->area)
Unless I read the original too fast, wouldn't it fail because the door is EX_CLOSED, whether or not they could walk through it?
Note, you might also want to apply this in the subsequent "flee" section, so that mobiles can flee through closed exits as well, which would only seem to make sense if they can wander through it, right?