check a particular container for a trap and optionally disarm it */
| 5818 | |
| 5819 | /* check a particular container for a trap and optionally disarm it */ |
| 5820 | staticfn void |
| 5821 | untrap_box( |
| 5822 | struct obj *box, |
| 5823 | boolean force, |
| 5824 | boolean confused) |
| 5825 | { |
| 5826 | if ((box->otrapped |
| 5827 | && (force || (!confused && rn2(MAXULEV + 1 - u.ulevel) < 10))) |
| 5828 | || box->tknown |
| 5829 | || (!force && confused && !rn2(3))) { |
| 5830 | if (!(box->tknown && box->dknown)) |
| 5831 | You("find a trap on %s!", the(xname(box))); |
| 5832 | else |
| 5833 | pline("There's a trap on %s.", the(xname(box))); |
| 5834 | box->tknown = 1; |
| 5835 | observe_object(box); |
| 5836 | if (!confused) |
| 5837 | exercise(A_WIS, TRUE); |
| 5838 | |
| 5839 | if (ynq("Disarm it?") == 'y') |
| 5840 | disarm_box(box, force, confused); |
| 5841 | } else { |
| 5842 | You("find no traps on %s.", the(xname(box))); |
| 5843 | } |
| 5844 | } |
| 5845 | |
| 5846 | /* hero is able to attempt untrap, so do so */ |
| 5847 | int |
no test coverage detected