| 2013 | } |
| 2014 | |
| 2015 | int |
| 2016 | dosearch0(int aflag) /* intrinsic autosearch vs explicit searching */ |
| 2017 | { |
| 2018 | coordxy x, y; |
| 2019 | struct trap *trap; |
| 2020 | struct monst *mtmp; |
| 2021 | |
| 2022 | if (u.uswallow) { |
| 2023 | if (!aflag) |
| 2024 | Norep("What are you looking for? The exit?"); |
| 2025 | } else { |
| 2026 | int fund = (uwep && uwep->oartifact |
| 2027 | && spec_ability(uwep, SPFX_SEARCH)) ? uwep->spe : 0; |
| 2028 | |
| 2029 | if (ublindf && ublindf->otyp == LENSES && !Blind) |
| 2030 | fund += 2; /* JDS: lenses help searching */ |
| 2031 | if (fund > 5) |
| 2032 | fund = 5; |
| 2033 | for (x = u.ux - 1; x < u.ux + 2; x++) |
| 2034 | for (y = u.uy - 1; y < u.uy + 2; y++) { |
| 2035 | if (!isok(x, y)) |
| 2036 | continue; |
| 2037 | if (u_at(x, y)) |
| 2038 | continue; |
| 2039 | |
| 2040 | if (!aflag && (Blind || visible_region_at(x, y))) |
| 2041 | feel_location(x, y); |
| 2042 | if (levl[x][y].typ == SDOOR) { |
| 2043 | if (rnl(7 - fund)) |
| 2044 | continue; |
| 2045 | cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */ |
| 2046 | recalc_block_point(x, y); |
| 2047 | exercise(A_WIS, TRUE); |
| 2048 | nomul(0); |
| 2049 | feel_location(x, y); /* make sure it shows up */ |
| 2050 | set_msg_xy(x, y); |
| 2051 | You("find a hidden door."); |
| 2052 | } else if (levl[x][y].typ == SCORR) { |
| 2053 | if (rnl(7 - fund)) |
| 2054 | continue; |
| 2055 | levl[x][y].typ = CORR; |
| 2056 | unblock_point(x, y); /* vision */ |
| 2057 | exercise(A_WIS, TRUE); |
| 2058 | nomul(0); |
| 2059 | feel_newsym(x, y); /* make sure it shows up */ |
| 2060 | set_msg_xy(x, y); |
| 2061 | You("find a hidden passage."); |
| 2062 | } else { |
| 2063 | /* Be careful not to find anything in an SCORR or SDOOR */ |
| 2064 | if ((mtmp = m_at(x, y)) != 0 && !aflag) { |
| 2065 | int mfres = mfind0(mtmp, 0); |
| 2066 | |
| 2067 | if (mfres == -1) |
| 2068 | continue; |
| 2069 | else if (mfres > 0) |
| 2070 | return mfres; |
| 2071 | } |
| 2072 |
no test coverage detected