1 /* NetHack 3.6 dig.c $NHDT-Date: 1449269915 2015/12/04 22:58:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.103 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016 */
8 /* JNetHack may be freely redistributed. See license for details. */
12 static NEARDATA boolean did_dig_msg;
14 STATIC_DCL boolean NDECL(rm_waslit);
15 STATIC_DCL void FDECL(mkcavepos,
16 (XCHAR_P, XCHAR_P, int, BOOLEAN_P, BOOLEAN_P));
17 STATIC_DCL void FDECL(mkcavearea, (BOOLEAN_P));
18 STATIC_DCL int NDECL(dig);
19 STATIC_DCL void FDECL(dig_up_grave, (coord *));
20 STATIC_DCL int FDECL(adj_pit_checks, (coord *, char *));
21 STATIC_DCL void FDECL(pit_flow, (struct trap *, SCHAR_P));
23 /* Indices returned by dig_typ() */
24 #define DIGTYP_UNDIGGABLE 0
26 #define DIGTYP_STATUE 2
27 #define DIGTYP_BOULDER 3
36 if (levl[u.ux][u.uy].typ == ROOM && levl[u.ux][u.uy].waslit)
38 for (x = u.ux - 2; x < u.ux + 3; x++)
39 for (y = u.uy - 1; y < u.uy + 2; y++)
40 if (isok(x, y) && levl[x][y].waslit)
45 /* Change level topology. Messes with vision tables and ignores things like
46 * boulders in the name of a nice effect. Vision will get fixed up again
47 * immediately after the effect is complete.
50 mkcavepos(x, y, dist, waslit, rockit)
53 boolean waslit, rockit;
55 register struct rm *lev;
62 register struct monst *mtmp;
64 if (IS_ROCK(lev->typ))
67 return; /* don't cover the portal */
68 if ((mtmp = m_at(x, y)) != 0) /* make sure crucial monsters survive */
69 if (!passes_walls(mtmp->data))
70 (void) rloc(mtmp, TRUE);
71 } else if (lev->typ == ROOM)
74 unblock_point(x, y); /* make sure vision knows this location is open */
76 /* fake out saved state */
80 lev->lit = (rockit ? FALSE : TRUE);
82 lev->waslit = (rockit ? FALSE : TRUE);
83 lev->horizontal = FALSE;
84 /* short-circuit vision recalc */
85 viz_array[y][x] = (dist < 3) ? (IN_SIGHT | COULD_SEE) : COULD_SEE;
86 lev->typ = (rockit ? STONE : ROOM);
88 impossible("mkcavepos called with dist %d", dist);
94 register boolean rockit;
97 xchar xmin = u.ux, xmax = u.ux;
98 xchar ymin = u.uy, ymax = u.uy;
100 register boolean waslit = rm_waslit();
104 pline("Crash! The ceiling collapses around you!");
106 pline("
\82°
\82°
\82ñ
\81I
\82 \82È
\82½
\82Ì
\82Ü
\82í
\82è
\82Ì
\93V
\88ä
\82ª
\95ö
\82ê
\82½
\81I");
109 pline("A mysterious force %s cave around you!",
110 (levl[u.ux][u.uy].typ == CORR) ? "creates a" : "extends the");
112 pline("
\90_
\94é
\93I
\82È
\97Í
\82É
\82æ
\82è
\82 \82È
\82½
\82Ì
\82Ü
\82í
\82è%s
\82½
\81I",
113 (levl[u.ux][u.uy].typ == CORR) ? "
\82É
\93´
\8cA
\82ª
\82Å
\82«" : "
\82Ì
\93´
\8cA
\82ª
\8dL
\82ª
\82Á");
115 display_nhwindow(WIN_MESSAGE, TRUE);
117 for (dist = 1; dist <= 2; dist++) {
122 if (dist < 2) { /* the area is wider that it is high */
125 for (i = xmin + 1; i < xmax; i++) {
126 mkcavepos(i, ymin, dist, waslit, rockit);
127 mkcavepos(i, ymax, dist, waslit, rockit);
132 for (i = ymin; i <= ymax; i++) {
133 mkcavepos(xmin, i, dist, waslit, rockit);
134 mkcavepos(xmax, i, dist, waslit, rockit);
137 flush_screen(1); /* make sure the new glyphs shows up */
141 if (!rockit && levl[u.ux][u.uy].typ == CORR) {
142 levl[u.ux][u.uy].typ = ROOM;
144 levl[u.ux][u.uy].waslit = TRUE;
145 newsym(u.ux, u.uy); /* in case player is invisible */
148 vision_full_recalc = 1; /* everything changed */
151 /* When digging into location <x,y>, what are you actually digging into? */
160 return DIGTYP_UNDIGGABLE;
161 ispick = is_pick(otmp);
162 if (!ispick && !is_axe(otmp))
163 return DIGTYP_UNDIGGABLE;
165 return ((ispick && sobj_at(STATUE, x, y))
167 : (ispick && sobj_at(BOULDER, x, y))
171 : IS_TREE(levl[x][y].typ)
172 ? (ispick ? DIGTYP_UNDIGGABLE : DIGTYP_TREE)
173 : (ispick && IS_ROCK(levl[x][y].typ)
174 && (!level.flags.arboreal
175 || IS_WALL(levl[x][y].typ)))
177 : DIGTYP_UNDIGGABLE);
183 if (occupation == dig) {
189 #define BY_YOU (&youmonst)
190 #define BY_OBJECT ((struct monst *) 0)
193 dig_check(madeby, verbose, x, y)
194 struct monst *madeby;
198 struct trap *ttmp = t_at(x, y);
201 (madeby == BY_YOU && uwep && is_axe(uwep)) ? "chop" : "dig in";
203 (madeby == BY_YOU && uwep && is_axe(uwep)) ? "
\8dÓ
\82¯
\82È
\82¢" : "
\8c@
\82ê
\82È
\82¢";
205 if (On_stairs(x, y)) {
206 if (x == xdnladder || x == xupladder) {
209 pline_The("ladder resists your effort.");
211 pline("
\82Í
\82µ
\82²
\82ª
\8e×
\96\82\82ð
\82µ
\82½
\81D");
214 pline_The("stairs are too hard to %s.", verb);
216 pline("
\8aK
\92i
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä%s
\81D", verb);
218 } else if (IS_THRONE(levl[x][y].typ) && madeby != BY_OBJECT) {
221 pline_The("throne is too hard to break apart.");
223 pline("
\8bÊ
\8dÀ
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä
\8dÓ
\82¯
\82È
\82¢
\81D");
225 } else if (IS_ALTAR(levl[x][y].typ)
226 && (madeby != BY_OBJECT || Is_astralevel(&u.uz)
227 || Is_sanctum(&u.uz))) {
230 pline_The("altar is too hard to break apart.");
232 pline_The("
\8dÕ
\92d
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä
\8dÓ
\82¯
\82È
\82¢
\81D");
234 } else if (Is_airlevel(&u.uz)) {
237 You("cannot %s thin air.", verb);
239 You("
\89½
\82à
\82È
\82¢
\8bó
\8aÔ
\82Í%s
\81D", verb);
241 } else if (Is_waterlevel(&u.uz)) {
244 pline_The("water splashes and subsides.");
246 pline("
\90\85\82ª
\83s
\83V
\83\83\83b
\82Æ
\92µ
\82Ë
\82½
\81D");
248 } else if ((IS_ROCK(levl[x][y].typ) && levl[x][y].typ != SDOOR
249 && (levl[x][y].wall_info & W_NONDIGGABLE) != 0)
251 && (ttmp->ttyp == MAGIC_PORTAL
252 || ttmp->ttyp == VIBRATING_SQUARE
253 || (!Can_dig_down(&u.uz) && !levl[x][y].candig)))) {
256 pline_The("%s here is too hard to %s.", surface(x, y), verb);
258 pline_The("%s
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä%s
\81D", surface(x,y), verb);
260 } else if (sobj_at(BOULDER, x, y)) {
263 There("isn't enough room to %s here.", verb);
265 pline("
\8f\
\95ª
\82È
\8fê
\8f\8a\82ª
\82È
\82¢
\82Ì
\82Å%s
\81D", verb);
267 } else if (madeby == BY_OBJECT
268 /* the block against existing traps is mainly to
269 prevent broken wands from turning holes into pits */
270 && (ttmp || is_pool_or_lava(x, y))) {
271 /* digging by player handles pools separately */
280 register struct rm *lev;
281 register xchar dpx = context.digging.pos.x, dpy = context.digging.pos.y;
282 register boolean ispick = uwep && is_pick(uwep);
284 const char *verb = (!uwep || is_pick(uwep)) ? "dig into" : "chop through";
286 const char *verb = (!uwep || is_pick(uwep)) ? "
\8c@
\82ê
\82È
\82¢" : "
\8dÓ
\82¯
\82È
\82¢";
288 lev = &levl[dpx][dpy];
289 /* perhaps a nymph stole your pick-axe while you were busy digging */
290 /* or perhaps you teleported away */
291 if (u.uswallow || !uwep || (!ispick && !is_axe(uwep))
292 || !on_level(&context.digging.level, &u.uz)
293 || ((context.digging.down ? (dpx != u.ux || dpy != u.uy)
294 : (distu(dpx, dpy) > 2))))
297 if (context.digging.down) {
298 if (!dig_check(BY_YOU, TRUE, u.ux, u.uy))
300 } else { /* !context.digging.down */
301 if (IS_TREE(lev->typ) && !may_dig(dpx, dpy)
302 && dig_typ(uwep, dpx, dpy) == DIGTYP_TREE) {
304 pline("This tree seems to be petrified.");
306 pline("
\82±
\82Ì
\96Ø
\82Í
\90Î
\89»
\82µ
\82Ä
\82¢
\82é
\82æ
\82¤
\82¾
\81D");
309 if (IS_ROCK(lev->typ) && !may_dig(dpx, dpy)
310 && dig_typ(uwep, dpx, dpy) == DIGTYP_ROCK) {
312 pline("This %s is too hard to %s.",
313 is_db_wall(dpx, dpy) ? "drawbridge" : "wall", verb);
315 pline("
\82±
\82Ì%s
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä%s
\81D",
316 is_db_wall(dpx, dpy) ? "
\92µ
\82Ë
\8b´" : "
\95Ç", verb);
321 if (Fumbling && !rn2(3)) {
326 You("fumble and drop %s.", yname(uwep));
328 You("
\8eè
\82ª
\8a\8a\82è%s
\82ð
\97\8e\82µ
\82½
\81D", yname(uwep));
333 pline("%s and %s %s!", Yobjnam2(uwep, "bounce"),
334 otense(uwep, "hit"), mon_nam(u.usteed));
336 pline("%s
\82Í
\92µ
\82Ë
\82©
\82¦
\82è%s
\82É
\96½
\92\86\82µ
\82½
\81I",
337 xname(uwep), mon_nam(u.usteed));
341 pline("Ouch! %s and %s you!", Yobjnam2(uwep, "bounce"),
342 otense(uwep, "hit"));
344 pline("
\82¢
\82Ä
\82Á
\81I%s
\82Í
\92µ
\82Ë
\82©
\82¦
\82è
\82 \82È
\82½
\82É
\96½
\92\86\82µ
\82½
\81I",
347 set_wounded_legs(RIGHT_SIDE, 5 + rnd(5));
352 pline("Bang! You hit with the broad side of %s!",
354 pline("
\83o
\83\93\81I%s
\82Ì
\95¿
\82Å
\91Å
\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½
\81I",
359 Your("swing misses its mark.");
361 You("
\91_
\82¢
\82ð
\92è
\82ß
\82Ä
\90U
\82è
\82¨
\82ë
\82µ
\82½
\82ª
\82Í
\82¸
\82µ
\82½
\81D");
367 context.digging.effort +=
368 10 + rn2(5) + abon() + uwep->spe - greatest_erosion(uwep) + u.udaminc;
369 if (Race_if(PM_DWARF))
370 context.digging.effort *= 2;
371 if (context.digging.down) {
372 struct trap *ttmp = t_at(dpx, dpy);
374 if (context.digging.effort > 250 || (ttmp && ttmp->ttyp == HOLE)) {
375 (void) dighole(FALSE, FALSE, (coord *) 0);
376 (void) memset((genericptr_t) &context.digging, 0,
377 sizeof context.digging);
378 return 0; /* done with digging */
381 if (context.digging.effort <= 50
382 || (ttmp && (ttmp->ttyp == TRAPDOOR || ttmp->ttyp == PIT
383 || ttmp->ttyp == SPIKED_PIT))) {
385 } else if (ttmp && (ttmp->ttyp == LANDMINE
386 || (ttmp->ttyp == BEAR_TRAP && !u.utrap))) {
387 /* digging onto a set object trap triggers it;
388 hero should have used #untrap first */
389 dotrap(ttmp, FORCETRAP);
390 /* restart completely from scratch if we resume digging */
391 (void) memset((genericptr_t) &context.digging, 0,
392 sizeof context.digging);
394 } else if (ttmp && ttmp->ttyp == BEAR_TRAP && u.utrap) {
395 if (rnl(7) > (Fumbling ? 1 : 4)) {
397 int dmg = dmgval(uwep, &youmonst) + dbon();
404 You("hit yourself in the %s.", body_part(FOOT));
406 pline("%s
\82É
\93\96\82½
\82Á
\82½
\81D", body_part(FOOT));
408 Sprintf(kbuf, "chopping off %s own %s", uhis(),
411 Sprintf(kbuf, "
\8e©
\95ª
\82Ì%s
\82ð
\90Ø
\82è
\97\8e\82Æ
\82µ
\82Ä", body_part(FOOT));
413 losehp(Maybe_Half_Phys(dmg), kbuf, KILLED_BY);
416 You("destroy the bear trap with %s.",
417 yobjnam(uwep, (const char *) 0));
419 You("%s
\82Å
\8cF
\82Ìã©
\82ð
\89ó
\82µ
\82½
\81D", xname(uwep));
421 u.utrap = 0; /* release from trap */
424 /* we haven't made any progress toward a pit yet */
425 context.digging.effort = 0;
429 if (IS_ALTAR(lev->typ)) {
430 altar_wrath(dpx, dpy);
434 /* make pit at <u.ux,u.uy> */
435 if (dighole(TRUE, FALSE, (coord *) 0)) {
436 context.digging.level.dnum = 0;
437 context.digging.level.dlevel = -1;
442 if (context.digging.effort > 100) {
443 register const char *digtxt, *dmgtxt = (const char *) 0;
444 register struct obj *obj;
445 register boolean shopedge = *in_rooms(dpx, dpy, SHOPBASE);
447 if ((obj = sobj_at(STATUE, dpx, dpy)) != 0) {
448 if (break_statue(obj))
450 digtxt = "The statue shatters.";
452 digtxt = "
\92¤
\91\9c\82Í
\82±
\82È
\82²
\82È
\82É
\82È
\82Á
\82½
\81D";
454 /* it was a statue trap; break_statue()
455 * printed a message and updated the screen
458 } else if ((obj = sobj_at(BOULDER, dpx, dpy)) != 0) {
462 if ((bobj = sobj_at(BOULDER, dpx, dpy)) != 0) {
463 /* another boulder here, restack it to the top */
464 obj_extract_self(bobj);
465 place_object(bobj, dpx, dpy);
468 digtxt = "The boulder falls apart.";
470 digtxt = "
\8aâ
\82Í
\82±
\82È
\82²
\82È
\82É
\82È
\82Á
\82½
\81D";
471 } else if (lev->typ == STONE || lev->typ == SCORR
472 || IS_TREE(lev->typ)) {
473 if (Is_earthlevel(&u.uz)) {
474 if (uwep->blessed && !rn2(3)) {
477 } else if ((uwep->cursed && !rn2(4))
478 || (!uwep->blessed && !rn2(6))) {
483 if (IS_TREE(lev->typ)) {
485 digtxt = "You cut down the tree.";
487 digtxt = "
\96Ø
\82ð
\90Ø
\82è
\93|
\82µ
\82½
\81D";
490 (void) rnd_treefruit_at(dpx, dpy);
493 digtxt = "You succeed in cutting away some rock.";
495 digtxt = "
\8aâ
\82ð
\8f
\82µ
\90Ø
\82è
\82Æ
\82Á
\82½
\81D";
498 } else if (IS_WALL(lev->typ)) {
500 add_damage(dpx, dpy, 10L * ACURRSTR);
504 dmgtxt = "
\8f\9d\82Â
\82¯
\82é";
506 if (level.flags.is_maze_lev) {
508 } else if (level.flags.is_cavernous_lev && !in_town(dpx, dpy)) {
512 lev->doormask = D_NODOOR;
515 digtxt = "You make an opening in the wall.";
517 digtxt = "
\95Ç
\82É
\8c\8a\82ð
\8bó
\82¯
\82½
\81D";
518 } else if (lev->typ == SDOOR) {
519 cvt_sdoor_to_door(lev); /* ->typ = DOOR */
521 digtxt = "You break through a secret door!";
523 digtxt = "
\94é
\96§
\82Ì
\94à
\82ð
\92Ê
\82è
\94²
\82¯
\82½
\81I";
524 if (!(lev->doormask & D_TRAPPED))
525 lev->doormask = D_BROKEN;
526 } else if (closed_door(dpx, dpy)) {
528 digtxt = "You break through the door.";
530 digtxt = "
\94à
\82ð
\92Ê
\82è
\94²
\82¯
\82½
\81D";
532 add_damage(dpx, dpy, 400L);
538 if (!(lev->doormask & D_TRAPPED))
539 lev->doormask = D_BROKEN;
541 return 0; /* statue or boulder got taken */
543 if (!does_block(dpx, dpy, &levl[dpx][dpy]))
544 unblock_point(dpx, dpy); /* vision: can see through */
545 feel_newsym(dpx, dpy);
546 if (digtxt && !context.digging.quiet)
547 pline1(digtxt); /* after newsym */
549 pay_for_damage(dmgtxt, FALSE);
551 if (Is_earthlevel(&u.uz) && !rn2(3)) {
552 register struct monst *mtmp;
556 mtmp = makemon(&mons[PM_EARTH_ELEMENTAL], dpx, dpy,
560 mtmp = makemon(&mons[PM_XORN], dpx, dpy, NO_MM_FLAGS);
565 pline_The("debris from your digging comes to life!");
567 pline("
\8aâ
\82Ì
\94j
\95Ð
\82ª
\90¶
\96½
\82ð
\91Ñ
\82Ñ
\82½
\81I");
569 if (IS_DOOR(lev->typ) && (lev->doormask & D_TRAPPED)) {
570 lev->doormask = D_NODOOR;
572 b_trapped("door", 0);
574 b_trapped("
\94à", 0);
578 context.digging.lastdigtime = moves;
579 context.digging.quiet = FALSE;
580 context.digging.level.dnum = 0;
581 context.digging.level.dlevel = -1;
583 } else { /* not enough effort has been spent yet */
585 static const char *const d_target[6] = { "", "rock", "statue",
586 "boulder", "door", "tree" };
588 static const char *const d_target[6] = { "", "
\90Î", "
\92¤
\91\9c",
589 "
\8aâ", "
\94à", "
\96Ø" };
591 int dig_target = dig_typ(uwep, dpx, dpy);
593 if (IS_WALL(lev->typ) || dig_target == DIGTYP_DOOR) {
594 if (*in_rooms(dpx, dpy, SHOPBASE)) {
596 pline("This %s seems too hard to %s.",
597 IS_DOOR(lev->typ) ? "door" : "wall", verb);
599 pline("
\82±
\82Ì%s
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä%s
\81D",
600 IS_DOOR(lev->typ) ? "
\94à" : "
\95Ç", verb);
604 } else if (dig_target == DIGTYP_UNDIGGABLE
605 || (dig_target == DIGTYP_ROCK && !IS_ROCK(lev->typ)))
606 return 0; /* statue or boulder got taken */
610 You("hit the %s with all your might.", d_target[dig_target]);
612 You("%s
\82ð
\97Í
\88ê
\94t
\91Å
\82¿
\82Â
\82¯
\82½
\81D", d_target[dig_target]);
619 /* When will hole be finished? Very rough indication used by shopkeeper. */
623 if (occupation != dig || !*u.ushops)
625 return ((250 - context.digging.effort) / 20);
628 /* Return typ of liquid to fill a hole with, or ROOM, if no liquid nearby */
630 fillholetyp(x, y, fill_if_any)
632 boolean fill_if_any; /* force filling if it exists at all */
635 int lo_x = max(1, x - 1), hi_x = min(x + 1, COLNO - 1),
636 lo_y = max(0, y - 1), hi_y = min(y + 1, ROWNO - 1);
637 int pool_cnt = 0, moat_cnt = 0, lava_cnt = 0;
639 for (x1 = lo_x; x1 <= hi_x; x1++)
640 for (y1 = lo_y; y1 <= hi_y; y1++)
643 else if (is_pool(x1, y1))
644 /* This must come after is_moat since moats are pools
645 * but not vice-versa. */
647 else if (is_lava(x1, y1))
651 pool_cnt /= 3; /* not as much liquid as the others */
653 if ((lava_cnt > moat_cnt + pool_cnt && rn2(lava_cnt + 1))
654 || (lava_cnt && fill_if_any))
656 else if ((moat_cnt > 0 && rn2(moat_cnt + 1)) || (moat_cnt && fill_if_any))
658 else if ((pool_cnt > 0 && rn2(pool_cnt + 1)) || (pool_cnt && fill_if_any))
665 digactualhole(x, y, madeby, ttyp)
667 struct monst *madeby;
670 struct obj *oldobjs, *newobjs;
671 register struct trap *ttmp;
672 char surface_type[BUFSZ];
673 struct rm *lev = &levl[x][y];
675 struct monst *mtmp = m_at(x, y); /* may be madeby */
676 boolean madeby_u = (madeby == BY_YOU);
677 boolean madeby_obj = (madeby == BY_OBJECT);
678 boolean at_u = (x == u.ux) && (y == u.uy);
679 boolean wont_fall = Levitation || Flying;
681 if (at_u && u.utrap) {
682 if (u.utraptype == TT_BURIEDBALL)
683 buried_ball_to_punishment();
684 else if (u.utraptype == TT_INFLOOR)
688 /* these furniture checks were in dighole(), but wand
689 breaking bypasses that routine and calls us directly */
690 if (IS_FOUNTAIN(lev->typ)) {
692 SET_FOUNTAIN_WARNED(x, y); /* force dryup */
693 dryup(x, y, madeby_u);
695 } else if (IS_SINK(lev->typ)) {
698 } else if (lev->typ == DRAWBRIDGE_DOWN
699 || (is_drawbridge_wall(x, y) >= 0)) {
701 /* if under the portcullis, the bridge is adjacent */
702 (void) find_drawbridge(&bx, &by);
703 destroy_drawbridge(bx, by);
707 if (ttyp != PIT && (!Can_dig_down(&u.uz) && !lev->candig)) {
708 impossible("digactualhole: can't dig %s on this level.",
709 defsyms[trap_to_defsym(ttyp)].explanation);
713 /* maketrap() might change it, also, in this situation,
714 surface() returns an inappropriate string for a grave */
715 if (IS_GRAVE(lev->typ))
717 Strcpy(surface_type, "grave");
719 Strcpy(surface_type, "
\95æ");
721 Strcpy(surface_type, surface(x, y));
722 shopdoor = IS_DOOR(lev->typ) && *in_rooms(x, y, SHOPBASE);
723 oldobjs = level.objects[x][y];
724 ttmp = maketrap(x, y, ttyp);
727 newobjs = level.objects[x][y];
728 ttmp->madeby_u = madeby_u;
737 if (x != u.ux || y != u.uy)
738 You("dig an adjacent pit.");
741 You("dig a pit in the %s.", surface_type);
743 You("%s
\82É
\97\8e\82µ
\8c\8a\82ð
\8c@
\82Á
\82½
\81D", surface_type);
746 pay_for_damage("ruin", FALSE);
748 pay_for_damage("
\89ó
\82·", FALSE);
749 } else if (!madeby_obj && canseemon(madeby))
751 pline("%s digs a pit in the %s.", Monnam(madeby), surface_type);
753 pline("%s
\82Í%s
\82É
\97\8e\82µ
\8c\8a\82ð
\8c@
\82Á
\82½
\81D", Monnam(madeby), surface_type);
754 else if (cansee(x, y) && flags.verbose)
756 pline("A pit appears in the %s.", surface_type);
758 pline("
\97\8e\82µ
\8c\8a\82ª%s
\82É
\8c»
\82í
\82ê
\82½
\81D", surface_type);
763 u.utraptype = TT_PIT;
764 vision_full_recalc = 1; /* vision limits change */
767 if (oldobjs != newobjs) /* something unearthed */
768 (void) pickup(1); /* detects pit */
770 if (is_flyer(mtmp->data) || is_floater(mtmp->data)) {
773 pline("%s %s over the pit.", Monnam(mtmp),
774 (is_flyer(mtmp->data)) ? "flies" : "floats");
776 pline("%s
\82Í%s
\97\8e\82µ
\8c\8a\82ð
\89z
\82¦
\82½
\81D", Monnam(mtmp),
777 (is_flyer(mtmp->data)) ? "
\94ò
\82ñ
\82Å" : "
\95\82\82¢
\82Ä");
779 } else if (mtmp != madeby)
780 (void) mintrap(mtmp);
782 } else { /* was TRAPDOOR now a HOLE*/
786 You("dig a hole through the %s.", surface_type);
788 You("%s
\82É
\8c\8a\82ð
\8aJ
\82¯
\82½
\81D", surface_type);
789 else if (!madeby_obj && canseemon(madeby))
791 pline("%s digs a hole through the %s.", Monnam(madeby),
794 pline("%s
\82Í%s
\82É
\8c\8a\82ð
\8aJ
\82¯
\82½
\81D", Monnam(madeby),
797 else if (cansee(x, y) && flags.verbose)
799 pline("A hole appears in the %s.", surface_type);
801 pline("%s
\82É
\8c\8a\82ª
\8c»
\82í
\82ê
\82½
\81D", surface_type);
804 if (!u.ustuck && !wont_fall && !next_to_u()) {
806 You("are jerked back by your pet!");
808 You("
\83y
\83b
\83g
\82É
\82æ
\82Á
\82Ä
\88ø
\82«
\96ß
\82³
\82ê
\82½
\81I");
812 /* Floor objects get a chance of falling down. The case where
813 * the hero does NOT fall down is treated here. The case
814 * where the hero does fall down is treated in goto_level().
816 if (u.ustuck || wont_fall) {
818 impact_drop((struct obj *) 0, x, y, 0);
819 if (oldobjs != newobjs)
821 if (shopdoor && madeby_u)
823 pay_for_damage("ruin", FALSE);
825 pay_for_damage("
\82ß
\82¿
\82á
\82ß
\82¿
\82á
\82É
\82·
\82é", FALSE);
830 if (*u.ushops && madeby_u)
831 shopdig(1); /* shk might snatch pack */
832 /* handle earlier damage, eg breaking wand of digging */
835 pay_for_damage("dig into", TRUE);
837 pay_for_damage("
\8c\8a\82ð
\82 \82¯
\82é", TRUE);
840 You("fall through...");
842 You("
\97\8e\82¿
\82½
\81D
\81D
\81D");
843 /* Earlier checks must ensure that the destination
844 * level exists and is in the present dungeon.
846 newlevel.dnum = u.uz.dnum;
847 newlevel.dlevel = u.uz.dlevel + 1;
848 goto_level(&newlevel, FALSE, TRUE, FALSE);
849 /* messages for arriving in special rooms */
853 if (shopdoor && madeby_u)
855 pay_for_damage("ruin", FALSE);
857 pay_for_damage("
\82ß
\82¿
\82á
\82ß
\82¿
\82á
\82É
\82·
\82é", FALSE);
859 impact_drop((struct obj *) 0, x, y, 0);
861 /*[don't we need special sokoban handling here?]*/
862 if (is_flyer(mtmp->data) || is_floater(mtmp->data)
863 || mtmp->data == &mons[PM_WUMPUS]
864 || (mtmp->wormno && count_wsegs(mtmp) > 5)
865 || mtmp->data->msize >= MZ_HUGE)
867 if (mtmp == u.ustuck) /* probably a vortex */
868 return; /* temporary? kludge */
870 if (teleport_pet(mtmp, FALSE)) {
873 if (Is_stronghold(&u.uz)) {
874 assign_level(&tolevel, &valley_level);
875 } else if (Is_botlevel(&u.uz)) {
878 pline("%s avoids the trap.", Monnam(mtmp));
880 pline("%s
\82Íã©
\82ð
\94ð
\82¯
\82½
\81D", Monnam(mtmp));
883 get_level(&tolevel, depth(&u.uz) + 1);
886 make_angry_shk(mtmp, 0, 0);
887 migrate_to_level(mtmp, ledger_no(&tolevel), MIGR_RANDOM,
896 * Called from dighole(), but also from do_break_wand()
900 liquid_flow(x, y, typ, ttmp, fillmsg)
906 boolean u_spot = (x == u.ux && y == u.uy);
909 (void) delfloortrap(ttmp);
910 /* if any objects were frozen here, they're released now */
915 pline(fillmsg, typ == LAVAPOOL ? "lava" : "water");
917 pline(fillmsg, typ == LAVAPOOL ? "
\97n
\8aâ" : "
\90\85");
918 if (u_spot && !(Levitation || Flying)) {
920 (void) lava_effects();
926 /* return TRUE if digging succeeded, FALSE otherwise */
928 dighole(pit_only, by_magic, cc)
929 boolean pit_only, by_magic;
932 register struct trap *ttmp;
934 struct obj *boulder_here;
945 if (!isok(dig_x, dig_y))
949 ttmp = t_at(dig_x, dig_y);
950 lev = &levl[dig_x][dig_y];
951 nohole = (!Can_dig_down(&u.uz) && !lev->candig);
953 if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL
954 || ttmp->ttyp == VIBRATING_SQUARE || nohole))
955 || (IS_ROCK(lev->typ) && lev->typ != SDOOR
956 && (lev->wall_info & W_NONDIGGABLE) != 0)) {
958 pline_The("%s %shere is too hard to dig in.", surface(dig_x, dig_y),
959 (dig_x != u.ux || dig_y != u.uy) ? "t" : "");
961 pline("%s
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä
\8c@
\82ê
\82È
\82¢
\81D", surface(dig_x, dig_y));
964 } else if (is_pool_or_lava(dig_x, dig_y)) {
966 pline_The("%s sloshes furiously for a moment, then subsides.",
967 is_lava(dig_x, dig_y) ? "lava" : "water");
969 pline("%s
\82Í
\8c\83\82µ
\82
\94g
\82¤
\82Á
\82½
\81D",
970 is_lava(dig_x, dig_y) ? "
\97n
\8aâ" : "
\90\85");
972 wake_nearby(); /* splashing */
974 } else if (lev->typ == DRAWBRIDGE_DOWN
975 || (is_drawbridge_wall(dig_x, dig_y) >= 0)) {
976 /* drawbridge_down is the platform crossing the moat when the
977 bridge is extended; drawbridge_wall is the open "doorway" or
978 closed "door" where the portcullis/mechanism is located */
981 pline_The("drawbridge seems too hard to dig through.");
983 pline("
\92µ
\82Ë
\8b´
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä
\8c@
\82ê
\82»
\82¤
\82É
\82È
\82¢
\81D");
986 int x = dig_x, y = dig_y;
987 /* if under the portcullis, the bridge is adjacent */
988 (void) find_drawbridge(&x, &y);
989 destroy_drawbridge(x, y);
993 } else if ((boulder_here = sobj_at(BOULDER, dig_x, dig_y)) != 0) {
994 if (ttmp && (ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT)
997 pline_The("boulder settles into the %spit.",
998 (dig_x != u.ux || dig_y != u.uy) ? "adjacent " : "");
1000 pline("
\8aâ
\82Í%s
\97\8e\82µ
\8c\8a\82ð
\96\84\82ß
\82½
\81D",
1001 (dig_x != u.ux || dig_y != u.uy) ? "
\97×
\82Ì" : "");
1003 ttmp->ttyp = PIT; /* crush spikes */
1006 * digging makes a hole, but the boulder immediately
1007 * fills it. Final outcome: no hole, no boulder.
1010 pline("KADOOM! The boulder falls in!");
1012 pline("
\82Ç
\82Ç
\81[
\82ñ
\81I
\8aâ
\82Í
\97\8e\82¿
\82½
\81I");
1013 (void) delfloortrap(ttmp);
1015 delobj(boulder_here);
1018 } else if (IS_GRAVE(lev->typ)) {
1019 digactualhole(dig_x, dig_y, BY_YOU, PIT);
1022 } else if (lev->typ == DRAWBRIDGE_UP) {
1023 /* must be floor or ice, other cases handled above */
1024 /* dig "pit" and let fluid flow in (if possible) */
1025 typ = fillholetyp(dig_x, dig_y, FALSE);
1029 * We can't dig a hole here since that will destroy
1030 * the drawbridge. The following is a cop-out. --dlc
1033 pline_The("%s %shere is too hard to dig in.",
1034 surface(dig_x, dig_y),
1035 (dig_x != u.ux || dig_y != u.uy) ? "t" : "");
1037 pline("%s
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä
\8c@
\82ê
\82È
\82¢
\81D", surface(dig_x, dig_y));
1042 lev->drawbridgemask &= ~DB_UNDER;
1043 lev->drawbridgemask |= (typ == LAVAPOOL) ? DB_LAVA : DB_MOAT;
1045 liquid_flow(dig_x, dig_y, typ, ttmp,
1046 "As you dig, the hole fills with %s!");
1048 liquid_flow(dig_x, dig_y, typ, ttmp,
1049 "
\82 \82È
\82½
\82ª
\8c@
\82é
\82Æ
\81C%s
\82ª
\97N
\82¢
\82Ä
\82«
\82½
\81I");
1053 /* the following two are here for the wand of digging */
1054 } else if (IS_THRONE(lev->typ)) {
1056 pline_The("throne is too hard to break apart.");
1058 pline("
\8bÊ
\8dÀ
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä
\8dÓ
\82¯
\82È
\82¢
\81D");
1060 } else if (IS_ALTAR(lev->typ)) {
1062 pline_The("altar is too hard to break apart.");
1064 pline("
\8dÕ
\92d
\82Í
\82Æ
\82Ä
\82à
\8cÅ
\82
\82Ä
\8dÓ
\82¯
\82È
\82¢
\81D");
1067 typ = fillholetyp(dig_x, dig_y, FALSE);
1072 liquid_flow(dig_x, dig_y, typ, ttmp,
1073 "As you dig, the hole fills with %s!");
1075 liquid_flow(dig_x, dig_y, typ, ttmp,
1076 "
\82 \82È
\82½
\82ª
\8c@
\82é
\82Æ
\81C%s
\82ª
\97N
\82¢
\82Ä
\82«
\82½
\81I");
1081 /* magical digging disarms settable traps */
1082 if (by_magic && ttmp
1083 && (ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP)) {
1084 int otyp = (ttmp->ttyp == LANDMINE) ? LAND_MINE : BEARTRAP;
1086 /* convert trap into buried object (deletes trap) */
1087 cnv_trap_obj(otyp, 1, ttmp, TRUE);
1090 /* finally we get to make a hole */
1091 if (nohole || pit_only)
1092 digactualhole(dig_x, dig_y, BY_YOU, PIT);
1094 digactualhole(dig_x, dig_y, BY_YOU, HOLE);
1115 if (!isok(dig_x, dig_y))
1119 /* Grave-robbing is frowned upon... */
1120 exercise(A_WIS, FALSE);
1121 if (Role_if(PM_ARCHEOLOGIST)) {
1122 adjalign(-sgn(u.ualign.type) * 3);
1124 You_feel("like a despicable grave-robber!");
1126 pline("
\82±
\82ê
\82Å
\82Í
\82Ü
\82é
\82Å
\95æ
\93D
\96_
\82¾
\81I");
1127 } else if (Role_if(PM_SAMURAI)) {
1128 adjalign(-sgn(u.ualign.type));
1130 You("disturb the honorable dead!");
1132 You("
\96¼
\97_
\82 \82é
\8e\80\8eÒ
\82Ì
\96°
\82è
\82ð
\96W
\82°
\82¾
\81I");
1133 } else if ((u.ualign.type == A_LAWFUL) && (u.ualign.record > -10)) {
1134 adjalign(-sgn(u.ualign.type));
1136 You("have violated the sanctity of this grave!");
1138 You("
\90¹
\82È
\82é
\95æ
\92n
\82ð
\94Æ
\82µ
\82½
\81I");
1145 You("unearth a corpse.");
1147 You("
\8e\80\91Ì
\82ð
\8c@
\82è
\8bN
\82µ
\82½
\81D");
1148 if (!!(otmp = mk_tt_object(CORPSE, dig_x, dig_y)))
1149 otmp->age -= 100; /* this is an *OLD* corpse */
1155 pline(Hallucination ? "Dude! The living dead!"
1157 pline(Hallucination ? "
\83]
\83\93\83r
\82ª
\82
\82é
\82è
\82Æ
\97Ö
\82ð
\95`
\82¢
\82½
\81I"
1159 : "The grave's owner is very upset!");
1161 : "
\95æ
\82Ì
\8f\8a\97L
\8eÒ
\82Í
\82Æ
\82Ä
\82à
\8bÁ
\82¢
\82½
\81I");
1162 (void) makemon(mkclass(S_ZOMBIE, 0), dig_x, dig_y, NO_MM_FLAGS);
1167 pline(Hallucination ? "I want my mummy!"
1169 pline(Hallucination ? "
\83}
\83~
\81[
\82ª
\95K
\97v
\82¾
\81I"
1171 : "You've disturbed a tomb!");
1173 : "
\95æ
\82ð
\8dr
\82µ
\82Ä
\82µ
\82Ü
\82Á
\82½
\81I");
1174 (void) makemon(mkclass(S_MUMMY, 0), dig_x, dig_y, NO_MM_FLAGS);
1179 pline_The("grave seems unused. Strange....");
1181 pline("
\82±
\82Ì
\95æ
\82Í
\96¢
\8eg
\97p
\82Ì
\82æ
\82¤
\82¾
\81D
\8aï
\96
\82¾
\81D
\81D
\81D");
1184 levl[dig_x][dig_y].typ = ROOM;
1185 del_engr_at(dig_x, dig_y);
1186 newsym(dig_x, dig_y);
1194 const char *sdp, *verb;
1195 char *dsp, dirsyms[12], qbuf[BUFSZ];
1197 int rx, ry, downok, res = 0;
1201 if (!wield_tool(obj, "swing"))
1206 ispick = is_pick(obj);
1208 verb = ispick ? "dig" : "chop";
1210 verb = ispick ? "
\8c@
\82é" : "
\8dÓ
\82";
1212 if (u.utrap && u.utraptype == TT_WEB) {
1214 pline("%s you can't %s while entangled in a web.",
1215 /* res==0 => no prior message;
1216 res==1 => just got "You now wield a pick-axe." message */
1217 !res ? "Unfortunately," : "But", verb);
1219 pline("%s
\82
\82à
\82Ì
\91\83\82É
\82Ð
\82Á
\82©
\82©
\82Á
\82Ä
\82¢
\82é
\8aÔ
\82Í%s
\81D",
1220 !res ? "
\8ec
\94O
\82È
\82ª
\82ç" : "
\82µ
\82©
\82µ", jconj(verb, "
\82È
\82¢"));
1225 /* construct list of directions to show player for likely choices */
1226 downok = !!can_reach_floor(FALSE);
1228 for (sdp = Cmd.dirchars; *sdp; ++sdp) {
1229 /* filter out useless directions */
1231 ; /* all directions are viable when swallowed */
1232 } else if (movecmd(*sdp)) {
1233 /* normal direction, within plane of the level map;
1234 movecmd() sets u.dx, u.dy, u.dz and returns !u.dz */
1236 continue; /* handle NODIAG */
1239 if (!isok(rx, ry) || dig_typ(obj, rx, ry) == DIGTYP_UNDIGGABLE)
1242 /* up or down; we used to always include down, so that
1243 there would always be at least one choice shown, but
1244 it shouldn't be a likely candidate when floating high
1245 above the floor; include up instead in that situation
1246 (as a silly candidate rather than a likely one...) */
1247 if ((u.dz > 0) ^ downok)
1250 /* include this direction */
1255 Sprintf(qbuf, "In what direction do you want to %s? [%s]", verb, dirsyms);
1257 Sprintf(qbuf, "
\82Ç
\82Ì
\95û
\8cü
\82ð%s
\81H[%s]", verb, dirsyms);
1261 return use_pick_axe2(obj);
1264 /* MRKR: use_pick_axe() is split in two to allow autodig to bypass */
1265 /* the "In what direction do you want to dig?" query. */
1266 /* use_pick_axe2() uses the existing u.dx, u.dy and u.dz */
1271 register int rx, ry;
1272 register struct rm *lev;
1273 struct trap *trap, *trap_with_u;
1275 boolean ispick = is_pick(obj);
1277 const char *verbing = ispick ? "digging" : "chopping";
1279 const char *verbing = ispick ? "
\8c@
\82é" : "
\8dÓ
\82";
1281 if (u.uswallow && attack(u.ustuck)) {
1283 } else if (Underwater) {
1285 pline("Turbulence torpedoes your %s attempts.", verbing);
1287 pline("%s
\82Æ
\82·
\82é
\82Æ
\97\90\90\85\97¬
\82ª
\8bN
\82«
\82½
\81D", jconj(verbing, "
\82æ
\82¤"));
1288 } else if (u.dz < 0) {
1291 You("don't have enough leverage.");
1293 You("
\95\82\82¢
\82Ä
\82¢
\82é
\82Ì
\82Å
\82Ó
\82ñ
\82Î
\82è
\82ª
\82«
\82©
\82È
\82¢
\81D");
1296 You_cant("reach the %s.", ceiling(u.ux, u.uy));
1298 You("%s
\82É
\93Í
\82©
\82È
\82¢
\81D", ceiling(u.ux,u.uy));
1299 } else if (!u.dx && !u.dy && !u.dz) {
1303 dam = rnd(2) + dbon() + obj->spe;
1307 You("hit yourself with %s.", yname(uwep));
1309 You("
\8e©
\95ª
\8e©
\90g
\82ð%s
\82Å
\92@
\82¢
\82½
\81D", yname(uwep));
1311 Sprintf(buf, "%s own %s", uhis(), OBJ_NAME(objects[obj->otyp]));
1313 Sprintf(buf, "
\8e©
\95ª
\8e©
\90g
\82ð%s
\82Å
\92@
\82¢
\82Ä", yname(uwep));
1314 losehp(Maybe_Half_Phys(dam), buf, KILLED_BY);
1317 } else if (u.dz == 0) {
1318 if (Stunned || (Confusion && !rn2(5)))
1322 if (!isok(rx, ry)) {
1326 pline("
\83K
\83\89\83K
\83\89\81I");
1329 lev = &levl[rx][ry];
1330 if (MON_AT(rx, ry) && attack(m_at(rx, ry)))
1332 dig_target = dig_typ(obj, rx, ry);
1333 if (dig_target == DIGTYP_UNDIGGABLE) {
1334 /* ACCESSIBLE or POOL */
1335 trap = t_at(rx, ry);
1336 if (trap && trap->ttyp == WEB) {
1340 There("is a spider web there!");
1342 pline("
\82»
\82±
\82É
\82Í
\82
\82à
\82Ì
\91\83\82ª
\82 \82é
\81I");
1345 pline("%s entangled in the web.", Yobjnam2(obj, "become"));
1347 Your("%s
\82Í
\82
\82à
\82Ì
\91\83\82É
\82©
\82ç
\82Ü
\82Á
\82½
\81D", xname(obj));
1348 /* you ought to be able to let go; tough luck */
1349 /* (maybe `move_into_trap()' would be better) */
1351 multi_reason = "stuck in a spider web";
1353 nomovemsg = "You pull free.";
1355 nomovemsg = "
\82Ð
\82«
\82Í
\82È
\82µ
\82½
\81D";
1356 } else if (lev->typ == IRONBARS) {
1360 pline("
\83K
\83c
\83\93\81I");
1362 } else if (IS_TREE(lev->typ))
1364 You("need an axe to cut down a tree.");
1366 You("
\96Ø
\82ð
\90Ø
\82é
\82É
\82Í
\95\80\82ª
\95K
\97v
\82¾
\81D");
1367 else if (IS_ROCK(lev->typ))
1369 You("need a pick to dig rock.");
1371 You("
\8c@
\82é
\82É
\82Í
\82Â
\82é
\82Í
\82µ
\82ª
\95K
\97v
\82¾
\81D");
1372 else if (!ispick && (sobj_at(STATUE, rx, ry)
1373 || sobj_at(BOULDER, rx, ry))) {
1374 boolean vibrate = !rn2(3);
1376 pline("Sparks fly as you whack the %s.%s",
1377 sobj_at(STATUE, rx, ry) ? "statue" : "boulder",
1378 vibrate ? " The axe-handle vibrates violently!" : "");
1380 pline("%s
\82ð
\90Ø
\82ë
\82¤
\82Æ
\82µ
\82½
\82ç
\89Î
\89Ô
\82ª
\8eU
\82Á
\82½
\81I%s",
1381 sobj_at(STATUE, rx, ry) ? "
\92¤
\91\9c" : "
\8aâ",
1382 vibrate ? "
\95\80\82Í
\8c\83\82µ
\82
\90U
\93®
\82µ
\82½
\81I" : "");
1386 losehp(Maybe_Half_Phys(2), "axing a hard object",
1388 losehp(Maybe_Half_Phys(2), "
\8cÅ
\82¢
\82à
\82Ì
\82É
\95\80\82ð
\8eg
\82¨
\82¤
\82Æ
\82µ
\82Ä",
1390 } else if (u.utrap && u.utraptype == TT_PIT && trap
1391 && (trap_with_u = t_at(u.ux, u.uy))
1392 && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)
1393 && !conjoined_pits(trap, trap_with_u, FALSE)) {
1395 for (idx = 0; idx < 8; idx++) {
1396 if (xdir[idx] == u.dx && ydir[idx] == u.dy)
1399 /* idx is valid if < 8 */
1401 int adjidx = (idx + 4) % 8;
1402 trap_with_u->conjoined |= (1 << idx);
1403 trap->conjoined |= (1 << adjidx);
1405 pline("You clear some debris from between the pits.");
1407 pline("
\82 \82È
\82½
\82Í
\97\8e\82µ
\8c\8a\82Ì
\8aÔ
\82©
\82ç
\82²
\82Ý
\82ð
\8eæ
\82è
\82Ì
\82¼
\82¢
\82½
\81D");
1409 } else if (u.utrap && u.utraptype == TT_PIT
1410 && (trap_with_u = t_at(u.ux, u.uy))) {
1412 You("swing %s, but the rubble has no place to go.",
1413 yobjnam(obj, (char *) 0));
1415 You("%s
\82ð
\90U
\82è
\89ñ
\82µ
\82½
\82ª
\81C
\94j
\95Ð
\82Ì
\8ds
\82«
\8fê
\8f\8a\82ª
\82È
\82¢
\81D", xname(obj));
1419 You("swing %s through thin air.", yobjnam(obj, (char *) 0));
1421 You("
\8bó
\92\86\82Å%s
\82ð
\90U
\82è
\89ñ
\82µ
\82½
\81D", xname(obj));
1424 static const char *const d_action[6] = { "swinging", "digging",
1425 "chipping the statue",
1426 "hitting the boulder",
1427 "chopping at the door",
1428 "cutting the tree" };
1430 static const char * const d_action1[6] = {
1433 "
\92¤
\91\9c\82ð
\8dí
\82è",
1434 "
\8aâ
\82ð
\91Å
\82¿
\82Â
\82¯",
1438 static const char * const d_action2[6] = {
1441 "
\92¤
\91\9c\82ð
\8dí
\82é",
1442 "
\8aâ
\82ð
\91Å
\82¿
\82Â
\82¯
\82é",
1447 did_dig_msg = FALSE;
1448 context.digging.quiet = FALSE;
1449 if (context.digging.pos.x != rx || context.digging.pos.y != ry
1450 || !on_level(&context.digging.level, &u.uz)
1451 || context.digging.down) {
1452 if (flags.autodig && dig_target == DIGTYP_ROCK
1453 && !context.digging.down && context.digging.pos.x == u.ux
1454 && context.digging.pos.y == u.uy
1455 && (moves <= context.digging.lastdigtime + 2
1456 && moves >= context.digging.lastdigtime)) {
1457 /* avoid messages if repeated autodigging */
1459 context.digging.quiet = TRUE;
1461 context.digging.down = context.digging.chew = FALSE;
1462 context.digging.warned = FALSE;
1463 context.digging.pos.x = rx;
1464 context.digging.pos.y = ry;
1465 assign_level(&context.digging.level, &u.uz);
1466 context.digging.effort = 0;
1467 if (!context.digging.quiet)
1469 You("start %s.", d_action[dig_target]);
1471 You("%s
\82Í
\82¶
\82ß
\82½
\81D", d_action1[dig_target]);
1474 You("%s %s.", context.digging.chew ? "begin" : "continue",
1475 d_action[dig_target]);
1477 You("%s
\82Ì
\82ð%s
\82µ
\82½
\81D", d_action2[dig_target],
1478 context.digging.chew ? "
\8aJ
\8en" : "
\8dÄ
\8aJ");
1480 context.digging.chew = FALSE;
1482 set_occupation(dig, verbing, 0);
1484 } else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) {
1485 /* it must be air -- water checked above */
1487 You("swing %s through thin air.", yobjnam(obj, (char *) 0));
1489 You("
\89½
\82à
\82È
\82¢
\8bó
\8aÔ
\82Å%s
\82ð
\90U
\82è
\82Ü
\82í
\82µ
\82½
\81D", xname(obj));
1490 } else if (!can_reach_floor(FALSE)) {
1491 cant_reach_floor(u.ux, u.uy, FALSE, FALSE);
1492 } else if (is_pool_or_lava(u.ux, u.uy)) {
1493 /* Monsters which swim also happen not to be able to dig */
1495 You("cannot stay under%s long enough.",
1496 is_pool(u.ux, u.uy) ? "water" : " the lava");
1498 You("%s
\82É
\82Í
\92·
\8e\9e\8aÔ
\82¢
\82ç
\82ê
\82È
\82¢
\81D",
1499 is_pool(u.ux, u.uy) ? "
\90\85\96Ê
\89º" : "
\97n
\8aâ
\82Ì
\92\86");
1501 } else if ((trap = t_at(u.ux, u.uy)) != 0
1502 && uteetering_at_seen_pit(trap)) {
1503 dotrap(trap, FORCEBUNGLE);
1504 /* might escape trap and still be teetering at brink */
1506 cant_reach_floor(u.ux, u.uy, FALSE, TRUE);
1508 /* can only dig down with an axe when doing so will
1509 trigger or disarm a trap here */
1510 && (!trap || (trap->ttyp != LANDMINE
1511 && trap->ttyp != BEAR_TRAP))) {
1513 pline("%s merely scratches the %s.", Yobjnam2(obj, (char *) 0),
1514 surface(u.ux, u.uy));
1516 Your("%s
\82Í%s
\82É
\82©
\82·
\82è
\8f\9d\82ð
\82Â
\82¯
\82½
\82¾
\82¯
\82¾
\82Á
\82½
\81D", aobjnam(obj, (char *)0),
1517 surface(u.ux,u.uy));
1521 if (context.digging.pos.x != u.ux || context.digging.pos.y != u.uy
1522 || !on_level(&context.digging.level, &u.uz)
1523 || !context.digging.down) {
1524 context.digging.chew = FALSE;
1525 context.digging.down = TRUE;
1526 context.digging.warned = FALSE;
1527 context.digging.pos.x = u.ux;
1528 context.digging.pos.y = u.uy;
1529 assign_level(&context.digging.level, &u.uz);
1530 context.digging.effort = 0;
1532 You("start %s downward.", verbing);
1534 You("
\89º
\8cü
\82«
\82É
\8c@
\82è
\82Í
\82¶
\82ß
\82½
\81D");
1539 You("continue %s downward.", verbing);
1541 You("
\89º
\8cü
\82«
\82É
\8c@
\82é
\82Ì
\82ð
\8dÄ
\8aJ
\82µ
\82½
\81D");
1542 did_dig_msg = FALSE;
1543 set_occupation(dig, verbing, 0);
1549 * Town Watchmen frown on damage to the town walls, trees or fountains.
1550 * It's OK to dig holes in the ground, however.
1551 * If mtmp is assumed to be a watchman, a watchman is found if mtmp == 0
1552 * zap == TRUE if wand/spell of digging, FALSE otherwise (chewing)
1555 watch_dig(mtmp, x, y, zap)
1560 struct rm *lev = &levl[x][y];
1563 && (closed_door(x, y) || lev->typ == SDOOR || IS_WALL(lev->typ)
1564 || IS_FOUNTAIN(lev->typ) || IS_TREE(lev->typ))) {
1566 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
1567 if (DEADMONSTER(mtmp))
1569 if (is_watch(mtmp->data) && mtmp->mcansee && m_canseeu(mtmp)
1570 && couldsee(mtmp->mx, mtmp->my) && mtmp->mpeaceful)
1576 if (zap || context.digging.warned) {
1578 verbalize("Halt, vandal! You're under arrest!");
1580 verbalize("
\8e~
\82Ü
\82ê
\96ì
\94Ø
\90l
\81I
\82¨
\82Ü
\82¦
\82ð
\91ß
\95ß
\82·
\82é
\81I");
1581 (void) angry_guards(!!Deaf);
1585 if (IS_DOOR(lev->typ))
1590 else if (IS_TREE(lev->typ))
1595 else if (IS_ROCK(lev->typ))
1606 verbalize("Hey, stop damaging that %s!", str);
1608 verbalize("
\82¨
\82¢
\81C%s
\82ð
\94j
\89ó
\82·
\82é
\82Ì
\82ð
\82â
\82ß
\82ë
\81I", str);
1609 context.digging.warned = TRUE;
1617 /* Return TRUE if monster died, FALSE otherwise. Called from m_move(). */
1620 register struct monst *mtmp;
1622 register struct rm *here;
1625 here = &levl[mtmp->mx][mtmp->my];
1626 if (here->typ == SDOOR)
1627 cvt_sdoor_to_door(here); /* ->typ = DOOR */
1629 /* Eats away door if present & closed or locked */
1630 if (closed_door(mtmp->mx, mtmp->my)) {
1631 if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE))
1632 add_damage(mtmp->mx, mtmp->my, 0L);
1633 unblock_point(mtmp->mx, mtmp->my); /* vision */
1634 if (here->doormask & D_TRAPPED) {
1635 here->doormask = D_NODOOR;
1636 if (mb_trapped(mtmp)) { /* mtmp is killed */
1637 newsym(mtmp->mx, mtmp->my);
1641 if (!rn2(3) && flags.verbose) /* not too often.. */
1642 draft_message(TRUE); /* "You feel an unexpected draft." */
1643 here->doormask = D_BROKEN;
1645 newsym(mtmp->mx, mtmp->my);
1647 } else if (here->typ == SCORR) {
1649 unblock_point(mtmp->mx, mtmp->my);
1650 newsym(mtmp->mx, mtmp->my);
1651 draft_message(FALSE); /* "You feel a draft." */
1653 } else if (!IS_ROCK(here->typ) && !IS_TREE(here->typ)) /* no dig */
1656 /* Only rock, trees, and walls fall through to this point. */
1657 if ((here->wall_info & W_NONDIGGABLE) != 0) {
1658 impossible("mdig_tunnel: %s at (%d,%d) is undiggable",
1659 (IS_WALL(here->typ) ? "wall"
1660 : IS_TREE(here->typ) ? "tree" : "stone"),
1661 (int) mtmp->mx, (int) mtmp->my);
1662 return FALSE; /* still alive */
1665 if (IS_WALL(here->typ)) {
1666 /* KMH -- Okay on arboreal levels (room walls are still stone) */
1667 if (flags.verbose && !rn2(5))
1669 You_hear("crashing rock.");
1671 You_hear("
\8aâ
\82Ì
\82
\82¾
\82¯
\82é
\89¹
\82ð
\95·
\82¢
\82½
\81D");
1672 if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE))
1673 add_damage(mtmp->mx, mtmp->my, 0L);
1674 if (level.flags.is_maze_lev) {
1676 } else if (level.flags.is_cavernous_lev
1677 && !in_town(mtmp->mx, mtmp->my)) {
1681 here->doormask = D_NODOOR;
1683 } else if (IS_TREE(here->typ)) {
1685 if (pile && pile < 5)
1686 (void) rnd_treefruit_at(mtmp->mx, mtmp->my);
1689 if (pile && pile < 5)
1690 (void) mksobj_at((pile == 1) ? BOULDER : ROCK, mtmp->mx, mtmp->my,
1693 newsym(mtmp->mx, mtmp->my);
1694 if (!sobj_at(BOULDER, mtmp->mx, mtmp->my))
1695 unblock_point(mtmp->mx, mtmp->my); /* vision */
1700 #define STRIDENT 4 /* from pray.c */
1702 /* draft refers to air currents, but can be a pun on "draft" as conscription
1703 for military service (probably not a good pun if it has to be explained) */
1705 draft_message(unexpected)
1709 * [Bug or TODO? Have caller pass coordinates and use the travel
1710 * mechanism to determine whether there is a path between
1711 * destroyed door (or exposed secret corridor) and hero's location.
1712 * When there is no such path, no draft should be felt.]
1718 You_feel("an unexpected draft.");
1720 You("
\8ev
\82¢
\82à
\82æ
\82ç
\82¸
\81C
\82·
\82«
\82Ü
\95\97\82ð
\8a´
\82¶
\82½
\81D");
1722 /* U.S. classification system uses 1-A for eligible to serve
1723 and 4-F for ineligible due to physical or mental defect;
1724 some intermediate values exist but are rarely seen */
1726 You_feel("like you are %s.",
1727 (ACURR(A_STR) < 6 || ACURR(A_DEX) < 6
1728 || ACURR(A_CON) < 6 || ACURR(A_CHA) < 6
1729 || ACURR(A_INT) < 6 || ACURR(A_WIS) < 6) ? "4-F"
1732 You("
\93Ë
\91R
\90\99\97Ç
\91¾
\98Y
\82ð
\8ev
\82¢
\8fo
\82µ
\82½
\81D");
1735 if (!Hallucination) {
1737 You_feel("a draft.");
1739 You_feel("
\82·
\82«
\82Ü
\95\97\82ð
\8a´
\82¶
\82½
\81D");
1741 #if 0 /*JP*//*"draft"=
\81u
\92¥
\95º
\81v*/
1742 /* "marching" is deliberately ambiguous; it might mean drills
1743 after entering military service or mean engaging in protests */
1744 static const char *draft_reaction[] = {
1745 "enlisting", "marching", "protesting", "fleeing",
1749 /* Lawful: 0..1, Neutral: 1..2, Chaotic: 2..3 */
1750 dridx = rn1(2, 1 - sgn(u.ualign.type));
1751 if (u.ualign.record < STRIDENT)
1752 /* L: +(0..2), N: +(-1..1), C: +(-2..0); all: 0..3 */
1753 dridx += rn1(3, sgn(u.ualign.type) - 1);
1754 You_feel("like %s.", draft_reaction[dridx]);
1755 #else /*JP:
\93ú
\96{
\8cê
\82Å
\82Í
\8bÃ
\82Á
\82½
\82±
\82Æ
\82Í
\82µ
\82È
\82¢*/
1756 You("
\90\99\97Ç
\91¾
\98Y
\82ð
\8ev
\82¢
\8fo
\82µ
\82½
\81D");
1762 /* digging via wand zap or spell cast */
1769 struct trap *trap_with_u = (struct trap *) 0;
1770 int zx, zy, diridx = 8, digdepth, flow_x = -1, flow_y = -1;
1771 boolean shopdoor, shopwall, maze_dig, pitdig = FALSE, pitflow = FALSE;
1774 * Original effect (approximately):
1775 * from CORR: dig until we pierce a wall
1776 * from ROOM: pierce wall and dig until we reach
1777 * an ACCESSIBLE place.
1778 * Currently: dig for digdepth positions;
1779 * also down on request of Lennart Augustsson.
1780 * 3.6.0: from a PIT: dig one adjacent pit.
1786 if (!is_whirly(mtmp->data)) {
1787 if (is_animal(mtmp->data))
1789 You("pierce %s %s wall!", s_suffix(mon_nam(mtmp)),
1790 mbodypart(mtmp, STOMACH));
1792 You("%s
\82Ì%s
\82Ì
\95Ç
\82É
\8c\8a\82ð
\8aJ
\82¯
\82½
\81I", s_suffix(mon_nam(mtmp)),
1793 mbodypart(mtmp, STOMACH));
1795 mtmp->mhp = 1; /* almost dead */
1796 expels(mtmp, mtmp->data, !is_animal(mtmp->data));
1802 if (!Is_airlevel(&u.uz) && !Is_waterlevel(&u.uz) && !Underwater) {
1803 if (u.dz < 0 || On_stairs(u.ux, u.uy)) {
1805 if (On_stairs(u.ux, u.uy))
1807 pline_The("beam bounces off the %s and hits the %s.",
1808 (u.ux == xdnladder || u.ux == xupladder)
1811 ceiling(u.ux, u.uy));
1813 pline("
\8cõ
\90ü
\82Í%s
\82Å
\94½
\8eË
\82µ%s
\82É
\96½
\92\86\82µ
\82½
\81D",
1814 (u.ux == xdnladder || u.ux == xupladder)
1817 ceiling(u.ux, u.uy));
1820 You("loosen a rock from the %s.", ceiling(u.ux, u.uy));
1822 pline("%s
\82Ì
\8aâ
\82ª
\83K
\83^
\83K
\83^
\82µ
\82Í
\82¶
\82ß
\82½
\81D", ceiling(u.ux, u.uy));
1824 pline("It falls on your %s!", body_part(HEAD));
1826 pline("
\82»
\82ê
\82Í
\82 \82È
\82½
\82Ì%s
\82É
\97\8e\82¿
\82Ä
\82«
\82½
\81I", body_part(HEAD));
1827 dmg = rnd((uarmh && is_metallic(uarmh)) ? 2 : 6);
1829 losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN);
1831 losehp(Maybe_Half_Phys(dmg), "
\97\8e\8aâ
\82Å", KILLED_BY_AN);
1832 otmp = mksobj_at(ROCK, u.ux, u.uy, FALSE, FALSE);
1834 (void) xname(otmp); /* set dknown, maybe bknown */
1839 watch_dig((struct monst *) 0, u.ux, u.uy, TRUE);
1840 (void) dighole(FALSE, TRUE, (coord *) 0);
1846 /* normal case: digging across the level */
1847 shopdoor = shopwall = FALSE;
1848 maze_dig = level.flags.is_maze_lev && !Is_earthlevel(&u.uz);
1851 if (u.utrap && u.utraptype == TT_PIT
1852 && (trap_with_u = t_at(u.ux, u.uy))) {
1854 for (diridx = 0; diridx < 8; diridx++) {
1855 if (xdir[diridx] == u.dx && ydir[diridx] == u.dy)
1857 /* diridx is valid if < 8 */
1860 digdepth = rn1(18, 8);
1861 tmp_at(DISP_BEAM, cmap_to_glyph(S_digbeam));
1862 while (--digdepth >= 0) {
1865 room = &levl[zx][zy];
1867 delay_output(); /* wait a little bit */
1869 if (pitdig) { /* we are already in a pit if this is true */
1871 struct trap *adjpit = t_at(zx, zy);
1872 if ((diridx < 8) && !conjoined_pits(adjpit, trap_with_u, FALSE)) {
1873 digdepth = 0; /* limited to the adjacent location only */
1874 if (!(adjpit && (adjpit->ttyp == PIT
1875 || adjpit->ttyp == SPIKED_PIT))) {
1879 if (!adj_pit_checks(&cc, buf)) {
1883 /* this can also result in a pool at zx,zy */
1884 dighole(TRUE, TRUE, &cc);
1885 adjpit = t_at(zx, zy);
1889 && (adjpit->ttyp == PIT || adjpit->ttyp == SPIKED_PIT)) {
1890 int adjidx = (diridx + 4) % 8;
1891 trap_with_u->conjoined |= (1 << diridx);
1892 adjpit->conjoined |= (1 << adjidx);
1897 if (is_pool(zx, zy) || is_lava(zx, zy)) {
1904 } else if (closed_door(zx, zy) || room->typ == SDOOR) {
1905 if (*in_rooms(zx, zy, SHOPBASE)) {
1906 add_damage(zx, zy, 400L);
1909 if (room->typ == SDOOR)
1911 else if (cansee(zx, zy))
1913 pline_The("door is razed!");
1915 pline("
\94à
\82Í
\95ö
\82ê
\97\8e\82¿
\82½
\81I");
1916 watch_dig((struct monst *) 0, zx, zy, TRUE);
1917 room->doormask = D_NODOOR;
1918 unblock_point(zx, zy); /* vision */
1922 } else if (maze_dig) {
1923 if (IS_WALL(room->typ)) {
1924 if (!(room->wall_info & W_NONDIGGABLE)) {
1925 if (*in_rooms(zx, zy, SHOPBASE)) {
1926 add_damage(zx, zy, 200L);
1930 unblock_point(zx, zy); /* vision */
1933 pline_The("wall glows then fades.");
1935 pline("
\95Ç
\82Í
\88ê
\8fu
\8bP
\82¢
\82½
\81D");
1937 } else if (IS_TREE(room->typ)) { /* check trees before stone */
1938 if (!(room->wall_info & W_NONDIGGABLE)) {
1940 unblock_point(zx, zy); /* vision */
1943 pline_The("tree shudders but is unharmed.");
1945 pline("
\96Ø
\82Í
\82ä
\82ê
\82½
\82ª
\8f\9d\82Â
\82©
\82È
\82©
\82Á
\82½
\81D");
1947 } else if (room->typ == STONE || room->typ == SCORR) {
1948 if (!(room->wall_info & W_NONDIGGABLE)) {
1950 unblock_point(zx, zy); /* vision */
1953 pline_The("rock glows then fades.");
1955 pline("
\90Î
\82Í
\88ê
\8fu
\8bP
\82¢
\82½
\81D");
1958 } else if (IS_ROCK(room->typ)) {
1959 if (!may_dig(zx, zy))
1961 if (IS_WALL(room->typ) || room->typ == SDOOR) {
1962 if (*in_rooms(zx, zy, SHOPBASE)) {
1963 add_damage(zx, zy, 200L);
1966 watch_dig((struct monst *) 0, zx, zy, TRUE);
1967 if (level.flags.is_cavernous_lev && !in_town(zx, zy)) {
1971 room->doormask = D_NODOOR;
1974 } else if (IS_TREE(room->typ)) {
1977 } else { /* IS_ROCK but not IS_WALL or SDOOR */
1981 unblock_point(zx, zy); /* vision */
1986 tmp_at(DISP_END, 0); /* closing call */
1988 if (pitflow && isok(flow_x, flow_y)) {
1989 struct trap *ttmp = t_at(flow_x, flow_y);
1990 if (ttmp && (ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT)) {
1991 schar filltyp = fillholetyp(ttmp->tx, ttmp->ty, TRUE);
1992 if (filltyp != ROOM)
1993 pit_flow(ttmp, filltyp);
1997 if (shopdoor || shopwall)
1999 pay_for_damage(shopdoor ? "destroy" : "dig into", FALSE);
2001 pay_for_damage(shopdoor ? "
\94j
\89ó
\82·
\82é" : "
\8c\8a\82ð
\82 \82¯
\82é", FALSE);
2006 * This checks what is on the surface above the
2007 * location where an adjacent pit might be created if
2008 * you're zapping a wand of digging laterally while
2012 adj_pit_checks(cc, msg)
2018 const char *foundation_msg =
2020 "The foundation is too hard to dig through from this angle.";
2022 "
\8aî
\91b
\82Í
\82±
\82Ì
\8ap
\93x
\82©
\82ç
\8c@
\82é
\82É
\82Í
\8cÅ
\82·
\82¬
\82é
\81D";
2026 if (!isok(cc->x, cc->y))
2029 room = &levl[cc->x][cc->y];
2032 if (is_pool(cc->x, cc->y) || is_lava(cc->x, cc->y)) {
2033 /* this is handled by the caller after we return FALSE */
2035 } else if (closed_door(cc->x, cc->y) || room->typ == SDOOR) {
2036 /* We reject this here because dighole() isn't
2037 prepared to deal with this case */
2038 Strcpy(msg, foundation_msg);
2040 } else if (IS_WALL(ltyp)) {
2041 /* if (room->wall_info & W_NONDIGGABLE) */
2042 Strcpy(msg, foundation_msg);
2044 } else if (IS_TREE(ltyp)) { /* check trees before stone */
2045 /* if (room->wall_info & W_NONDIGGABLE) */
2047 Strcpy(msg, "The tree's roots glow then fade.");
2049 Strcpy(msg, "
\96Ø
\82Ì
\8dª
\82Í
\88ê
\8fu
\8bP
\82¢
\82½
\81D");
2051 } else if (ltyp == STONE || ltyp == SCORR) {
2052 if (room->wall_info & W_NONDIGGABLE) {
2054 Strcpy(msg, "The rock glows then fades.");
2056 Strcpy(msg, "
\90Î
\82Í
\88ê
\8fu
\8bP
\82¢
\82½
\81D");
2059 } else if (ltyp == IRONBARS) {
2060 /* "set of iron bars" */
2062 Strcpy(msg, "The bars go much deeper than your pit.");
2064 Strcpy(msg, "
\96_
\82Í
\97\8e\82µ
\8c\8a\82æ
\82è
\97y
\82©
\82É
\90[
\82¢
\82Æ
\82±
\82ë
\82Ü
\82Å
\96\84\82Ü
\82Á
\82Ä
\82¢
\82é
\81D");
2066 } else if (is_lava(cc->x, cc->y)) {
2067 } else if (is_ice(cc->x, cc->y)) {
2068 } else if (is_pool(cc->x, cc->y)) {
2069 } else if (IS_GRAVE(ltyp)) {
2071 } else if (IS_SINK(ltyp)) {
2073 Strcpy(msg, "A tangled mass of plumbing remains below the sink.");
2075 Strcpy(msg, "
\93ü
\82è
\91g
\82ñ
\82¾
\94z
\8aÇ
\82ª
\97¬
\82µ
\91ä
\82Ì
\89º
\82É
\8ec
\82Á
\82½
\82Ü
\82Ü
\82¾
\81D");
2077 } else if ((cc->x == xupladder && cc->y == yupladder) /* ladder up */
2078 || (cc->x == xdnladder && cc->y == ydnladder)) { /* " down */
2080 Strcpy(msg, "The ladder is unaffected.");
2082 Strcpy(msg, "
\82Í
\82µ
\82²
\82Í
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\81D");
2085 const char *supporting = (const char *) 0;
2087 if (IS_FOUNTAIN(ltyp))
2089 supporting = "fountain";
2091 supporting = "
\90ò";
2092 else if (IS_THRONE(ltyp))
2094 supporting = "throne";
2096 supporting = "
\8bÊ
\8dÀ";
2097 else if (IS_ALTAR(ltyp))
2099 supporting = "altar";
2101 supporting = "
\8dÕ
\92d";
2102 else if ((cc->x == xupstair && cc->y == yupstair)
2103 || (cc->x == sstairs.sx && cc->y == sstairs.sy
2105 /* "staircase up" */
2107 supporting = "stairs";
2109 supporting = "
\8aK
\92i";
2110 else if ((cc->x == xdnstair && cc->y == ydnstair)
2111 || (cc->x == sstairs.sx && cc->y == sstairs.sy
2113 /* "staircase down" */
2115 supporting = "stairs";
2117 supporting = "
\8aK
\92i";
2118 else if (ltyp == DRAWBRIDGE_DOWN /* "lowered drawbridge" */
2119 || ltyp == DBWALL) /* "raised drawbridge" */
2121 supporting = "drawbridge";
2123 supporting = "
\92µ
\82Ë
\8b´";
2127 Sprintf(msg, "The %s%ssupporting structures remain intact.",
2128 supporting ? s_suffix(supporting) : "",
2129 supporting ? " " : "");
2131 Sprintf(msg, "%s%s
\8ex
\82¦
\82Ä
\82¢
\82é
\95\94\95ª
\82Í
\82»
\82Ì
\82Ü
\82Ü
\82¾
\81D",
2132 supporting ? supporting : "",
2133 supporting ? "
\82ð" : "");
2142 * Ensure that all conjoined pits fill up.
2145 pit_flow(trap, filltyp)
2149 if (trap && (filltyp != ROOM)
2150 && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)) {
2155 levl[trap->tx][trap->ty].typ = filltyp;
2156 liquid_flow(trap->tx, trap->ty, filltyp, trap,
2157 (trap->tx == u.ux && trap->ty == u.uy)
2159 ? "Suddenly %s flows in from the adjacent pit!"
2161 ? "
\93Ë
\91R
\97×
\82Ì
\97\8e\82µ
\8c\8a\82©
\82ç%s
\82ª
\97¬
\82ê
\8d\9e\82ñ
\82Å
\82«
\82½
\81I"
2163 for (idx = 0; idx < 8; ++idx) {
2164 if (t.conjoined & (1 << idx)) {
2168 x = t.tx + xdir[idx];
2169 y = t.ty + ydir[idx];
2172 /* cannot do this back-check; liquid_flow()
2173 * called deltrap() which cleaned up the
2174 * conjoined fields on both pits.
2176 if (t2 && (t2->conjoined & (1 << ((idx + 4) % 8))))
2179 pit_flow(t2, filltyp);
2189 xchar check_x, check_y;
2190 struct obj *otmp, *otmp2;
2192 if (u.utraptype == TT_BURIEDBALL)
2193 for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
2195 if (otmp->otyp != HEAVY_IRON_BALL)
2197 /* try the exact location first */
2198 if (otmp->ox == cc->x && otmp->oy == cc->y)
2200 /* Now try the vicinity */
2202 * (x-2,y-2) (x+2,y-2)
2204 * (x-2,y+2) (x+2,y+2)
2206 for (check_x = cc->x - 2; check_x <= cc->x + 2; ++check_x)
2207 for (check_y = cc->y - 2; check_y <= cc->y + 2; ++check_y) {
2208 if (check_x == cc->x && check_y == cc->y)
2210 if (isok(check_x, check_y)
2211 && (otmp->ox == check_x && otmp->oy == check_y)) {
2218 return (struct obj *) 0;
2222 buried_ball_to_punishment()
2228 ball = buried_ball(&cc);
2230 obj_extract_self(ball);
2232 /* rusting buried metallic objects is not implemented yet */
2234 (void) stop_timer(RUST_METAL, obj_to_any(ball));
2236 punish(ball); /* use ball as flag for unearthed buried ball */
2239 del_engr_at(cc.x, cc.y);
2245 buried_ball_to_freedom()
2251 ball = buried_ball(&cc);
2253 obj_extract_self(ball);
2255 /* rusting buried metallic objects is not implemented yet */
2257 (void) stop_timer(RUST_METAL, obj_to_any(ball));
2259 place_object(ball, cc.x, cc.y);
2263 del_engr_at(cc.x, cc.y);
2268 /* move objects from fobj/nexthere lists to buriedobjlist, keeping position
2271 bury_an_obj(otmp, dealloced)
2278 debugpline1("bury_an_obj: %s", xname(otmp));
2281 if (otmp == uball) {
2283 u.utrap = rn1(50, 20);
2284 u.utraptype = TT_BURIEDBALL;
2286 pline_The("iron ball gets buried!");
2288 pline_The("
\93S
\82Ì
\8b\85\82Í
\96\84\82Ü
\82Á
\82½
\81I");
2290 /* after unpunish(), or might get deallocated chain */
2291 otmp2 = otmp->nexthere;
2293 * obj_resists(,0,0) prevents Rider corpses from being buried.
2294 * It also prevents The Amulet and invocation tools from being
2295 * buried. Since they can't be confined to bags and statues,
2296 * it makes sense that they can't be buried either, even though
2297 * the real reason there (direct accessibility when carried) is
2298 * completely different.
2300 if (otmp == uchain || obj_resists(otmp, 0, 0))
2303 if (otmp->otyp == LEASH && otmp->leashmon != 0)
2306 if (otmp->lamplit && otmp->otyp != POT_OIL)
2307 end_burn(otmp, TRUE);
2309 obj_extract_self(otmp);
2311 under_ice = is_ice(otmp->ox, otmp->oy);
2312 if (otmp->otyp == ROCK && !under_ice) {
2313 /* merges into burying material */
2316 obfree(otmp, (struct obj *) 0);
2320 * Start a rot on organic material. Not corpses -- they
2321 * are already handled.
2323 if (otmp->otyp == CORPSE) {
2324 ; /* should cancel timer if under_ice */
2325 } else if ((under_ice ? otmp->oclass == POTION_CLASS : is_organic(otmp))
2326 && !obj_resists(otmp, 5, 95)) {
2327 (void) start_timer((under_ice ? 0L : 250L) + (long) rnd(250),
2328 TIMER_OBJECT, ROT_ORGANIC, obj_to_any(otmp));
2330 /* rusting of buried metal not yet implemented */
2331 } else if (is_rustprone(otmp)) {
2332 (void) start_timer((long) rnd((otmp->otyp == HEAVY_IRON_BALL)
2335 TIMER_OBJECT, RUST_METAL, obj_to_any(otmp));
2338 add_to_buried(otmp);
2346 struct obj *otmp, *otmp2;
2348 if (level.objects[x][y] != (struct obj *) 0) {
2349 debugpline2("bury_objs: at <%d,%d>", x, y);
2351 for (otmp = level.objects[x][y]; otmp; otmp = otmp2)
2352 otmp2 = bury_an_obj(otmp, (boolean *) 0);
2354 /* don't expect any engravings here, but just in case */
2359 /* move objects from buriedobjlist to fobj/nexthere lists */
2364 struct obj *otmp, *otmp2, *bball;
2367 debugpline2("unearth_objs: at <%d,%d>", x, y);
2370 bball = buried_ball(&cc);
2371 for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
2373 if (otmp->ox == x && otmp->oy == y) {
2374 if (bball && otmp == bball && u.utraptype == TT_BURIEDBALL) {
2375 buried_ball_to_punishment();
2377 obj_extract_self(otmp);
2379 (void) stop_timer(ROT_ORGANIC, obj_to_any(otmp));
2380 place_object(otmp, x, y);
2390 * The organic material has rotted away while buried. As an expansion,
2391 * we could add add partial damage. A damage count is kept in the object
2392 * and every time we are called we increment the count and reschedule another
2393 * timeout. Eventually the object rots away.
2395 * This is used by buried objects other than corpses. When a container rots
2396 * away, any contents become newly buried objects.
2400 rot_organic(arg, timeout)
2402 long timeout UNUSED;
2404 struct obj *obj = arg->a_obj;
2406 while (Has_contents(obj)) {
2407 /* We don't need to place contained object on the floor
2408 first, but we do need to update its map coordinates. */
2409 obj->cobj->ox = obj->ox, obj->cobj->oy = obj->oy;
2410 /* Everything which can be held in a container can also be
2411 buried, so bury_an_obj's use of obj_extract_self insures
2412 that Has_contents(obj) will eventually become false. */
2413 (void) bury_an_obj(obj->cobj, (boolean *) 0);
2415 obj_extract_self(obj);
2416 obfree(obj, (struct obj *) 0);
2420 * Called when a corpse has rotted completely away.
2423 rot_corpse(arg, timeout)
2428 struct obj *obj = arg->a_obj;
2429 boolean on_floor = obj->where == OBJ_FLOOR,
2430 in_invent = obj->where == OBJ_INVENT;
2435 } else if (in_invent) {
2436 if (flags.verbose) {
2437 char *cname = corpse_xname(obj, (const char *) 0, CXN_NO_PFX);
2440 Your("%s%s %s away%c", obj == uwep ? "wielded " : "", cname,
2441 otense(obj, "rot"), obj == uwep ? '!' : '.');
2443 pline("
\82 \82È
\82½
\82Ì%s%s
\82Í
\95\85\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½%s",
2444 obj == uwep ? "
\8eè
\82É
\82µ
\82Ä
\82¢
\82é" : "", cname,
2445 obj == uwep ? "
\81I" : "
\81D");
2449 uwepgone(); /* now bare handed */
2451 } else if (obj == uswapwep) {
2454 } else if (obj == uquiver) {
2458 } else if (obj->where == OBJ_MINVENT && obj->owornmask) {
2459 if (obj == MON_WEP(obj->ocarry))
2460 setmnotwielded(obj->ocarry, obj);
2461 } else if (obj->where == OBJ_MIGRATING) {
2462 /* clear destination flag so that obfree()'s check for
2463 freeing a worn object doesn't get a false hit */
2464 obj->owornmask = 0L;
2466 rot_organic(arg, timeout);
2468 struct monst *mtmp = m_at(x, y);
2470 /* a hiding monster may be exposed */
2471 if (mtmp && !OBJ_AT(x, y) && mtmp->mundetected
2472 && hides_under(mtmp->data)) {
2473 mtmp->mundetected = 0;
2474 } else if (x == u.ux && y == u.uy && u.uundetected && hides_under(youmonst.data))
2475 (void) hideunder(&youmonst);
2477 } else if (in_invent)
2486 debugpline1("bury_monst: %s", mon_nam(mtmp));
2487 if (canseemon(mtmp)) {
2488 if (is_flyer(mtmp->data) || is_floater(mtmp->data)) {
2489 pline_The("%s opens up, but %s is not swallowed!",
2490 surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
2493 pline_The("%s opens up and swallows %s!",
2494 surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
2497 mtmp->mburied = TRUE;
2498 wakeup(mtmp); /* at least give it a chance :-) */
2499 newsym(mtmp->mx, mtmp->my);
2505 debugpline0("bury_you");
2506 if (!Levitation && !Flying) {
2509 You_feel("a sensation like falling into a trap!");
2511 You("ã©
\82É
\97\8e\82¿
\82é
\82æ
\82¤
\82È
\8a´
\8ao
\82É
\82¨
\82»
\82í
\82ê
\82½
\81I");
2514 pline_The("%s opens beneath you and you fall in!",
2516 pline("%s
\82ª
\89º
\95û
\82É
\8aJ
\82«
\81C
\82 \82È
\82½
\82Í
\97\8e\82¿
\82½
\81I",
2517 surface(u.ux, u.uy));
2520 if (!Strangled && !Breathless)
2529 debugpline0("unearth_you");
2532 if (!uamul || uamul->otyp != AMULET_OF_STRANGULATION)
2540 debugpline0("escape_tomb");
2541 if ((Teleportation || can_teleport(youmonst.data))
2542 && (Teleport_control || rn2(3) < Luck+2)) {
2544 You("attempt a teleport spell.");
2546 You("
\8fu
\8aÔ
\88Ú
\93®
\82ð
\8e\8e\82Ý
\82½
\81D");
2547 (void) dotele(); /* calls unearth_you() */
2548 } else if (u.uburied) { /* still buried after 'port attempt */
2551 if (amorphous(youmonst.data) || Passes_walls
2552 || noncorporeal(youmonst.data)
2553 || (unsolid(youmonst.data)
2554 && youmonst.data != &mons[PM_WATER_ELEMENTAL])
2555 || (tunnels(youmonst.data) && !needspick(youmonst.data))) {
2557 You("%s up through the %s.",
2558 (tunnels(youmonst.data) && !needspick(youmonst.data))
2560 : (amorphous(youmonst.data))
2563 surface(u.ux, u.uy));
2565 You("%s
\82É%s
\82ë
\82¤
\82Æ
\82µ
\82½
\81D",
2566 surface(u.ux, u.uy),
2567 (tunnels(youmonst.data) && !needspick(youmonst.data))
2568 ? "
\83g
\83\93\83l
\83\8b\82ð
\8c@"
2569 : (amorphous(youmonst.data))
2570 ? "
\82É
\82¶
\82Ý
\82Ì
\82Ú"
2571 : "
\8f\99\81X
\82É
\82Í
\82¢
\82 \82ª");
2574 good = (tunnels(youmonst.data) && !needspick(youmonst.data))
2575 ? dighole(TRUE, FALSE, (coord *)0) : TRUE;
2586 debugpline0("bury_obj");
2587 if (cansee(otmp->ox, otmp->oy))
2589 pline_The("objects on the %s tumble into a hole!",
2591 pline_The("%s
\82Ì
\95¨
\91Ì
\82Í
\8c\8a\82É
\93]
\82ª
\82Á
\82½
\81I",
2592 surface(otmp->ox, otmp->oy));
2594 bury_objs(otmp->ox, otmp->oy);
2599 /* bury everything at your loc and around */
2601 wiz_debug_cmd_bury()
2605 for (x = u.ux - 1; x <= u.ux + 1; x++)
2606 for (y = u.uy - 1; y <= u.uy + 1; y++)