preliminary checks for dountrap(); also used for autounlock */
| 5255 | |
| 5256 | /* preliminary checks for dountrap(); also used for autounlock */ |
| 5257 | int |
| 5258 | could_untrap(boolean verbosely, boolean check_floor) |
| 5259 | { |
| 5260 | char buf[BUFSZ]; |
| 5261 | |
| 5262 | buf[0] = '\0'; |
| 5263 | if (near_capacity() >= HVY_ENCUMBER) { |
| 5264 | Strcpy(buf, "You're too strained to do that."); |
| 5265 | } else if ((nohands(gy.youmonst.data) && !webmaker(gy.youmonst.data)) |
| 5266 | || !gy.youmonst.data->mmove) { |
| 5267 | Strcpy(buf, "And just how do you expect to do that?"); |
| 5268 | } else if (u.ustuck && sticks(gy.youmonst.data)) { |
| 5269 | Sprintf(buf, "You'll have to let go of %s first.", mon_nam(u.ustuck)); |
| 5270 | } else if (u.ustuck || (welded(uwep) && bimanual(uwep))) { |
| 5271 | Sprintf(buf, "Your %s seem to be too busy for that.", |
| 5272 | makeplural(body_part(HAND))); |
| 5273 | } else if (check_floor && !can_reach_floor(FALSE)) { |
| 5274 | /* only checked here for autounlock of chest/box and that will |
| 5275 | be !verbosely so precise details of the message don't matter */ |
| 5276 | Sprintf(buf, "You can't reach the %s.", surface(u.ux, u.uy)); |
| 5277 | } |
| 5278 | if (buf[0]) { |
| 5279 | if (verbosely) |
| 5280 | pline("%s", buf); |
| 5281 | return 0; |
| 5282 | } |
| 5283 | return 1; |
| 5284 | } |
| 5285 | |
| 5286 | /* Probability of disabling a trap. Helge Hafting; |
| 5287 | Returns 0 for success, non-0 for failure. */ |
no test coverage detected