There was recently a post about modifying the 'run' algorithm to avoid running into immobile monsters like molds. I had a look at the algorithm and one just needs to add the following to run_test() before it goes into the part where it looks for an open area. I've tested it and it seems to work well.
Code:
/* Look at every soon to be newly adjacent square. */ for (i = -max; i <= max; i++) { /* New direction */ new_dir = cycle[chome[prev_dir] + i]; /* New location */ row = py + ddy[prev_dir] + ddy[new_dir]; col = px + ddx[prev_dir] + ddx[new_dir]; /* Visible immovable monsters abort running */ if (cave_m_idx[row][col] > 0) { monster_type *m_ptr = &mon_list[cave_m_idx[row][col]]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Visible monster */ if (m_ptr->ml && (r_ptr->flags1 & (RF1_NEVER_MOVE))) return (TRUE); } }
Comment