MCPcopy Create free account
hub / github.com/NetHack/NetHack / really_kick_object

Function really_kick_object

src/dokick.c:507–790  ·  view source on GitHub ↗

guts of kick_object */

Source from the content-addressed store, hash-verified

505
506/* guts of kick_object */
507staticfn int
508really_kick_object(coordxy x, coordxy y)
509{
510 int range;
511 struct monst *mon, *shkp = 0;
512 struct trap *trap;
513 char bhitroom;
514 boolean costly, isgold, slide = FALSE;
515
516 /* gk.kickedobj should always be set due to conditions of call */
517 if (!gk.kickedobj || gk.kickedobj->otyp == BOULDER
518 || gk.kickedobj == uball || gk.kickedobj == uchain)
519 return 0;
520
521 if ((trap = t_at(x, y)) != 0) {
522 if ((is_pit(trap->ttyp) && !Passes_walls) || trap->ttyp == WEB) {
523 if (!trap->tseen)
524 find_trap(trap);
525 You_cant("kick %s that's in a %s!", something,
526 Hallucination ? "tizzy"
527 : (trap->ttyp == WEB) ? "web"
528 : "pit");
529 return 1;
530 }
531 if (trap->ttyp == STATUE_TRAP) {
532 activate_statue_trap(trap, x, y, FALSE);
533 return 1;
534 }
535 }
536
537 if (Fumbling && !rn2(3)) {
538 Your("clumsy kick missed.");
539 return 1;
540 }
541
542 if (!uarmf && gk.kickedobj->otyp == CORPSE
543 && touch_petrifies(&mons[gk.kickedobj->corpsenm])
544 && !Stone_resistance) {
545 You("kick %s with your bare %s.",
546 corpse_xname(gk.kickedobj, (const char *) 0, CXN_PFX_THE),
547 makeplural(body_part(FOOT)));
548 if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
549 ; /* hero has been transformed but kick continues */
550 } else {
551 /* normalize body shape here; foot, not body_part(FOOT) */
552 Sprintf(svk.killer.name, "kicking %s barefoot",
553 killer_xname(gk.kickedobj));
554 instapetrify(svk.killer.name);
555 }
556 }
557
558 isgold = (gk.kickedobj->oclass == COIN_CLASS);
559 {
560 int k_owt = (int) gk.kickedobj->owt;
561
562 /* for non-gold stack, 1 item will be split off below (unless an
563 early return occurs, so we aren't moving the split to here);
564 calculate the range for that 1 rather than for the whole stack */

Callers 1

kick_objectFunction · 0.85

Calls 15

t_atFunction · 0.85
find_trapFunction · 0.85
You_cantFunction · 0.85
activate_statue_trapFunction · 0.85
rn2Function · 0.85
YourFunction · 0.85
YouFunction · 0.85
corpse_xnameFunction · 0.85
makepluralFunction · 0.85
body_partFunction · 0.85
poly_when_stonedFunction · 0.85
polymonFunction · 0.85

Tested by

no test coverage detected