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

Function shkcatch

src/shk.c:4361–4396  ·  view source on GitHub ↗

shk catches thrown pick-axe */

Source from the content-addressed store, hash-verified

4359
4360/* shk catches thrown pick-axe */
4361struct monst *
4362shkcatch(
4363 struct obj *obj,
4364 coordxy x, coordxy y)
4365{
4366 struct monst *shkp;
4367
4368 shkp = shop_keeper(inside_shop(x, y));
4369 if (!shkp || !inhishop(shkp))
4370 return 0;
4371
4372 if (!helpless(shkp)
4373 && (*u.ushops != ESHK(shkp)->shoproom || !inside_shop(u.ux, u.uy))
4374 && dist2(shkp->mx, shkp->my, x, y) < 3
4375 /* if it is the shk's pos, you hit and anger him */
4376 && (shkp->mx != x || shkp->my != y)) {
4377 if (mnearto(shkp, x, y, TRUE, RLOC_NOMSG) == 2
4378 && !Deaf && !muteshk(shkp)) {
4379 SetVoice(shkp, 0, 80, 0);
4380 verbalize("Out of my way, scum!");
4381 }
4382 if (cansee(x, y)) {
4383 pline("%s nimbly%s catches %s.", Shknam(shkp),
4384 (x == shkp->mx && y == shkp->my) ? "" : " reaches over and",
4385 the(xname(obj)));
4386 if (!canspotmon(shkp))
4387 map_invisible(x, y);
4388 nh_delay_output();
4389 mark_synch();
4390 }
4391 subfrombill(obj, shkp);
4392 (void) mpickobj(shkp, obj);
4393 return shkp;
4394 }
4395 return (struct monst *) 0;
4396}
4397
4398void
4399add_damage(

Callers 1

bhitFunction · 0.85

Calls 13

shop_keeperFunction · 0.85
inside_shopFunction · 0.85
inhishopFunction · 0.85
dist2Function · 0.85
mneartoFunction · 0.85
verbalizeFunction · 0.85
ShknamFunction · 0.85
theFunction · 0.85
xnameFunction · 0.85
map_invisibleFunction · 0.85
subfrombillFunction · 0.85
mpickobjFunction · 0.85

Tested by

no test coverage detected