| 1962 | } |
| 1963 | |
| 1964 | staticfn int |
| 1965 | mfind0(struct monst *mtmp, boolean via_warning) |
| 1966 | { |
| 1967 | coordxy x = mtmp->mx, y = mtmp->my; |
| 1968 | boolean found_something = FALSE; |
| 1969 | |
| 1970 | if (via_warning && !warning_of(mtmp)) |
| 1971 | return -1; |
| 1972 | |
| 1973 | if (M_AP_TYPE(mtmp)) { |
| 1974 | seemimic(mtmp); |
| 1975 | found_something = TRUE; |
| 1976 | } else { |
| 1977 | /* this used to only be executed if a !canspotmon() test passed |
| 1978 | but that failed to bring sensed monsters out of hiding */ |
| 1979 | found_something = !canspotmon(mtmp); |
| 1980 | if (mtmp->mundetected && (is_hider(mtmp->data) |
| 1981 | || hides_under(mtmp->data) |
| 1982 | || mtmp->data->mlet == S_EEL)) { |
| 1983 | if (via_warning && found_something) { |
| 1984 | set_msg_xy(x, y); |
| 1985 | Your("danger sense causes you to take a second %s.", |
| 1986 | Blind ? "to check nearby" : "look close by"); |
| 1987 | display_nhwindow(WIN_MESSAGE, FALSE); /* flush messages */ |
| 1988 | } |
| 1989 | mtmp->mundetected = 0; |
| 1990 | found_something = TRUE; |
| 1991 | } |
| 1992 | newsym(x, y); |
| 1993 | } |
| 1994 | |
| 1995 | if (found_something) { |
| 1996 | if (!canspotmon(mtmp) && glyph_is_invisible(levl[x][y].glyph)) |
| 1997 | return -1; /* Found invisible monster in square which already has |
| 1998 | * 'I' in it. Logically, this should still take time |
| 1999 | * and lead to `return 1', but if we did that the hero |
| 2000 | * would keep finding the same monster every turn. */ |
| 2001 | exercise(A_WIS, TRUE); |
| 2002 | if (!canspotmon(mtmp)) { |
| 2003 | map_invisible(x, y); |
| 2004 | set_msg_xy(x, y); |
| 2005 | You_feel("an unseen monster!"); |
| 2006 | } else if (!sensemon(mtmp)) { |
| 2007 | set_msg_xy(x, y); |
| 2008 | You("find %s.", mtmp->mtame ? y_monnam(mtmp) : a_monnam(mtmp)); |
| 2009 | } |
| 2010 | return 1; |
| 2011 | } |
| 2012 | return 0; |
| 2013 | } |
| 2014 | |
| 2015 | int |
| 2016 | dosearch0(int aflag) /* intrinsic autosearch vs explicit searching */ |
no test coverage detected