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

Function fracture_rock

src/zap.c:5536–5578  ·  view source on GitHub ↗

fractured by pick-axe or wand of striking or by vault guard or shopkeeper */

Source from the content-addressed store, hash-verified

5534
5535/* fractured by pick-axe or wand of striking or by vault guard or shopkeeper */
5536void
5537fracture_rock(struct obj *obj) /* no texts here! */
5538{
5539 coordxy x, y;
5540 boolean by_you = !svc.context.mon_moving;
5541
5542 if (by_you && get_obj_location(obj, &x, &y, 0) && costly_spot(x, y)) {
5543 struct monst *shkp = 0;
5544 char objroom = *in_rooms(x, y, SHOPBASE);
5545
5546 if (billable(&shkp, obj, objroom, FALSE)) {
5547 /* shop message says "you owe <shk> <$> for it!" so we need
5548 to precede that with a message explaining what "it" is */
5549 You("fracture %s %s.", s_suffix(shkname(shkp)), xname(obj));
5550 /* breakobj won't destroy fracturing statue or boulder but
5551 will charge for shop goods */
5552 (void) breakobj(obj, x, y, TRUE, FALSE);
5553 }
5554 }
5555 if (by_you && obj->otyp == BOULDER)
5556 sokoban_guilt();
5557
5558 obj->otyp = ROCK;
5559 obj->oclass = GEM_CLASS;
5560 obj->quan = (long) rn1(60, 7);
5561 obj->owt = weight(obj);
5562 obj->dknown = obj->bknown = obj->rknown = 0;
5563 obj->known = objects[obj->otyp].oc_uses_known ? 0 : 1;
5564 dealloc_oextra(obj);
5565
5566 if (obj->where == OBJ_FLOOR) {
5567 obj_extract_self(obj); /* move rocks back on top */
5568 place_object(obj, obj->ox, obj->oy);
5569 if (!does_block(obj->ox, obj->oy, &levl[obj->ox][obj->oy])) {
5570 unblock_point(obj->ox, obj->oy);
5571 /* need immediate update in case this is a striking/force bolt
5572 zap that is about hit more things */
5573 vision_recalc(0);
5574 }
5575 if (cansee(obj->ox, obj->oy))
5576 newsym(obj->ox, obj->oy);
5577 }
5578}
5579
5580/* handle statue hit by striking/force bolt/pick-axe */
5581boolean

Callers 9

digFunction · 0.85
invaultFunction · 0.85
launch_objFunction · 0.85
poly_objFunction · 0.85
bhitoFunction · 0.85
break_statueFunction · 0.85
m_break_boulderFunction · 0.85
mkinvposFunction · 0.85
scatterFunction · 0.85

Calls 15

get_obj_locationFunction · 0.85
costly_spotFunction · 0.85
in_roomsFunction · 0.85
billableFunction · 0.85
YouFunction · 0.85
s_suffixFunction · 0.85
shknameFunction · 0.85
xnameFunction · 0.85
breakobjFunction · 0.85
sokoban_guiltFunction · 0.85
weightFunction · 0.85
dealloc_oextraFunction · 0.85

Tested by

no test coverage detected