MCPcopy Create free account
hub / github.com/diasurgical/devilution / TryDisarm

Function TryDisarm

Source/objects.cpp:2776–2804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2774}
2775
2776void TryDisarm(int pnum, int i)
2777{
2778 int j, oi, oti, trapdisper;
2779 BOOL checkflag;
2780
2781 if (pnum == myplr)
2782 SetCursor_(CURSOR_HAND);
2783 if (object[i]._oTrapFlag) {
2784 trapdisper = 2 * plr[pnum]._pDexterity - 5 * currlevel;
2785 if (random_(154, 100) <= trapdisper) {
2786 for (j = 0; j < nobjects; j++) {
2787 checkflag = FALSE;
2788 oi = objectactive[j];
2789 oti = object[oi]._otype;
2790 if (oti == OBJ_TRAPL)
2791 checkflag = TRUE;
2792 if (oti == OBJ_TRAPR)
2793 checkflag = TRUE;
2794 if (checkflag && dObject[object[oi]._oVar1][object[oi]._oVar2] - 1 == i) {
2795 object[oi]._oVar4 = 1;
2796 object[i]._oTrapFlag = FALSE;
2797 }
2798 }
2799 oti = object[i]._otype;
2800 if (oti >= OBJ_TCHEST1 && oti <= OBJ_TCHEST3)
2801 object[i]._oTrapFlag = FALSE;
2802 }
2803 }
2804}
2805
2806int ItemMiscIdIdx(int imiscid)
2807{

Callers 1

CheckNewPathFunction · 0.85

Calls 2

SetCursor_Function · 0.85
random_Function · 0.85

Tested by

no test coverage detected