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

Function domove_bump_mon

src/hack.c:1924–1948  ·  view source on GitHub ↗

moving with 'm' prefix, bump into a monster? */

Source from the content-addressed store, hash-verified

1922
1923/* moving with 'm' prefix, bump into a monster? */
1924staticfn boolean
1925domove_bump_mon(struct monst *mtmp, int glyph)
1926{
1927 /* If they used a 'm' command, trying to move onto a monster
1928 * prints the below message and wastes a turn. The exception is
1929 * if the monster is unseen and the player doesn't remember an
1930 * invisible monster--then, we fall through to do_attack() and
1931 * attack_check(), which still wastes a turn, but prints a
1932 * different message and makes the player remember the monster.
1933 */
1934 if (svc.context.nopick && !svc.context.travel
1935 && (canspotmon(mtmp) || glyph_is_invisible(glyph)
1936 || glyph_is_warning(glyph))) {
1937 if (M_AP_TYPE(mtmp) && !Protection_from_shape_changers
1938 && !sensemon(mtmp))
1939 stumble_onto_mimic(mtmp);
1940 else if (mtmp->mpeaceful && !Hallucination)
1941 /* m_monnam(): "dog" or "Fido", no "invisible dog" or "it" */
1942 pline("Pardon me, %s.", m_monnam(mtmp));
1943 else
1944 You("move right into %s.", mon_nam(mtmp));
1945 return TRUE;
1946 }
1947 return FALSE;
1948}
1949
1950/* hero is moving, do we maybe attack a monster at (x,y)?
1951 returns TRUE if hero movement is used up.

Callers 1

domove_coreFunction · 0.85

Calls 6

sensemonFunction · 0.85
stumble_onto_mimicFunction · 0.85
m_monnamFunction · 0.85
YouFunction · 0.85
mon_namFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected