| 2952 | } |
| 2953 | |
| 2954 | int |
| 2955 | use_whip(struct obj *obj) |
| 2956 | { |
| 2957 | char buf[BUFSZ]; |
| 2958 | struct monst *mtmp; |
| 2959 | struct obj *otmp; |
| 2960 | int rx, ry, proficient, res = ECMD_OK; |
| 2961 | const char *msg_slipsfree = "The bullwhip slips free."; |
| 2962 | const char *msg_snap = "Snap!"; |
| 2963 | |
| 2964 | if (obj != uwep) { |
| 2965 | if (wield_tool(obj, "lash")) { |
| 2966 | cmdq_add_ec(CQ_CANNED, doapply); |
| 2967 | cmdq_add_key(CQ_CANNED, obj->invlet); |
| 2968 | return ECMD_TIME; |
| 2969 | } |
| 2970 | return ECMD_OK; |
| 2971 | } |
| 2972 | if (!getdir((char *) 0)) |
| 2973 | return (res|ECMD_CANCEL); |
| 2974 | |
| 2975 | if (u.uswallow) { |
| 2976 | mtmp = u.ustuck; |
| 2977 | rx = mtmp->mx; |
| 2978 | ry = mtmp->my; |
| 2979 | } else { |
| 2980 | confdir(FALSE); |
| 2981 | rx = u.ux + u.dx; |
| 2982 | ry = u.uy + u.dy; |
| 2983 | if (!isok(rx, ry)) { |
| 2984 | You("miss."); |
| 2985 | return res; |
| 2986 | } |
| 2987 | mtmp = m_at(rx, ry); |
| 2988 | } |
| 2989 | |
| 2990 | /* fake some proficiency checks */ |
| 2991 | proficient = 0; |
| 2992 | if (Role_if(PM_ARCHEOLOGIST)) |
| 2993 | ++proficient; |
| 2994 | if (ACURR(A_DEX) < 6) |
| 2995 | proficient--; |
| 2996 | else if (ACURR(A_DEX) >= 14) |
| 2997 | proficient += (ACURR(A_DEX) - 14); |
| 2998 | if (Fumbling) |
| 2999 | --proficient; |
| 3000 | if (proficient > 3) |
| 3001 | proficient = 3; |
| 3002 | if (proficient < 0) |
| 3003 | proficient = 0; |
| 3004 | |
| 3005 | if (u.uswallow) { |
| 3006 | There("is not enough room to flick your bullwhip."); |
| 3007 | |
| 3008 | } else if (Underwater) { |
| 3009 | There("is too much resistance to flick your bullwhip."); |
| 3010 | |
| 3011 | } else if (u.dz < 0) { |
no test coverage detected