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

Function zap_dig

src/dig.c:1547–1754  ·  view source on GitHub ↗

digging via wand zap or spell cast */

Source from the content-addressed store, hash-verified

1545
1546/* digging via wand zap or spell cast */
1547void
1548zap_dig(void)
1549{
1550 struct rm *room;
1551 struct monst *mtmp;
1552 struct obj *otmp;
1553 struct trap *trap_with_u = (struct trap *) 0;
1554 coordxy zx, zy, flow_x = -1, flow_y = -1;
1555 int diridx = 8, digdepth;
1556 boolean shopdoor, shopwall, maze_dig, pitdig = FALSE, pitflow = FALSE;
1557
1558 /*
1559 * Original effect (approximately):
1560 * from CORR: dig until we pierce a wall
1561 * from ROOM: pierce wall and dig until we reach
1562 * an ACCESSIBLE place.
1563 * Currently: dig for digdepth positions;
1564 * also down on request of Lennart Augustsson.
1565 * 3.6.0: from a PIT: dig one adjacent pit.
1566 */
1567
1568 if (u.uswallow) {
1569 mtmp = u.ustuck;
1570
1571 if (!is_whirly(mtmp->data)) {
1572 if (digests(mtmp->data))
1573 You("pierce %s %s wall!", s_suffix(mon_nam(mtmp)),
1574 mbodypart(mtmp, STOMACH));
1575 if (unique_corpstat(mtmp->data))
1576 mtmp->mhp = (mtmp->mhp + 1) / 2;
1577 else
1578 mtmp->mhp = 1; /* almost dead */
1579 expels(mtmp, mtmp->data, !digests(mtmp->data));
1580 }
1581 return;
1582 } /* swallowed */
1583
1584 if (u.dz) {
1585 if (!Is_airlevel(&u.uz) && !Is_waterlevel(&u.uz) && !Underwater) {
1586 if (u.dz < 0 || On_stairs(u.ux, u.uy)) {
1587 int dmg;
1588 if (On_stairs(u.ux, u.uy)) {
1589 stairway *stway = stairway_at(u.ux, u.uy);
1590 pline_The("beam bounces off the %s and hits the %s.",
1591 stway->isladder ? "ladder" : "stairs",
1592 ceiling(u.ux, u.uy));
1593 }
1594 You("loosen a rock from the %s.", ceiling(u.ux, u.uy));
1595 pline("It falls on your %s!", body_part(HEAD));
1596 dmg = rnd(hard_helmet(uarmh) ? 2 : 6);
1597 losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN);
1598 otmp = mksobj_at(ROCK, u.ux, u.uy, FALSE, FALSE);
1599 if (otmp) {
1600 (void) xname(otmp); /* set dknown, maybe bknown */
1601 stackobj(otmp);
1602 }
1603 newsym(u.ux, u.uy);
1604 } else {

Callers 1

weffectsFunction · 0.85

Calls 15

YouFunction · 0.85
s_suffixFunction · 0.85
mon_namFunction · 0.85
mbodypartFunction · 0.85
expelsFunction · 0.85
On_stairsFunction · 0.85
stairway_atFunction · 0.85
pline_TheFunction · 0.85
ceilingFunction · 0.85
body_partFunction · 0.85
rndFunction · 0.85
hard_helmetFunction · 0.85

Tested by

no test coverage detected