something like lookaround, but we are not running */ react only to monsters that might hit us */
| 4103 | /* something like lookaround, but we are not running */ |
| 4104 | /* react only to monsters that might hit us */ |
| 4105 | int |
| 4106 | monster_nearby(void) |
| 4107 | { |
| 4108 | coordxy x, y; |
| 4109 | struct monst *mtmp; |
| 4110 | |
| 4111 | /* Also see the similar check in dochugw() in monmove.c */ |
| 4112 | for (x = u.ux - 1; x <= u.ux + 1; x++) |
| 4113 | for (y = u.uy - 1; y <= u.uy + 1; y++) { |
| 4114 | if (!isok(x, y) || u_at(x, y)) |
| 4115 | continue; |
| 4116 | if ((mtmp = m_at(x, y)) != 0 |
| 4117 | && M_AP_TYPE(mtmp) != M_AP_FURNITURE |
| 4118 | && M_AP_TYPE(mtmp) != M_AP_OBJECT |
| 4119 | && (Hallucination |
| 4120 | || (!mtmp->mpeaceful && !noattacks(mtmp->data))) |
| 4121 | && (!is_hider(mtmp->data) || !mtmp->mundetected) |
| 4122 | && !helpless(mtmp) |
| 4123 | && !onscary(u.ux, u.uy, mtmp) && canspotmon(mtmp)) |
| 4124 | return 1; |
| 4125 | } |
| 4126 | return 0; |
| 4127 | } |
| 4128 | |
| 4129 | void |
| 4130 | end_running(boolean and_travel) |
no test coverage detected