| 2933 | } |
| 2934 | |
| 2935 | void ArmorDur(int pnum) |
| 2936 | { |
| 2937 | int a; |
| 2938 | ItemStruct *pi; |
| 2939 | PlayerStruct *p; |
| 2940 | |
| 2941 | if (pnum != myplr) { |
| 2942 | return; |
| 2943 | } |
| 2944 | |
| 2945 | if ((DWORD)pnum >= MAX_PLRS) { |
| 2946 | app_fatal("ArmorDur: illegal player %d", pnum); |
| 2947 | } |
| 2948 | |
| 2949 | p = &plr[pnum]; |
| 2950 | if (p->InvBody[INVLOC_CHEST]._itype == ITYPE_NONE && p->InvBody[INVLOC_HEAD]._itype == ITYPE_NONE) { |
| 2951 | return; |
| 2952 | } |
| 2953 | |
| 2954 | a = random_(8, 3); |
| 2955 | if (p->InvBody[INVLOC_CHEST]._itype != ITYPE_NONE && p->InvBody[INVLOC_HEAD]._itype == ITYPE_NONE) { |
| 2956 | a = 1; |
| 2957 | } |
| 2958 | if (p->InvBody[INVLOC_CHEST]._itype == ITYPE_NONE && p->InvBody[INVLOC_HEAD]._itype != ITYPE_NONE) { |
| 2959 | a = 0; |
| 2960 | } |
| 2961 | |
| 2962 | if (a != 0) { |
| 2963 | pi = &p->InvBody[INVLOC_CHEST]; |
| 2964 | } else { |
| 2965 | pi = &p->InvBody[INVLOC_HEAD]; |
| 2966 | } |
| 2967 | if (pi->_iDurability == DUR_INDESTRUCTIBLE) { |
| 2968 | return; |
| 2969 | } |
| 2970 | |
| 2971 | pi->_iDurability--; |
| 2972 | if (pi->_iDurability != 0) { |
| 2973 | return; |
| 2974 | } |
| 2975 | |
| 2976 | if (a != 0) { |
| 2977 | NetSendCmdDelItem(TRUE, INVLOC_CHEST); |
| 2978 | } else { |
| 2979 | NetSendCmdDelItem(TRUE, INVLOC_HEAD); |
| 2980 | } |
| 2981 | pi->_itype = ITYPE_NONE; |
| 2982 | CalcPlrInv(pnum, TRUE); |
| 2983 | } |
| 2984 | |
| 2985 | BOOL PM_DoDeath(int pnum) |
| 2986 | { |
no test coverage detected