| 911 | } |
| 912 | |
| 913 | staticfn int |
| 914 | peffect_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 | |
| 954 | staticfn int |
| 955 | peffect_object_detection(struct obj *otmp) |
no test coverage detected