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) */
1352 multi_reason = "stuck in a spider web";
1354 multi_reason = "
\82
\82à
\82Ì
\91\83\82É
\95ß
\82Ü
\82Á
\82Ä
\82¢
\82é
\8aÔ
\82É";
1356 nomovemsg = "You pull free.";
1358 nomovemsg = "
\82Ð
\82«
\82Í
\82È
\82µ
\82½
\81D";
1359 } else if (lev->typ == IRONBARS) {
1363 pline("
\83K
\83c
\83\93\81I");
1365 } else if (IS_TREE(lev->typ))
1367 You("need an axe to cut down a tree.");
1369 You("
\96Ø
\82ð
\90Ø
\82é
\82É
\82Í
\95\80\82ª
\95K
\97v
\82¾
\81D");
1370 else if (IS_ROCK(lev->typ))
1372 You("need a pick to dig rock.");
1374 You("
\8c@
\82é
\82É
\82Í
\82Â
\82é
\82Í
\82µ
\82ª
\95K
\97v
\82¾
\81D");
1375 else if (!ispick && (sobj_at(STATUE, rx, ry)
1376 || sobj_at(BOULDER, rx, ry))) {
1377 boolean vibrate = !rn2(3);
1379 pline("Sparks fly as you whack the %s.%s",
1380 sobj_at(STATUE, rx, ry) ? "statue" : "boulder",
1381 vibrate ? " The axe-handle vibrates violently!" : "");
1383 pline("%s
\82ð
\90Ø
\82ë
\82¤
\82Æ
\82µ
\82½
\82ç
\89Î
\89Ô
\82ª
\8eU
\82Á
\82½
\81I%s",
1384 sobj_at(STATUE, rx, ry) ? "
\92¤
\91\9c" : "
\8aâ",
1385 vibrate ? "
\95\80\82Í
\8c\83\82µ
\82
\90U
\93®
\82µ
\82½
\81I" : "");
1389 losehp(Maybe_Half_Phys(2), "axing a hard object",
1391 losehp(Maybe_Half_Phys(2), "
\8cÅ
\82¢
\82à
\82Ì
\82É
\95\80\82ð
\8eg
\82¨
\82¤
\82Æ
\82µ
\82Ä",
1393 } else if (u.utrap && u.utraptype == TT_PIT && trap
1394 && (trap_with_u = t_at(u.ux, u.uy))
1395 && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)
1396 && !conjoined_pits(trap, trap_with_u, FALSE)) {
1398 for (idx = 0; idx < 8; idx++) {
1399 if (xdir[idx] == u.dx && ydir[idx] == u.dy)
1402 /* idx is valid if < 8 */
1404 int adjidx = (idx + 4) % 8;
1405 trap_with_u->conjoined |= (1 << idx);
1406 trap->conjoined |= (1 << adjidx);
1408 pline("You clear some debris from between the pits.");
1410 pline("
\82 \82È
\82½
\82Í
\97\8e\82µ
\8c\8a\82Ì
\8aÔ
\82©
\82ç
\82²
\82Ý
\82ð
\8eæ
\82è
\82Ì
\82¼
\82¢
\82½
\81D");
1412 } else if (u.utrap && u.utraptype == TT_PIT
1413 && (trap_with_u = t_at(u.ux, u.uy))) {
1415 You("swing %s, but the rubble has no place to go.",
1416 yobjnam(obj, (char *) 0));
1418 You("%s
\82ð
\90U
\82è
\89ñ
\82µ
\82½
\82ª
\81C
\94j
\95Ð
\82Ì
\8ds
\82«
\8fê
\8f\8a\82ª
\82È
\82¢
\81D", xname(obj));
1422 You("swing %s through thin air.", yobjnam(obj, (char *) 0));
1424 You("
\8bó
\92\86\82Å%s
\82ð
\90U
\82è
\89ñ
\82µ
\82½
\81D", xname(obj));
1427 static const char *const d_action[6] = { "swinging", "digging",
1428 "chipping the statue",
1429 "hitting the boulder",
1430 "chopping at the door",
1431 "cutting the tree" };
1433 static const char * const d_action1[6] = {
1436 "
\92¤
\91\9c\82ð
\8dí
\82è",
1437 "
\8aâ
\82ð
\91Å
\82¿
\82Â
\82¯",
1441 static const char * const d_action2[6] = {
1444 "
\92¤
\91\9c\82ð
\8dí
\82é",
1445 "
\8aâ
\82ð
\91Å
\82¿
\82Â
\82¯
\82é",
1450 did_dig_msg = FALSE;
1451 context.digging.quiet = FALSE;
1452 if (context.digging.pos.x != rx || context.digging.pos.y != ry
1453 || !on_level(&context.digging.level, &u.uz)
1454 || context.digging.down) {
1455 if (flags.autodig && dig_target == DIGTYP_ROCK
1456 && !context.digging.down && context.digging.pos.x == u.ux
1457 && context.digging.pos.y == u.uy
1458 && (moves <= context.digging.lastdigtime + 2
1459 && moves >= context.digging.lastdigtime)) {
1460 /* avoid messages if repeated autodigging */
1462 context.digging.quiet = TRUE;
1464 context.digging.down = context.digging.chew = FALSE;
1465 context.digging.warned = FALSE;
1466 context.digging.pos.x = rx;
1467 context.digging.pos.y = ry;
1468 assign_level(&context.digging.level, &u.uz);
1469 context.digging.effort = 0;
1470 if (!context.digging.quiet)
1472 You("start %s.", d_action[dig_target]);
1474 You("%s
\82Í
\82¶
\82ß
\82½
\81D", d_action1[dig_target]);
1477 You("%s %s.", context.digging.chew ? "begin" : "continue",
1478 d_action[dig_target]);
1480 You("%s
\82Ì
\82ð%s
\82µ
\82½
\81D", d_action2[dig_target],
1481 context.digging.chew ? "
\8aJ
\8en" : "
\8dÄ
\8aJ");
1483 context.digging.chew = FALSE;
1485 set_occupation(dig, verbing, 0);
1487 } else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) {
1488 /* it must be air -- water checked above */
1490 You("swing %s through thin air.", yobjnam(obj, (char *) 0));
1492 You("
\89½
\82à
\82È
\82¢
\8bó
\8aÔ
\82Å%s
\82ð
\90U
\82è
\82Ü
\82í
\82µ
\82½
\81D", xname(obj));
1493 } else if (!can_reach_floor(FALSE)) {
1494 cant_reach_floor(u.ux, u.uy, FALSE, FALSE);
1495 } else if (is_pool_or_lava(u.ux, u.uy)) {
1496 /* Monsters which swim also happen not to be able to dig */
1498 You("cannot stay under%s long enough.",
1499 is_pool(u.ux, u.uy) ? "water" : " the lava");
1501 You("%s
\82É
\82Í
\92·
\8e\9e\8aÔ
\82¢
\82ç
\82ê
\82È
\82¢
\81D",
1502 is_pool(u.ux, u.uy) ? "
\90\85\96Ê
\89º" : "
\97n
\8aâ
\82Ì
\92\86");
1504 } else if ((trap = t_at(u.ux, u.uy)) != 0
1505 && uteetering_at_seen_pit(trap)) {
1506 dotrap(trap, FORCEBUNGLE);
1507 /* might escape trap and still be teetering at brink */
1509 cant_reach_floor(u.ux, u.uy, FALSE, TRUE);
1511 /* can only dig down with an axe when doing so will
1512 trigger or disarm a trap here */
1513 && (!trap || (trap->ttyp != LANDMINE
1514 && trap->ttyp != BEAR_TRAP))) {
1516 pline("%s merely scratches the %s.", Yobjnam2(obj, (char *) 0),
1517 surface(u.ux, u.uy));
1519 Your("%s
\82Í%s
\82É
\82©
\82·
\82è
\8f\9d\82ð
\82Â
\82¯
\82½
\82¾
\82¯
\82¾
\82Á
\82½
\81D", aobjnam(obj, (char *)0),
1520 surface(u.ux,u.uy));
1524 if (context.digging.pos.x != u.ux || context.digging.pos.y != u.uy
1525 || !on_level(&context.digging.level, &u.uz)
1526 || !context.digging.down) {
1527 context.digging.chew = FALSE;
1528 context.digging.down = TRUE;
1529 context.digging.warned = FALSE;
1530 context.digging.pos.x = u.ux;
1531 context.digging.pos.y = u.uy;
1532 assign_level(&context.digging.level, &u.uz);
1533 context.digging.effort = 0;
1535 You("start %s downward.", verbing);
1537 You("
\89º
\8cü
\82«
\82É
\8c@
\82è
\82Í
\82¶
\82ß
\82½
\81D");
1542 You("continue %s downward.", verbing);
1544 You("
\89º
\8cü
\82«
\82É
\8c@
\82é
\82Ì
\82ð
\8dÄ
\8aJ
\82µ
\82½
\81D");
1545 did_dig_msg = FALSE;
1546 set_occupation(dig, verbing, 0);
1552 * Town Watchmen frown on damage to the town walls, trees or fountains.
1553 * It's OK to dig holes in the ground, however.
1554 * If mtmp is assumed to be a watchman, a watchman is found if mtmp == 0
1555 * zap == TRUE if wand/spell of digging, FALSE otherwise (chewing)
1558 watch_dig(mtmp, x, y, zap)
1563 struct rm *lev = &levl[x][y];
1566 && (closed_door(x, y) || lev->typ == SDOOR || IS_WALL(lev->typ)
1567 || IS_FOUNTAIN(lev->typ) || IS_TREE(lev->typ))) {
1569 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
1570 if (DEADMONSTER(mtmp))
1572 if (is_watch(mtmp->data) && mtmp->mcansee && m_canseeu(mtmp)
1573 && couldsee(mtmp->mx, mtmp->my) && mtmp->mpeaceful)
1579 if (zap || context.digging.warned) {
1581 verbalize("Halt, vandal! You're under arrest!");
1583 verbalize("
\8e~
\82Ü
\82ê
\96ì
\94Ø
\90l
\81I
\82¨
\82Ü
\82¦
\82ð
\91ß
\95ß
\82·
\82é
\81I");
1584 (void) angry_guards(!!Deaf);
1588 if (IS_DOOR(lev->typ))
1593 else if (IS_TREE(lev->typ))
1598 else if (IS_ROCK(lev->typ))
1609 verbalize("Hey, stop damaging that %s!", str);
1611 verbalize("
\82¨
\82¢
\81C%s
\82ð
\94j
\89ó
\82·
\82é
\82Ì
\82ð
\82â
\82ß
\82ë
\81I", str);
1612 context.digging.warned = TRUE;
1620 /* Return TRUE if monster died, FALSE otherwise. Called from m_move(). */
1623 register struct monst *mtmp;
1625 register struct rm *here;
1628 here = &levl[mtmp->mx][mtmp->my];
1629 if (here->typ == SDOOR)
1630 cvt_sdoor_to_door(here); /* ->typ = DOOR */
1632 /* Eats away door if present & closed or locked */
1633 if (closed_door(mtmp->mx, mtmp->my)) {
1634 if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE))
1635 add_damage(mtmp->mx, mtmp->my, 0L);
1636 unblock_point(mtmp->mx, mtmp->my); /* vision */
1637 if (here->doormask & D_TRAPPED) {
1638 here->doormask = D_NODOOR;
1639 if (mb_trapped(mtmp)) { /* mtmp is killed */
1640 newsym(mtmp->mx, mtmp->my);
1644 if (!rn2(3) && flags.verbose) /* not too often.. */
1645 draft_message(TRUE); /* "You feel an unexpected draft." */
1646 here->doormask = D_BROKEN;
1648 newsym(mtmp->mx, mtmp->my);
1650 } else if (here->typ == SCORR) {
1652 unblock_point(mtmp->mx, mtmp->my);
1653 newsym(mtmp->mx, mtmp->my);
1654 draft_message(FALSE); /* "You feel a draft." */
1656 } else if (!IS_ROCK(here->typ) && !IS_TREE(here->typ)) /* no dig */
1659 /* Only rock, trees, and walls fall through to this point. */
1660 if ((here->wall_info & W_NONDIGGABLE) != 0) {
1661 impossible("mdig_tunnel: %s at (%d,%d) is undiggable",
1662 (IS_WALL(here->typ) ? "wall"
1663 : IS_TREE(here->typ) ? "tree" : "stone"),
1664 (int) mtmp->mx, (int) mtmp->my);
1665 return FALSE; /* still alive */
1668 if (IS_WALL(here->typ)) {
1669 /* KMH -- Okay on arboreal levels (room walls are still stone) */
1670 if (flags.verbose && !rn2(5))
1672 You_hear("crashing rock.");
1674 You_hear("
\8aâ
\82Ì
\82
\82¾
\82¯
\82é
\89¹
\82ð
\95·
\82¢
\82½
\81D");
1675 if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE))
1676 add_damage(mtmp->mx, mtmp->my, 0L);
1677 if (level.flags.is_maze_lev) {
1679 } else if (level.flags.is_cavernous_lev
1680 && !in_town(mtmp->mx, mtmp->my)) {
1684 here->doormask = D_NODOOR;
1686 } else if (IS_TREE(here->typ)) {
1688 if (pile && pile < 5)
1689 (void) rnd_treefruit_at(mtmp->mx, mtmp->my);
1692 if (pile && pile < 5)
1693 (void) mksobj_at((pile == 1) ? BOULDER : ROCK, mtmp->mx, mtmp->my,
1696 newsym(mtmp->mx, mtmp->my);
1697 if (!sobj_at(BOULDER, mtmp->mx, mtmp->my))
1698 unblock_point(mtmp->mx, mtmp->my); /* vision */
1703 #define STRIDENT 4 /* from pray.c */
1705 /* draft refers to air currents, but can be a pun on "draft" as conscription
1706 for military service (probably not a good pun if it has to be explained) */
1708 draft_message(unexpected)
1712 * [Bug or TODO? Have caller pass coordinates and use the travel
1713 * mechanism to determine whether there is a path between
1714 * destroyed door (or exposed secret corridor) and hero's location.
1715 * When there is no such path, no draft should be felt.]
1721 You_feel("an unexpected draft.");
1723 You("
\8ev
\82¢
\82à
\82æ
\82ç
\82¸
\81C
\82·
\82«
\82Ü
\95\97\82ð
\8a´
\82¶
\82½
\81D");
1725 /* U.S. classification system uses 1-A for eligible to serve
1726 and 4-F for ineligible due to physical or mental defect;
1727 some intermediate values exist but are rarely seen */
1729 You_feel("like you are %s.",
1730 (ACURR(A_STR) < 6 || ACURR(A_DEX) < 6
1731 || ACURR(A_CON) < 6 || ACURR(A_CHA) < 6
1732 || ACURR(A_INT) < 6 || ACURR(A_WIS) < 6) ? "4-F"
1735 You("
\93Ë
\91R
\90\99\97Ç
\91¾
\98Y
\82ð
\8ev
\82¢
\8fo
\82µ
\82½
\81D");
1738 if (!Hallucination) {
1740 You_feel("a draft.");
1742 You_feel("
\82·
\82«
\82Ü
\95\97\82ð
\8a´
\82¶
\82½
\81D");
1744 #if 0 /*JP*//*"draft"=
\81u
\92¥
\95º
\81v*/
1745 /* "marching" is deliberately ambiguous; it might mean drills
1746 after entering military service or mean engaging in protests */
1747 static const char *draft_reaction[] = {
1748 "enlisting", "marching", "protesting", "fleeing",
1752 /* Lawful: 0..1, Neutral: 1..2, Chaotic: 2..3 */
1753 dridx = rn1(2, 1 - sgn(u.ualign.type));
1754 if (u.ualign.record < STRIDENT)
1755 /* L: +(0..2), N: +(-1..1), C: +(-2..0); all: 0..3 */
1756 dridx += rn1(3, sgn(u.ualign.type) - 1);
1757 You_feel("like %s.", draft_reaction[dridx]);
1758 #else /*JP:
\93ú
\96{
\8cê
\82Å
\82Í
\8bÃ
\82Á
\82½
\82±
\82Æ
\82Í
\82µ
\82È
\82¢*/
1759 You("
\90\99\97Ç
\91¾
\98Y
\82ð
\8ev
\82¢
\8fo
\82µ
\82½
\81D");
1765 /* digging via wand zap or spell cast */
1772 struct trap *trap_with_u = (struct trap *) 0;
1773 int zx, zy, diridx = 8, digdepth, flow_x = -1, flow_y = -1;
1774 boolean shopdoor, shopwall, maze_dig, pitdig = FALSE, pitflow = FALSE;
1777 * Original effect (approximately):
1778 * from CORR: dig until we pierce a wall
1779 * from ROOM: pierce wall and dig until we reach
1780 * an ACCESSIBLE place.
1781 * Currently: dig for digdepth positions;
1782 * also down on request of Lennart Augustsson.
1783 * 3.6.0: from a PIT: dig one adjacent pit.
1789 if (!is_whirly(mtmp->data)) {
1790 if (is_animal(mtmp->data))
1792 You("pierce %s %s wall!", s_suffix(mon_nam(mtmp)),
1793 mbodypart(mtmp, STOMACH));
1795 You("%s
\82Ì%s
\82Ì
\95Ç
\82É
\8c\8a\82ð
\8aJ
\82¯
\82½
\81I", s_suffix(mon_nam(mtmp)),
1796 mbodypart(mtmp, STOMACH));
1798 mtmp->mhp = 1; /* almost dead */
1799 expels(mtmp, mtmp->data, !is_animal(mtmp->data));
1805 if (!Is_airlevel(&u.uz) && !Is_waterlevel(&u.uz) && !Underwater) {
1806 if (u.dz < 0 || On_stairs(u.ux, u.uy)) {
1808 if (On_stairs(u.ux, u.uy))
1810 pline_The("beam bounces off the %s and hits the %s.",
1811 (u.ux == xdnladder || u.ux == xupladder)
1814 ceiling(u.ux, u.uy));
1816 pline("
\8cõ
\90ü
\82Í%s
\82Å
\94½
\8eË
\82µ%s
\82É
\96½
\92\86\82µ
\82½
\81D",
1817 (u.ux == xdnladder || u.ux == xupladder)
1820 ceiling(u.ux, u.uy));
1823 You("loosen a rock from the %s.", ceiling(u.ux, u.uy));
1825 pline("%s
\82Ì
\8aâ
\82ª
\83K
\83^
\83K
\83^
\82µ
\82Í
\82¶
\82ß
\82½
\81D", ceiling(u.ux, u.uy));
1827 pline("It falls on your %s!", body_part(HEAD));
1829 pline("
\82»
\82ê
\82Í
\82 \82È
\82½
\82Ì%s
\82É
\97\8e\82¿
\82Ä
\82«
\82½
\81I", body_part(HEAD));
1830 dmg = rnd((uarmh && is_metallic(uarmh)) ? 2 : 6);
1832 losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN);
1834 losehp(Maybe_Half_Phys(dmg), "
\97\8e\8aâ
\82Å", KILLED_BY_AN);
1835 otmp = mksobj_at(ROCK, u.ux, u.uy, FALSE, FALSE);
1837 (void) xname(otmp); /* set dknown, maybe bknown */
1842 watch_dig((struct monst *) 0, u.ux, u.uy, TRUE);
1843 (void) dighole(FALSE, TRUE, (coord *) 0);
1849 /* normal case: digging across the level */
1850 shopdoor = shopwall = FALSE;
1851 maze_dig = level.flags.is_maze_lev && !Is_earthlevel(&u.uz);
1854 if (u.utrap && u.utraptype == TT_PIT
1855 && (trap_with_u = t_at(u.ux, u.uy))) {
1857 for (diridx = 0; diridx < 8; diridx++) {
1858 if (xdir[diridx] == u.dx && ydir[diridx] == u.dy)
1860 /* diridx is valid if < 8 */
1863 digdepth = rn1(18, 8);
1864 tmp_at(DISP_BEAM, cmap_to_glyph(S_digbeam));
1865 while (--digdepth >= 0) {
1868 room = &levl[zx][zy];
1870 delay_output(); /* wait a little bit */
1872 if (pitdig) { /* we are already in a pit if this is true */
1874 struct trap *adjpit = t_at(zx, zy);
1875 if ((diridx < 8) && !conjoined_pits(adjpit, trap_with_u, FALSE)) {
1876 digdepth = 0; /* limited to the adjacent location only */
1877 if (!(adjpit && (adjpit->ttyp == PIT
1878 || adjpit->ttyp == SPIKED_PIT))) {
1882 if (!adj_pit_checks(&cc, buf)) {
1886 /* this can also result in a pool at zx,zy */
1887 dighole(TRUE, TRUE, &cc);
1888 adjpit = t_at(zx, zy);
1892 && (adjpit->ttyp == PIT || adjpit->ttyp == SPIKED_PIT)) {
1893 int adjidx = (diridx + 4) % 8;
1894 trap_with_u->conjoined |= (1 << diridx);
1895 adjpit->conjoined |= (1 << adjidx);
1900 if (is_pool(zx, zy) || is_lava(zx, zy)) {
1907 } else if (closed_door(zx, zy) || room->typ == SDOOR) {
1908 if (*in_rooms(zx, zy, SHOPBASE)) {
1909 add_damage(zx, zy, 400L);
1912 if (room->typ == SDOOR)
1914 else if (cansee(zx, zy))
1916 pline_The("door is razed!");
1918 pline("
\94à
\82Í
\95ö
\82ê
\97\8e\82¿
\82½
\81I");
1919 watch_dig((struct monst *) 0, zx, zy, TRUE);
1920 room->doormask = D_NODOOR;
1921 unblock_point(zx, zy); /* vision */
1925 } else if (maze_dig) {
1926 if (IS_WALL(room->typ)) {
1927 if (!(room->wall_info & W_NONDIGGABLE)) {
1928 if (*in_rooms(zx, zy, SHOPBASE)) {
1929 add_damage(zx, zy, 200L);
1933 unblock_point(zx, zy); /* vision */
1936 pline_The("wall glows then fades.");
1938 pline("
\95Ç
\82Í
\88ê
\8fu
\8bP
\82¢
\82½
\81D");
1940 } else if (IS_TREE(room->typ)) { /* check trees before stone */
1941 if (!(room->wall_info & W_NONDIGGABLE)) {
1943 unblock_point(zx, zy); /* vision */
1946 pline_The("tree shudders but is unharmed.");
1948 pline("
\96Ø
\82Í
\82ä
\82ê
\82½
\82ª
\8f\9d\82Â
\82©
\82È
\82©
\82Á
\82½
\81D");
1950 } else if (room->typ == STONE || room->typ == SCORR) {
1951 if (!(room->wall_info & W_NONDIGGABLE)) {
1953 unblock_point(zx, zy); /* vision */
1956 pline_The("rock glows then fades.");
1958 pline("
\90Î
\82Í
\88ê
\8fu
\8bP
\82¢
\82½
\81D");
1961 } else if (IS_ROCK(room->typ)) {
1962 if (!may_dig(zx, zy))
1964 if (IS_WALL(room->typ) || room->typ == SDOOR) {
1965 if (*in_rooms(zx, zy, SHOPBASE)) {
1966 add_damage(zx, zy, 200L);
1969 watch_dig((struct monst *) 0, zx, zy, TRUE);
1970 if (level.flags.is_cavernous_lev && !in_town(zx, zy)) {
1974 room->doormask = D_NODOOR;
1977 } else if (IS_TREE(room->typ)) {
1980 } else { /* IS_ROCK but not IS_WALL or SDOOR */
1984 unblock_point(zx, zy); /* vision */
1989 tmp_at(DISP_END, 0); /* closing call */
1991 if (pitflow && isok(flow_x, flow_y)) {
1992 struct trap *ttmp = t_at(flow_x, flow_y);
1993 if (ttmp && (ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT)) {
1994 schar filltyp = fillholetyp(ttmp->tx, ttmp->ty, TRUE);
1995 if (filltyp != ROOM)
1996 pit_flow(ttmp, filltyp);
2000 if (shopdoor || shopwall)
2002 pay_for_damage(shopdoor ? "destroy" : "dig into", FALSE);
2004 pay_for_damage(shopdoor ? "
\94j
\89ó
\82·
\82é" : "
\8c\8a\82ð
\82 \82¯
\82é", FALSE);
2009 * This checks what is on the surface above the
2010 * location where an adjacent pit might be created if
2011 * you're zapping a wand of digging laterally while
2015 adj_pit_checks(cc, msg)
2021 const char *foundation_msg =
2023 "The foundation is too hard to dig through from this angle.";
2025 "
\8aî
\91b
\82Í
\82±
\82Ì
\8ap
\93x
\82©
\82ç
\8c@
\82é
\82É
\82Í
\8cÅ
\82·
\82¬
\82é
\81D";
2029 if (!isok(cc->x, cc->y))
2032 room = &levl[cc->x][cc->y];
2035 if (is_pool(cc->x, cc->y) || is_lava(cc->x, cc->y)) {
2036 /* this is handled by the caller after we return FALSE */
2038 } else if (closed_door(cc->x, cc->y) || room->typ == SDOOR) {
2039 /* We reject this here because dighole() isn't
2040 prepared to deal with this case */
2041 Strcpy(msg, foundation_msg);
2043 } else if (IS_WALL(ltyp)) {
2044 /* if (room->wall_info & W_NONDIGGABLE) */
2045 Strcpy(msg, foundation_msg);
2047 } else if (IS_TREE(ltyp)) { /* check trees before stone */
2048 /* if (room->wall_info & W_NONDIGGABLE) */
2050 Strcpy(msg, "The tree's roots glow then fade.");
2052 Strcpy(msg, "
\96Ø
\82Ì
\8dª
\82Í
\88ê
\8fu
\8bP
\82¢
\82½
\81D");
2054 } else if (ltyp == STONE || ltyp == SCORR) {
2055 if (room->wall_info & W_NONDIGGABLE) {
2057 Strcpy(msg, "The rock glows then fades.");
2059 Strcpy(msg, "
\90Î
\82Í
\88ê
\8fu
\8bP
\82¢
\82½
\81D");
2062 } else if (ltyp == IRONBARS) {
2063 /* "set of iron bars" */
2065 Strcpy(msg, "The bars go much deeper than your pit.");
2067 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");
2069 } else if (is_lava(cc->x, cc->y)) {
2070 } else if (is_ice(cc->x, cc->y)) {
2071 } else if (is_pool(cc->x, cc->y)) {
2072 } else if (IS_GRAVE(ltyp)) {
2074 } else if (IS_SINK(ltyp)) {
2076 Strcpy(msg, "A tangled mass of plumbing remains below the sink.");
2078 Strcpy(msg, "
\93ü
\82è
\91g
\82ñ
\82¾
\94z
\8aÇ
\82ª
\97¬
\82µ
\91ä
\82Ì
\89º
\82É
\8ec
\82Á
\82½
\82Ü
\82Ü
\82¾
\81D");
2080 } else if ((cc->x == xupladder && cc->y == yupladder) /* ladder up */
2081 || (cc->x == xdnladder && cc->y == ydnladder)) { /* " down */
2083 Strcpy(msg, "The ladder is unaffected.");
2085 Strcpy(msg, "
\82Í
\82µ
\82²
\82Í
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\81D");
2088 const char *supporting = (const char *) 0;
2090 if (IS_FOUNTAIN(ltyp))
2092 supporting = "fountain";
2094 supporting = "
\90ò";
2095 else if (IS_THRONE(ltyp))
2097 supporting = "throne";
2099 supporting = "
\8bÊ
\8dÀ";
2100 else if (IS_ALTAR(ltyp))
2102 supporting = "altar";
2104 supporting = "
\8dÕ
\92d";
2105 else if ((cc->x == xupstair && cc->y == yupstair)
2106 || (cc->x == sstairs.sx && cc->y == sstairs.sy
2108 /* "staircase up" */
2110 supporting = "stairs";
2112 supporting = "
\8aK
\92i";
2113 else if ((cc->x == xdnstair && cc->y == ydnstair)
2114 || (cc->x == sstairs.sx && cc->y == sstairs.sy
2116 /* "staircase down" */
2118 supporting = "stairs";
2120 supporting = "
\8aK
\92i";
2121 else if (ltyp == DRAWBRIDGE_DOWN /* "lowered drawbridge" */
2122 || ltyp == DBWALL) /* "raised drawbridge" */
2124 supporting = "drawbridge";
2126 supporting = "
\92µ
\82Ë
\8b´";
2130 Sprintf(msg, "The %s%ssupporting structures remain intact.",
2131 supporting ? s_suffix(supporting) : "",
2132 supporting ? " " : "");
2134 Sprintf(msg, "%s%s
\8ex
\82¦
\82Ä
\82¢
\82é
\95\94\95ª
\82Í
\82»
\82Ì
\82Ü
\82Ü
\82¾
\81D",
2135 supporting ? supporting : "",
2136 supporting ? "
\82ð" : "");
2145 * Ensure that all conjoined pits fill up.
2148 pit_flow(trap, filltyp)
2152 if (trap && (filltyp != ROOM)
2153 && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)) {
2158 levl[trap->tx][trap->ty].typ = filltyp;
2159 liquid_flow(trap->tx, trap->ty, filltyp, trap,
2160 (trap->tx == u.ux && trap->ty == u.uy)
2162 ? "Suddenly %s flows in from the adjacent pit!"
2164 ? "
\93Ë
\91R
\97×
\82Ì
\97\8e\82µ
\8c\8a\82©
\82ç%s
\82ª
\97¬
\82ê
\8d\9e\82ñ
\82Å
\82«
\82½
\81I"
2166 for (idx = 0; idx < 8; ++idx) {
2167 if (t.conjoined & (1 << idx)) {
2171 x = t.tx + xdir[idx];
2172 y = t.ty + ydir[idx];
2175 /* cannot do this back-check; liquid_flow()
2176 * called deltrap() which cleaned up the
2177 * conjoined fields on both pits.
2179 if (t2 && (t2->conjoined & (1 << ((idx + 4) % 8))))
2182 pit_flow(t2, filltyp);
2192 xchar check_x, check_y;
2193 struct obj *otmp, *otmp2;
2195 if (u.utraptype == TT_BURIEDBALL)
2196 for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
2198 if (otmp->otyp != HEAVY_IRON_BALL)
2200 /* try the exact location first */
2201 if (otmp->ox == cc->x && otmp->oy == cc->y)
2203 /* Now try the vicinity */
2205 * (x-2,y-2) (x+2,y-2)
2207 * (x-2,y+2) (x+2,y+2)
2209 for (check_x = cc->x - 2; check_x <= cc->x + 2; ++check_x)
2210 for (check_y = cc->y - 2; check_y <= cc->y + 2; ++check_y) {
2211 if (check_x == cc->x && check_y == cc->y)
2213 if (isok(check_x, check_y)
2214 && (otmp->ox == check_x && otmp->oy == check_y)) {
2221 return (struct obj *) 0;
2225 buried_ball_to_punishment()
2231 ball = buried_ball(&cc);
2233 obj_extract_self(ball);
2235 /* rusting buried metallic objects is not implemented yet */
2237 (void) stop_timer(RUST_METAL, obj_to_any(ball));
2239 punish(ball); /* use ball as flag for unearthed buried ball */
2242 del_engr_at(cc.x, cc.y);
2248 buried_ball_to_freedom()
2254 ball = buried_ball(&cc);
2256 obj_extract_self(ball);
2258 /* rusting buried metallic objects is not implemented yet */
2260 (void) stop_timer(RUST_METAL, obj_to_any(ball));
2262 place_object(ball, cc.x, cc.y);
2266 del_engr_at(cc.x, cc.y);
2271 /* move objects from fobj/nexthere lists to buriedobjlist, keeping position
2274 bury_an_obj(otmp, dealloced)
2281 debugpline1("bury_an_obj: %s", xname(otmp));
2284 if (otmp == uball) {
2286 u.utrap = rn1(50, 20);
2287 u.utraptype = TT_BURIEDBALL;
2289 pline_The("iron ball gets buried!");
2291 pline_The("
\93S
\82Ì
\8b\85\82Í
\96\84\82Ü
\82Á
\82½
\81I");
2293 /* after unpunish(), or might get deallocated chain */
2294 otmp2 = otmp->nexthere;
2296 * obj_resists(,0,0) prevents Rider corpses from being buried.
2297 * It also prevents The Amulet and invocation tools from being
2298 * buried. Since they can't be confined to bags and statues,
2299 * it makes sense that they can't be buried either, even though
2300 * the real reason there (direct accessibility when carried) is
2301 * completely different.
2303 if (otmp == uchain || obj_resists(otmp, 0, 0))
2306 if (otmp->otyp == LEASH && otmp->leashmon != 0)
2309 if (otmp->lamplit && otmp->otyp != POT_OIL)
2310 end_burn(otmp, TRUE);
2312 obj_extract_self(otmp);
2314 under_ice = is_ice(otmp->ox, otmp->oy);
2315 if (otmp->otyp == ROCK && !under_ice) {
2316 /* merges into burying material */
2319 obfree(otmp, (struct obj *) 0);
2323 * Start a rot on organic material. Not corpses -- they
2324 * are already handled.
2326 if (otmp->otyp == CORPSE) {
2327 ; /* should cancel timer if under_ice */
2328 } else if ((under_ice ? otmp->oclass == POTION_CLASS : is_organic(otmp))
2329 && !obj_resists(otmp, 5, 95)) {
2330 (void) start_timer((under_ice ? 0L : 250L) + (long) rnd(250),
2331 TIMER_OBJECT, ROT_ORGANIC, obj_to_any(otmp));
2333 /* rusting of buried metal not yet implemented */
2334 } else if (is_rustprone(otmp)) {
2335 (void) start_timer((long) rnd((otmp->otyp == HEAVY_IRON_BALL)
2338 TIMER_OBJECT, RUST_METAL, obj_to_any(otmp));
2341 add_to_buried(otmp);
2349 struct obj *otmp, *otmp2;
2351 if (level.objects[x][y] != (struct obj *) 0) {
2352 debugpline2("bury_objs: at <%d,%d>", x, y);
2354 for (otmp = level.objects[x][y]; otmp; otmp = otmp2)
2355 otmp2 = bury_an_obj(otmp, (boolean *) 0);
2357 /* don't expect any engravings here, but just in case */
2362 /* move objects from buriedobjlist to fobj/nexthere lists */
2367 struct obj *otmp, *otmp2, *bball;
2370 debugpline2("unearth_objs: at <%d,%d>", x, y);
2373 bball = buried_ball(&cc);
2374 for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
2376 if (otmp->ox == x && otmp->oy == y) {
2377 if (bball && otmp == bball && u.utraptype == TT_BURIEDBALL) {
2378 buried_ball_to_punishment();
2380 obj_extract_self(otmp);
2382 (void) stop_timer(ROT_ORGANIC, obj_to_any(otmp));
2383 place_object(otmp, x, y);
2393 * The organic material has rotted away while buried. As an expansion,
2394 * we could add add partial damage. A damage count is kept in the object
2395 * and every time we are called we increment the count and reschedule another
2396 * timeout. Eventually the object rots away.
2398 * This is used by buried objects other than corpses. When a container rots
2399 * away, any contents become newly buried objects.
2403 rot_organic(arg, timeout)
2405 long timeout UNUSED;
2407 struct obj *obj = arg->a_obj;
2409 while (Has_contents(obj)) {
2410 /* We don't need to place contained object on the floor
2411 first, but we do need to update its map coordinates. */
2412 obj->cobj->ox = obj->ox, obj->cobj->oy = obj->oy;
2413 /* Everything which can be held in a container can also be
2414 buried, so bury_an_obj's use of obj_extract_self insures
2415 that Has_contents(obj) will eventually become false. */
2416 (void) bury_an_obj(obj->cobj, (boolean *) 0);
2418 obj_extract_self(obj);
2419 obfree(obj, (struct obj *) 0);
2423 * Called when a corpse has rotted completely away.
2426 rot_corpse(arg, timeout)
2431 struct obj *obj = arg->a_obj;
2432 boolean on_floor = obj->where == OBJ_FLOOR,
2433 in_invent = obj->where == OBJ_INVENT;
2438 } else if (in_invent) {
2439 if (flags.verbose) {
2440 char *cname = corpse_xname(obj, (const char *) 0, CXN_NO_PFX);
2443 Your("%s%s %s away%c", obj == uwep ? "wielded " : "", cname,
2444 otense(obj, "rot"), obj == uwep ? '!' : '.');
2446 pline("
\82 \82È
\82½
\82Ì%s%s
\82Í
\95\85\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½%s",
2447 obj == uwep ? "
\8eè
\82É
\82µ
\82Ä
\82¢
\82é" : "", cname,
2448 obj == uwep ? "
\81I" : "
\81D");
2452 uwepgone(); /* now bare handed */
2454 } else if (obj == uswapwep) {
2457 } else if (obj == uquiver) {
2461 } else if (obj->where == OBJ_MINVENT && obj->owornmask) {
2462 if (obj == MON_WEP(obj->ocarry))
2463 setmnotwielded(obj->ocarry, obj);
2464 } else if (obj->where == OBJ_MIGRATING) {
2465 /* clear destination flag so that obfree()'s check for
2466 freeing a worn object doesn't get a false hit */
2467 obj->owornmask = 0L;
2469 rot_organic(arg, timeout);
2471 struct monst *mtmp = m_at(x, y);
2473 /* a hiding monster may be exposed */
2474 if (mtmp && !OBJ_AT(x, y) && mtmp->mundetected
2475 && hides_under(mtmp->data)) {
2476 mtmp->mundetected = 0;
2477 } else if (x == u.ux && y == u.uy && u.uundetected && hides_under(youmonst.data))
2478 (void) hideunder(&youmonst);
2480 } else if (in_invent)
2489 debugpline1("bury_monst: %s", mon_nam(mtmp));
2490 if (canseemon(mtmp)) {
2491 if (is_flyer(mtmp->data) || is_floater(mtmp->data)) {
2492 pline_The("%s opens up, but %s is not swallowed!",
2493 surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
2496 pline_The("%s opens up and swallows %s!",
2497 surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
2500 mtmp->mburied = TRUE;
2501 wakeup(mtmp); /* at least give it a chance :-) */
2502 newsym(mtmp->mx, mtmp->my);
2508 debugpline0("bury_you");
2509 if (!Levitation && !Flying) {
2512 You_feel("a sensation like falling into a trap!");
2514 You("ã©
\82É
\97\8e\82¿
\82é
\82æ
\82¤
\82È
\8a´
\8ao
\82É
\82¨
\82»
\82í
\82ê
\82½
\81I");
2517 pline_The("%s opens beneath you and you fall in!",
2519 pline("%s
\82ª
\89º
\95û
\82É
\8aJ
\82«
\81C
\82 \82È
\82½
\82Í
\97\8e\82¿
\82½
\81I",
2520 surface(u.ux, u.uy));
2523 if (!Strangled && !Breathless)
2532 debugpline0("unearth_you");
2535 if (!uamul || uamul->otyp != AMULET_OF_STRANGULATION)
2543 debugpline0("escape_tomb");
2544 if ((Teleportation || can_teleport(youmonst.data))
2545 && (Teleport_control || rn2(3) < Luck+2)) {
2547 You("attempt a teleport spell.");
2549 You("
\8fu
\8aÔ
\88Ú
\93®
\82ð
\8e\8e\82Ý
\82½
\81D");
2550 (void) dotele(); /* calls unearth_you() */
2551 } else if (u.uburied) { /* still buried after 'port attempt */
2554 if (amorphous(youmonst.data) || Passes_walls
2555 || noncorporeal(youmonst.data)
2556 || (unsolid(youmonst.data)
2557 && youmonst.data != &mons[PM_WATER_ELEMENTAL])
2558 || (tunnels(youmonst.data) && !needspick(youmonst.data))) {
2560 You("%s up through the %s.",
2561 (tunnels(youmonst.data) && !needspick(youmonst.data))
2563 : (amorphous(youmonst.data))
2566 surface(u.ux, u.uy));
2568 You("%s
\82É%s
\82ë
\82¤
\82Æ
\82µ
\82½
\81D",
2569 surface(u.ux, u.uy),
2570 (tunnels(youmonst.data) && !needspick(youmonst.data))
2571 ? "
\83g
\83\93\83l
\83\8b\82ð
\8c@"
2572 : (amorphous(youmonst.data))
2573 ? "
\82É
\82¶
\82Ý
\82Ì
\82Ú"
2574 : "
\8f\99\81X
\82É
\82Í
\82¢
\82 \82ª");
2577 good = (tunnels(youmonst.data) && !needspick(youmonst.data))
2578 ? dighole(TRUE, FALSE, (coord *)0) : TRUE;
2589 debugpline0("bury_obj");
2590 if (cansee(otmp->ox, otmp->oy))
2592 pline_The("objects on the %s tumble into a hole!",
2594 pline_The("%s
\82Ì
\95¨
\91Ì
\82Í
\8c\8a\82É
\93]
\82ª
\82Á
\82½
\81I",
2595 surface(otmp->ox, otmp->oy));
2597 bury_objs(otmp->ox, otmp->oy);
2602 /* bury everything at your loc and around */
2604 wiz_debug_cmd_bury()
2608 for (x = u.ux - 1; x <= u.ux + 1; x++)
2609 for (y = u.uy - 1; y <= u.uy + 1; y++)