MCPcopy Index your code
hub / github.com/NetHack/NetHack / disarm_box

Function disarm_box

src/trap.c:5793–5817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5791}
5792
5793staticfn void
5794disarm_box(struct obj *box, boolean force, boolean confused)
5795{
5796 if (box->otrapped) {
5797 int ch = ACURR(A_DEX) + u.ulevel;
5798
5799 if (Role_if(PM_ROGUE))
5800 ch *= 2;
5801 if (!force && (confused || Fumbling
5802 || rnd(75 + level_difficulty() / 2) > ch)) {
5803 (void) chest_trap(box, FINGER, TRUE);
5804 /* 'box' might be gone now */
5805 } else {
5806 You("disarm it!");
5807 box->otrapped = 0;
5808 box->tknown = 1;
5809 more_experienced(8, 0);
5810 newexplevel();
5811 }
5812 exercise(A_DEX, TRUE);
5813 } else {
5814 pline("That %s was not trapped.", xname(box));
5815 box->tknown = 0;
5816 }
5817}
5818
5819/* check a particular container for a trap and optionally disarm it */
5820staticfn void

Callers 2

untrap_boxFunction · 0.85
untrapFunction · 0.85

Calls 9

rndFunction · 0.85
level_difficultyFunction · 0.85
chest_trapFunction · 0.85
YouFunction · 0.85
more_experiencedFunction · 0.85
newexplevelFunction · 0.85
exerciseFunction · 0.85
xnameFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected