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

Function peffect_monster_detection

src/potion.c:913–952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911}
912
913staticfn int
914peffect_monster_detection(struct obj *otmp)
915{
916 if (otmp->blessed) {
917 int i, x, y;
918
919 if (Detect_monsters)
920 gp.potion_nothing++;
921 gp.potion_unkn++;
922 /* after a while, repeated uses become less effective */
923 if ((HDetect_monsters & TIMEOUT) >= 300L)
924 i = 1;
925 else if (otmp->oclass == SPBOOK_CLASS)
926 i = rn1(40, 21);
927 else /* potion */
928 i = rn2(100) + 100;
929 incr_itimeout(&HDetect_monsters, i);
930 for (x = 1; x < COLNO; x++) {
931 for (y = 0; y < ROWNO; y++) {
932 if (levl[x][y].glyph == GLYPH_INVISIBLE) {
933 unmap_object(x, y);
934 newsym(x, y);
935 }
936 if (MON_AT(x, y))
937 gp.potion_unkn = 0;
938 }
939 }
940 /* if swallowed or underwater, fall through to uncursed case */
941 if (!u.uswallow && !Underwater) {
942 see_monsters();
943 if (gp.potion_unkn)
944 You_feel("lonely.");
945 return 0;
946 }
947 }
948 if (monster_detect(otmp, 0))
949 return 1; /* nothing detected */
950 exercise(A_WIS, TRUE);
951 return 0;
952}
953
954staticfn int
955peffect_object_detection(struct obj *otmp)

Callers 1

peffectsFunction · 0.85

Calls 8

rn2Function · 0.85
incr_itimeoutFunction · 0.85
unmap_objectFunction · 0.85
newsymFunction · 0.85
see_monstersFunction · 0.85
You_feelFunction · 0.85
monster_detectFunction · 0.85
exerciseFunction · 0.85

Tested by

no test coverage detected