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

Function dokick

src/dokick.c:1256–1470  ·  view source on GitHub ↗

the #kick command */

Source from the content-addressed store, hash-verified

1254
1255/* the #kick command */
1256int
1257dokick(void)
1258{
1259 coordxy x, y;
1260 int avrg_attrib;
1261 int glyph, oldglyph = -1;
1262 struct monst *mtmp;
1263 boolean no_kick = FALSE;
1264
1265 if (nolimbs(gy.youmonst.data) || slithy(gy.youmonst.data)) {
1266 You("have no legs to kick with.");
1267 no_kick = TRUE;
1268 } else if (verysmall(gy.youmonst.data)) {
1269 You("are too small to do any kicking.");
1270 no_kick = TRUE;
1271 } else if (u.usteed) {
1272 if (yn_function("Kick your steed?", ynchars, 'y', TRUE) == 'y') {
1273 You("kick %s.", mon_nam(u.usteed));
1274 kick_steed();
1275 return ECMD_TIME;
1276 } else {
1277 return ECMD_OK;
1278 }
1279 } else if (Wounded_legs) {
1280 legs_in_no_shape("kicking", FALSE);
1281 no_kick = TRUE;
1282 } else if (near_capacity() > SLT_ENCUMBER) {
1283 Your("load is too heavy to balance yourself for a kick.");
1284 no_kick = TRUE;
1285 } else if (gy.youmonst.data->mlet == S_LIZARD) {
1286 Your("legs cannot kick effectively.");
1287 no_kick = TRUE;
1288 } else if (u.uinwater && !rn2(2)) {
1289 Your("slow motion kick doesn't hit anything.");
1290 no_kick = TRUE;
1291 } else if (u.utrap) {
1292 no_kick = TRUE;
1293 switch (u.utraptype) {
1294 case TT_PIT:
1295 if (!Passes_walls)
1296 pline("There's not enough room to kick down here.");
1297 else
1298 no_kick = FALSE;
1299 break;
1300 case TT_WEB:
1301 case TT_BEARTRAP:
1302 You_cant("move your %s!", body_part(LEG));
1303 break;
1304 default:
1305 break;
1306 }
1307 } else if (sobj_at(BOULDER, u.ux, u.uy) && !Passes_walls) {
1308 pline("There's not enough room to kick in here.");
1309 no_kick = TRUE;
1310 }
1311
1312 if (no_kick) {
1313 /* ignore direction typed before player notices kick failed */

Callers

nothing calls this directly

Calls 15

YouFunction · 0.85
yn_functionFunction · 0.85
mon_namFunction · 0.85
kick_steedFunction · 0.85
legs_in_no_shapeFunction · 0.85
near_capacityFunction · 0.85
YourFunction · 0.85
rn2Function · 0.85
You_cantFunction · 0.85
body_partFunction · 0.85
sobj_atFunction · 0.85
getdirFunction · 0.85

Tested by

no test coverage detected