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

Function see_nearby_monsters

src/mon.c:6024–6053  ·  view source on GitHub ↗

mark a monster type as seen close-up when we see it next to us */

Source from the content-addressed store, hash-verified

6022
6023/* mark a monster type as seen close-up when we see it next to us */
6024void
6025see_nearby_monsters(void)
6026{
6027 struct monst *mtmp;
6028 int mndx;
6029 coordxy x, y;
6030
6031 if (Hallucination || (Blind && !Blind_telepat))
6032 return;
6033
6034 for (x = u.ux - 1; x <= u.ux + 1; x++)
6035 for (y = u.uy - 1; y <= u.uy + 1; y++) {
6036 if (!isok(x, y))
6037 continue;
6038 if (!(mtmp = m_at(x, y)))
6039 continue;
6040 mndx = monsndx(mtmp->data);
6041 if (M_AP_TYPE(mtmp) == M_AP_MONSTER)
6042 mndx = mtmp->mappearance;
6043 /* skip closeup handling if this mon type has already been done */
6044 if (svm.mvitals[mndx].seen_close)
6045 continue;
6046 /* disguised mimics pass canseemon(); undetected hiders don't */
6047 if (canseemon(mtmp) || (mtmp->mundetected && sensemon(mtmp))) {
6048 gb.bhitpos.x = x, gb.bhitpos.y = y;
6049 gn.notonhead = (x != mtmp->mx || y != mtmp->my);
6050 see_monster_closeup(mtmp, FALSE);
6051 }
6052 }
6053}
6054
6055/* monster resists something.
6056 make a shield effect at monster's location and give a message */

Callers 1

allmain.cFile · 0.85

Calls 4

isokFunction · 0.85
canseemonFunction · 0.85
sensemonFunction · 0.85
see_monster_closeupFunction · 0.85

Tested by

no test coverage detected