MCPcopy Create free account
hub / github.com/NetHack/NetHack / hide_monst

Function hide_monst

src/mon.c:4805–4826  ·  view source on GitHub ↗

called when returning to a previously visited level */

Source from the content-addressed store, hash-verified

4803
4804/* called when returning to a previously visited level */
4805void
4806hide_monst(struct monst *mon)
4807{
4808 boolean hider_under = hides_under(mon->data) || mon->data->mlet == S_EEL;
4809
4810 if ((is_hider(mon->data) || hider_under)
4811 && !(mon->mundetected || M_AP_TYPE(mon))) {
4812 coordxy x = mon->mx, y = mon->my;
4813 char save_viz = gv.viz_array[y][x];
4814
4815 /* override vision, forcing hero to be unable to see monster's spot */
4816 gv.viz_array[y][x] &= ~(IN_SIGHT | COULD_SEE);
4817 if (is_hider(mon->data))
4818 (void) restrap(mon);
4819 /* try again if mimic missed its 1/3 chance to hide */
4820 if (mon->data->mlet == S_MIMIC && !M_AP_TYPE(mon))
4821 (void) restrap(mon);
4822 gv.viz_array[y][x] = save_viz;
4823 if (hider_under)
4824 (void) hideunder(mon);
4825 }
4826}
4827
4828void
4829mon_animal_list(boolean construct)

Callers 1

getlevFunction · 0.85

Calls 2

restrapFunction · 0.85
hideunderFunction · 0.85

Tested by

no test coverage detected