MRKR: use_pick_axe() is split in two to allow autodig to bypass */ the "In what direction do you want to dig?" query. */ use_pick_axe2() uses the existing u.dx, u.dy and u.dz */
| 1159 | /* the "In what direction do you want to dig?" query. */ |
| 1160 | /* use_pick_axe2() uses the existing u.dx, u.dy and u.dz */ |
| 1161 | int |
| 1162 | use_pick_axe2(struct obj *obj) |
| 1163 | { |
| 1164 | coordxy rx, ry; |
| 1165 | struct rm *lev; |
| 1166 | struct trap *trap, *trap_with_u; |
| 1167 | int dig_target; |
| 1168 | boolean ispick = is_pick(obj); |
| 1169 | const char *verbing = ispick ? "digging" : "chopping"; |
| 1170 | |
| 1171 | if (u.uswallow && do_attack(u.ustuck)) { |
| 1172 | ; /* return 1 */ |
| 1173 | } else if (Underwater) { |
| 1174 | pline("Turbulence torpedoes your %s attempts.", verbing); |
| 1175 | } else if (u.dz < 0) { |
| 1176 | if (Levitation) |
| 1177 | You("don't have enough leverage."); |
| 1178 | else |
| 1179 | You_cant("reach the %s.", ceiling(u.ux, u.uy)); |
| 1180 | } else if (!u.dx && !u.dy && !u.dz) { |
| 1181 | char buf[BUFSZ]; |
| 1182 | int dam; |
| 1183 | |
| 1184 | dam = rnd(2) + dbon() + obj->spe; |
| 1185 | if (dam <= 0) |
| 1186 | dam = 1; |
| 1187 | You("hit yourself with %s.", yname(uwep)); |
| 1188 | Sprintf(buf, "%s own %s", uhis(), OBJ_NAME(objects[obj->otyp])); |
| 1189 | losehp(Maybe_Half_Phys(dam), buf, KILLED_BY); |
| 1190 | disp.botl = TRUE; |
| 1191 | return ECMD_TIME; |
| 1192 | } else if (u.dz == 0) { |
| 1193 | confdir(FALSE); |
| 1194 | rx = u.ux + u.dx; |
| 1195 | ry = u.uy + u.dy; |
| 1196 | if (!isok(rx, ry)) { |
| 1197 | Soundeffect(se_clash, 40); |
| 1198 | pline("Clash!"); |
| 1199 | return ECMD_TIME; |
| 1200 | } |
| 1201 | lev = &levl[rx][ry]; |
| 1202 | if (MON_AT(rx, ry) && do_attack(m_at(rx, ry))) |
| 1203 | return ECMD_TIME; |
| 1204 | dig_target = dig_typ(obj, rx, ry); |
| 1205 | if (dig_target == DIGTYP_UNDIGGABLE) { |
| 1206 | struct obj *boulder; |
| 1207 | |
| 1208 | /* ACCESSIBLE or POOL */ |
| 1209 | trap = t_at(rx, ry); |
| 1210 | if (trap && trap->ttyp == WEB) { |
| 1211 | if (!trap->tseen) { |
| 1212 | seetrap(trap); |
| 1213 | There("is a spider web there!"); |
| 1214 | } |
| 1215 | pline("%s entangled in the web.", Yobjnam2(obj, "become")); |
| 1216 | /* you ought to be able to let go; tough luck */ |
| 1217 | /* (maybe `move_into_trap()' would be better) */ |
| 1218 | nomul(-d(2, 2)); |