1 /* NetHack 3.6 vault.c $NHDT-Date: 1446078792 2015/10/29 00:33:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ */
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_DCL struct monst *NDECL(findgd);
14 STATIC_DCL boolean FDECL(clear_fcorr, (struct monst *, BOOLEAN_P));
15 STATIC_DCL void FDECL(blackout, (int, int));
16 STATIC_DCL void FDECL(restfakecorr, (struct monst *));
17 STATIC_DCL boolean FDECL(in_fcorridor, (struct monst *, int, int));
18 STATIC_DCL void FDECL(move_gold, (struct obj *, int));
19 STATIC_DCL void FDECL(wallify_vault, (struct monst *));
26 mtmp->mextra = newmextra();
28 EGD(mtmp) = (struct egd *) alloc(sizeof(struct egd));
29 (void) memset((genericptr_t) EGD(mtmp), 0, sizeof(struct egd));
37 if (mtmp->mextra && EGD(mtmp)) {
38 free((genericptr_t) EGD(mtmp));
39 EGD(mtmp) = (struct egd *) 0;
45 clear_fcorr(grd, forceshow)
49 register int fcx, fcy, fcbeg;
51 boolean sawcorridor = FALSE;
52 struct egd *egrd = EGD(grd);
56 if (!on_level(&egrd->gdlevel, &u.uz))
59 while ((fcbeg = egrd->fcbeg) < egrd->fcend) {
60 fcx = egrd->fakecorr[fcbeg].fx;
61 fcy = egrd->fakecorr[fcbeg].fy;
62 if ((grd->mhp <= 0 || !in_fcorridor(grd, u.ux, u.uy)) && egrd->gddone)
64 if ((u.ux == fcx && u.uy == fcy && grd->mhp > 0)
65 || (!forceshow && couldsee(fcx, fcy))
66 || (Punished && !carried(uball) && uball->ox == fcx
70 if ((mtmp = m_at(fcx, fcy)) != 0) {
73 } else if (!in_fcorridor(grd, u.ux, u.uy)) {
76 (void) rloc(mtmp, FALSE);
79 lev = &levl[fcx][fcy];
80 if (lev->typ == CORR && cansee(fcx, fcy))
82 lev->typ = egrd->fakecorr[fcbeg].ftyp;
83 if (IS_STWALL(lev->typ)) {
84 /* destroy any trap here (pit dug by you, hole dug via
85 wand while levitating or by monster, bear trap or land
86 mine via object, spun web) when spot reverts to stone */
87 if ((trap = t_at(fcx, fcy)) != 0)
89 /* undo scroll/wand/spell of light affecting this spot */
90 if (lev->typ == STONE)
93 map_location(fcx, fcy, 1); /* bypass vision */
94 if (!ACCESSIBLE(lev->typ))
95 block_point(fcx, fcy);
96 vision_full_recalc = 1;
101 pline_The("corridor disappears.");
103 pline("
\92Ê
\98H
\82Í
\8fÁ
\82¦
\82½
\81D");
104 if (IS_ROCK(levl[u.ux][u.uy].typ))
106 You("are encased in rock.");
108 You("
\90Î
\82É
\82Â
\82Â
\82Ü
\82ê
\82½
\81D");
112 /* as a temporary corridor is removed, set stone locations and adjacent
113 spots to unlit; if player used scroll/wand/spell of light while inside
114 the corridor, we don't want the light to reappear if/when a new tunnel
115 goes through the same area */
123 for (i = x - 1; i <= x + 1; ++i)
124 for (j = y - 1; j <= y + 1; ++j) {
128 /* [possible bug: when (i != x || j != y), perhaps we ought
129 to check whether the spot on the far side is lit instead
130 of doing a blanket blackout of adjacent locations] */
131 if (lev->typ == STONE)
132 lev->lit = lev->waslit = 0;
133 /* mark <i,j> as not having been seen from <x,y> */
134 unset_seenv(lev, x, y, i, j);
142 /* it seems you left the corridor - let the guard disappear */
143 if (clear_fcorr(grd, FALSE)) {
144 grd->isgd = 0; /* dmonsfree() should delete this mon */
149 /* called in mon.c */
154 boolean dispose = clear_fcorr(grd, TRUE);
157 /* destroy guard's gold; drop any other inventory */
158 relobj(grd, 0, FALSE);
159 /* guard is dead; monster traversal loops should skip it */
161 if (grd == context.polearm.hitmon)
162 context.polearm.hitmon = 0;
163 /* see comment by newpos in gd_move() */
164 remove_monster(grd->mx, grd->my);
165 newsym(grd->mx, grd->my);
166 place_monster(grd, 0, 0);
167 EGD(grd)->ogx = grd->mx;
168 EGD(grd)->ogy = grd->my;
169 dispose = clear_fcorr(grd, TRUE);
172 grd->isgd = 0; /* for dmonsfree() */
177 in_fcorridor(grd, x, y)
182 struct egd *egrd = EGD(grd);
184 for (fci = egrd->fcbeg; fci < egrd->fcend; fci++)
185 if (x == egrd->fakecorr[fci].fx && y == egrd->fakecorr[fci].fy)
194 register struct monst *mtmp;
196 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
197 if (DEADMONSTER(mtmp))
199 if (mtmp->isgd && on_level(&(EGD(mtmp)->gdlevel), &u.uz))
202 return (struct monst *) 0;
206 vault_occupied(array)
211 for (ptr = array; *ptr; ptr++)
212 if (rooms[*ptr - ROOMOFFSET].rtype == VAULT)
221 int dummy; /* hack to avoid schain botch */
225 int trycount, vaultroom = (int) vault_occupied(u.urooms);
232 vaultroom -= ROOMOFFSET;
235 if (++u.uinvault % 30 == 0 && !guard) { /* if time ok and no guard now. */
237 register int x, y, dd, gx, gy;
241 /* first find the goal for the guard */
242 for (dd = 2; (dd < ROWNO || dd < COLNO); dd++) {
243 for (y = u.uy - dd; y <= u.uy + dd; ly = y, y++) {
244 if (y < 0 || y > ROWNO - 1)
246 for (x = u.ux - dd; x <= u.ux + dd; lx = x, x++) {
247 if (y != u.uy - dd && y != u.uy + dd && x != u.ux - dd)
249 if (x < 1 || x > COLNO - 1)
251 if (levl[x][y].typ == CORR) {
264 if (levl[lx][ly].typ != STONE
265 && levl[lx][ly].typ != CORR)
274 impossible("Not a single corridor on this level??");
281 /* next find a good place for a door in the wall */
284 if (levl[x][y].typ != ROOM) { /* player dug a door and is in it */
285 if (levl[x + 1][y].typ == ROOM)
287 else if (levl[x][y + 1].typ == ROOM)
289 else if (levl[x - 1][y].typ == ROOM)
291 else if (levl[x][y - 1].typ == ROOM)
293 else if (levl[x + 1][y + 1].typ == ROOM) {
296 } else if (levl[x - 1][y - 1].typ == ROOM) {
299 } else if (levl[x + 1][y - 1].typ == ROOM) {
302 } else if (levl[x - 1][y + 1].typ == ROOM) {
307 while (levl[x][y].typ == ROOM) {
310 dx = (gx > x) ? 1 : (gx < x) ? -1 : 0;
311 dy = (gy > y) ? 1 : (gy < y) ? -1 : 0;
312 if (abs(gx - x) >= abs(gy - y))
317 if (x == u.ux && y == u.uy) {
318 if (levl[x + 1][y].typ == HWALL || levl[x + 1][y].typ == DOOR)
320 else if (levl[x - 1][y].typ == HWALL
321 || levl[x - 1][y].typ == DOOR)
323 else if (levl[x][y + 1].typ == VWALL
324 || levl[x][y + 1].typ == DOOR)
326 else if (levl[x][y - 1].typ == VWALL
327 || levl[x][y - 1].typ == DOOR)
333 /* make something interesting happen */
334 if (!(guard = makemon(&mons[PM_GUARD], x, y, MM_EGD)))
337 guard->mpeaceful = 1;
339 EGD(guard)->gddone = 0;
342 assign_level(&(EGD(guard)->gdlevel), &u.uz);
343 EGD(guard)->vroom = vaultroom;
344 EGD(guard)->warncnt = 0;
346 reset_faint(); /* if fainted - wake up */
347 gsensed = !canspotmon(guard);
350 pline("Suddenly one of the Vault's %s enters!",
351 makeplural(guard->data->mname));
353 pline("
\93Ë
\91R
\81C
\91q
\8cÉ
\82Ì
\94Ô
\95º
\82ª
\93ü
\82Á
\82Ä
\82«
\82½
\81I");
357 pline("Someone else has entered the Vault.");
359 pline("
\92N
\82©
\82ª
\91q
\8cÉ
\82É
\93ü
\82Á
\82Ä
\82«
\82½
\81D");
360 newsym(guard->mx, guard->my);
362 /* can't interrogate hero, don't interrogate engulfer */
363 verbalize("What's going on here?");
365 pline_The("other presence vanishes.");
369 if (youmonst.m_ap_type == M_AP_OBJECT || u.uundetected) {
370 if (youmonst.m_ap_type == M_AP_OBJECT
371 && youmonst.mappearance != GOLD_PIECE)
373 verbalize("Hey! Who left that %s in here?",
375 verbalize("
\82¨
\82¢
\81I
\82¾
\82ê
\82ª
\82±
\82Ì%s
\82ð
\82±
\82±
\82É
\92u
\82¢
\82Ä
\8ds
\82Á
\82½
\82ñ
\82¾
\81H",
376 mimic_obj_name(&youmonst));
377 /* You're mimicking some object or you're hidden. */
379 pline("Puzzled, %s turns around and leaves.", mhe(guard));
381 pline("%s
\82Í
\8d¢
\98f
\82µ
\82È
\82ª
\82ç
\81C
\8cü
\82«
\92¼
\82Á
\82Ä
\8b\8e\82Á
\82Ä
\82¢
\82Á
\82½
\81D", mhe(guard));
385 if (Strangled || is_silent(youmonst.data) || multi < 0) {
386 /* [we ought to record whether this this message has already
387 been given in order to vary it upon repeat visits, but
388 discarding the monster and its egd data renders that hard] */
390 verbalize("I'll be back when you're ready to speak to me!");
392 verbalize("
\98b
\82¹
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
\82ç
\96ß
\82Á
\82Ä
\82«
\82Ä
\82â
\82é
\81I");
397 stop_occupation(); /* if occupied, stop it *now* */
405 getlin("\"Hello stranger, who are you?\" -", buf);
407 getlin("
\81u
\8c©
\82È
\82¢
\8aç
\82¾
\82È
\81C
\82¨
\82Ü
\82¦
\82Í
\92N
\82¾
\81H
\81v-", buf);
408 (void) mungspaces(buf);
410 } while (!letter(buf[0]) && --trycount > 0);
412 } while (!letter(buf[0]) && !is_kanji(buf[0]) && --trycount > 0);
415 if (u.ualign.type == A_LAWFUL
416 /* ignore trailing text, in case player includes rank */
417 && strncmpi(buf, plname, (int) strlen(plname)) != 0) {
418 adjalign(-1); /* Liar! */
422 if (!strcmpi(buf, "Croesus") || !strcmpi(buf, "Kroisos")
423 || !strcmpi(buf, "Creosote")) {
425 if (!strcmpi(buf, "Croesus") || !strcmpi(buf, "Kroisos")
426 || !strcmpi(buf, "Creosote")
427 || !strcmp(buf, "
\83N
\83\8d\83C
\83\
\83X") || !strcmp(buf, "
\83N
\83\8c\83I
\83\
\81[
\83g")) {
429 if (!mvitals[PM_CROESUS].died) {
432 "Oh, yes, of course. Sorry to have disturbed you.");
434 "
\82¢
\82â
\81C
\82±
\82è
\82á
\81C
\82¦
\81[
\82Æ
\81C
\82¨
\91\9b\82ª
\82¹
\82µ
\82Ü
\82µ
\82½
\81D");
439 verbalize("Back from the dead, are you? I'll remedy that!");
441 verbalize("
\82Ù
\82¤
\81I
\8e\80\82Ì
\90¢
\8aE
\82©
\82ç
\96ß
\82Á
\82Ä
\82«
\82½
\82Ì
\82©
\81H
\82¤
\82»
\82È
\82ç
\8fã
\8eè
\82É
\82Â
\82¯
\81I");
442 /* don't want guard to waste next turn wielding a weapon */
443 if (!MON_WEP(guard)) {
444 guard->weapon_check = NEED_HTH_WEAPON;
445 (void) mon_wield_item(guard);
451 verbalize("I don't know you.");
453 verbalize("
\92m
\82ç
\82ñ
\82È
\81D");
454 umoney = money_cnt(invent);
457 } else if (!umoney && !hidden_gold()) {
459 verbalize("Please follow me.");
461 verbalize("
\8e\84\82Ì
\8cã
\82É
\82Â
\82¢
\82Ä
\82«
\82È
\82³
\82¢
\81D");
465 verbalize("You have hidden gold.");
467 verbalize("
\82Ü
\82¾
\8bà
\89Ý
\82ð
\89B
\82µ
\82Ä
\82é
\82È
\81D");
470 "Most likely all your gold was stolen from this vault.");
472 "
\91q
\8cÉ
\82©
\82ç
\93\90\82ñ
\82¾
\8bà
\89Ý
\82ª
\82 \82é
\82¾
\82ë
\82¤
\81D");
474 verbalize("Please drop that gold and follow me.");
476 verbalize("
\82»
\82ê
\82ð
\82»
\82Á
\82
\82è
\96ß
\82µ
\82Ä
\82©
\82ç
\81C
\8e\84\82Ì
\8cã
\82É
\82Â
\82¢
\82Ä
\82«
\82È
\82³
\82¢
\81D");
478 EGD(guard)->gdx = gx;
479 EGD(guard)->gdy = gy;
480 EGD(guard)->fcbeg = 0;
481 EGD(guard)->fakecorr[0].fx = x;
482 EGD(guard)->fakecorr[0].fy = y;
483 if (IS_WALL(levl[x][y].typ))
484 EGD(guard)->fakecorr[0].ftyp = levl[x][y].typ;
485 else { /* the initial guard location is a dug door */
486 int vlt = EGD(guard)->vroom;
487 xchar lowx = rooms[vlt].lx, hix = rooms[vlt].hx;
488 xchar lowy = rooms[vlt].ly, hiy = rooms[vlt].hy;
490 if (x == lowx - 1 && y == lowy - 1)
491 EGD(guard)->fakecorr[0].ftyp = TLCORNER;
492 else if (x == hix + 1 && y == lowy - 1)
493 EGD(guard)->fakecorr[0].ftyp = TRCORNER;
494 else if (x == lowx - 1 && y == hiy + 1)
495 EGD(guard)->fakecorr[0].ftyp = BLCORNER;
496 else if (x == hix + 1 && y == hiy + 1)
497 EGD(guard)->fakecorr[0].ftyp = BRCORNER;
498 else if (y == lowy - 1 || y == hiy + 1)
499 EGD(guard)->fakecorr[0].ftyp = HWALL;
500 else if (x == lowx - 1 || x == hix + 1)
501 EGD(guard)->fakecorr[0].ftyp = VWALL;
503 levl[x][y].typ = DOOR;
504 levl[x][y].doormask = D_NODOOR;
505 unblock_point(x, y); /* doesn't block light */
506 EGD(guard)->fcend = 1;
507 EGD(guard)->warncnt = 1;
512 move_gold(gold, vroom)
519 newsym(gold->ox, gold->oy);
520 nx = rooms[vroom].lx + rn2(2);
521 ny = rooms[vroom].ly + rn2(2);
522 place_object(gold, nx, ny);
532 int vlt = EGD(grd)->vroom;
534 xchar lox = rooms[vlt].lx - 1, hix = rooms[vlt].hx + 1,
535 loy = rooms[vlt].ly - 1, hiy = rooms[vlt].hy + 1;
539 boolean fixed = FALSE;
540 boolean movedgold = FALSE;
542 for (x = lox; x <= hix; x++)
543 for (y = loy; y <= hiy; y++) {
544 /* if not on the room boundary, skip ahead */
545 if (x != lox && x != hix && y != loy && y != hiy)
548 if (!IS_WALL(levl[x][y].typ) && !in_fcorridor(grd, x, y)) {
549 if ((mon = m_at(x, y)) != 0 && mon != grd) {
552 (void) rloc(mon, FALSE);
554 if ((gold = g_at(x, y)) != 0) {
555 move_gold(gold, EGD(grd)->vroom);
558 if ((trap = t_at(x, y)) != 0)
562 (y == loy) ? TLCORNER : (y == hiy) ? BLCORNER : VWALL;
565 (y == loy) ? TRCORNER : (y == hiy) ? BRCORNER : VWALL;
566 else /* not left or right side, must be top or bottom */
568 levl[x][y].typ = typ;
569 levl[x][y].doormask = 0;
571 * hack: player knows walls are restored because of the
572 * message, below, so show this on the screen.
574 tmp_viz = viz_array[y][x];
575 viz_array[y][x] = IN_SIGHT | COULD_SEE;
577 viz_array[y][x] = tmp_viz;
583 if (movedgold || fixed) {
584 if (in_fcorridor(grd, grd->mx, grd->my) || cansee(grd->mx, grd->my))
586 pline("%s whispers an incantation.", noit_Monnam(grd));
588 pline("%s
\82Í
\8eô
\95¶
\82ð
\82³
\82³
\82â
\82¢
\82½
\81D", noit_Monnam(grd));
591 You_hear("a distant chant.");
593 You_hear("
\89\93\95û
\82Å
\82Ì
\8eô
\95¶
\82ð
\95·
\82¢
\82½
\81D");
596 pline("A mysterious force moves the gold into the vault.");
598 pline("
\95s
\8ev
\8bc
\82È
\97Í
\82ª
\8bà
\89Ý
\82ð
\91q
\8cÉ
\82Ö
\89^
\82ñ
\82¾
\81D");
601 pline_The("damaged vault's walls are magically restored!");
603 pline("
\8f\9d\82Â
\82¢
\82½
\91q
\8cÉ
\82Ì
\95Ç
\82Í
\96\82\96@
\82Å
\95\9c\8c³
\82³
\82ê
\82½
\81I");
608 * return 1: guard moved, 0: guard didn't, -1: let m_move do it, -2: died
612 register struct monst *grd;
614 int x, y, nx, ny, m, n;
615 int dx, dy, gx, gy, fci;
617 struct fakecorridor *fcp;
618 register struct egd *egrd = EGD(grd);
620 boolean goldincorridor = FALSE,
621 u_in_vault = vault_occupied(u.urooms) ? TRUE : FALSE,
622 grd_in_vault = *in_rooms(grd->mx, grd->my, VAULT) ? TRUE : FALSE;
623 boolean disappear_msg_seen = FALSE, semi_dead = (grd->mhp <= 0);
624 long umoney = money_cnt(invent);
625 register boolean u_carry_gold = ((umoney + hidden_gold()) > 0L);
626 boolean see_guard, newspot = FALSE;
628 if (!on_level(&(egrd->gdlevel), &u.uz))
631 if (!u_in_vault && !grd_in_vault)
633 if (!grd->mpeaceful) {
639 && (grd_in_vault || (in_fcorridor(grd, grd->mx, grd->my)
640 && !in_fcorridor(grd, u.ux, u.uy)))) {
641 (void) rloc(grd, FALSE);
643 (void) clear_fcorr(grd, TRUE);
646 if (!in_fcorridor(grd, grd->mx, grd->my))
647 (void) clear_fcorr(grd, TRUE);
650 if (abs(egrd->ogx - grd->mx) > 1 || abs(egrd->ogy - grd->my) > 1)
651 return -1; /* teleported guard - treat as monster */
654 verbalize("How dare you %s that gold, scoundrel!",
655 (egrd->witness & GD_EATGOLD) ? "consume" : "destroy");
660 if (egrd->fcend == 1) {
661 if (u_in_vault && (u_carry_gold || um_dist(grd->mx, grd->my, 1))) {
662 if (egrd->warncnt == 3 && !Deaf)
664 verbalize("I repeat, %sfollow me!",
666 ? (!umoney ? "drop that hidden money and "
667 : "drop that money and ")
670 verbalize("
\8cJ
\82è
\95Ô
\82·
\81I%s
\8e\84\82É
\82Â
\82¢
\82Ä
\82±
\82¢
\81I",
672 ? (!umoney ? "
\89B
\82µ
\8e\9d\82Á
\82Ä
\82é
\8bà
\82ð
\92u
\82¢
\82Ä"
673 : "
\8bà
\82ð
\92u
\82¢
\82Ä")
676 if (egrd->warncnt == 7) {
681 verbalize("You've been warned, knave!");
683 verbalize("
\8cx
\8d\90\82Í
\82µ
\82½
\82¼
\81C
\88«
\93}
\82ß
\81I");
685 levl[m][n].typ = egrd->fakecorr[0].ftyp;
690 /* not fair to get mad when (s)he's fainted or paralyzed */
691 if (!is_fainted() && multi >= 0)
697 if (u_carry_gold) { /* player teleported */
700 (void) rloc(grd, TRUE);
701 levl[m][n].typ = egrd->fakecorr[0].ftyp;
705 if (!cansee(grd->mx, grd->my) || !mon_visible(grd))
707 You_hear("the shrill sound of a guard's whistle.");
709 You_hear("
\94Ô
\95º
\82Ì
\89s
\82¢
\93J
\82Ì
\89¹
\82ð
\95·
\82¢
\82½
\81D");
712 You(um_dist(grd->mx, grd->my, 2)
713 ? "see %s approaching."
714 : "are confronted by %s.",
715 /* "an angry guard" */
716 x_monnam(grd, ARTICLE_A, "angry", 0, FALSE));
718 You(um_dist(grd->mx, grd->my, 2)
719 ? "%s
\82ª
\8bß
\82Ã
\82¢
\82Ä
\82
\82é
\82Ì
\82ð
\8c©
\82½
\81D"
720 : "%s
\82Æ
\91Î
\9b³
\82µ
\82½
\81D",
721 x_monnam(grd, ARTICLE_A, "
\93{
\82Á
\82½", 0, FALSE));
727 verbalize("Well, begone.");
729 verbalize("
\97§
\82¿
\8b\8e\82ê
\81D");
737 if (egrd->fcend > 1) {
738 if (egrd->fcend > 2 && in_fcorridor(grd, grd->mx, grd->my)
739 && !egrd->gddone && !in_fcorridor(grd, u.ux, u.uy)
740 && levl[egrd->fakecorr[0].fx][egrd->fakecorr[0].fy].typ
741 == egrd->fakecorr[0].ftyp) {
743 pline("%s, confused, disappears.", noit_Monnam(grd));
745 pline("%s
\82Í
\8d¬
\97\90\82µ
\81C
\8fÁ
\82¦
\82½
\81D", noit_Monnam(grd));
746 disappear_msg_seen = TRUE;
749 if (u_carry_gold && (in_fcorridor(grd, u.ux, u.uy)
750 /* cover a 'blind' spot */
751 || (egrd->fcend > 1 && u_in_vault))) {
756 if (egrd->warncnt < 6) {
760 verbalize("Drop all your gold, scoundrel!");
762 verbalize("
\8bà
\82ð
\91S
\95\94\92u
\82¢
\82Ä
\82ä
\82¯
\81C
\82È
\82ç
\82¸
\82à
\82Ì
\81I");
767 verbalize("So be it, rogue!");
769 verbalize("
\93\90\90l
\82ß
\81I");
775 for (fci = egrd->fcbeg; fci < egrd->fcend; fci++)
776 if (g_at(egrd->fakecorr[fci].fx, egrd->fakecorr[fci].fy)) {
777 m = egrd->fakecorr[fci].fx;
778 n = egrd->fakecorr[fci].fy;
779 goldincorridor = TRUE;
781 if (goldincorridor && !egrd->gddone) {
784 if (m == u.ux && n == u.uy) {
785 struct obj *gold = g_at(m, n);
786 /* Grab the gold from between the hero's feet. */
787 obj_extract_self(gold);
788 add_to_minv(grd, gold);
790 } else if (m == x && n == y) {
791 mpickgold(grd); /* does a newsym */
793 /* just for insurance... */
794 if (MON_AT(m, n) && m != grd->mx && n != grd->my) {
797 verbalize("Out of my way, scum!");
799 verbalize("
\96Ú
\82Ì
\91O
\82©
\82ç
\8fÁ
\82¦
\82ë
\81C
\83N
\83\
\82Á
\82½
\82ê
\81I");
800 (void) rloc(m_at(m, n), FALSE);
802 remove_monster(grd->mx, grd->my);
803 newsym(grd->mx, grd->my);
804 place_monster(grd, m, n);
805 mpickgold(grd); /* does a newsym */
809 pline("%s%s picks up the gold.", Monnam(grd),
810 grd->mpeaceful ? " calms down and" : "");
812 pline("%s
\82Í%s
\8bà
\89Ý
\82ð
\8fE
\82Á
\82½
\81D", Monnam(grd),
813 grd->mpeaceful ? "
\93{
\82è
\82ð
\90Ã
\82ß" : "");
815 if (x != grd->mx || y != grd->my) {
816 remove_monster(grd->mx, grd->my);
817 newsym(grd->mx, grd->my);
818 place_monster(grd, x, y);
826 if (um_dist(grd->mx, grd->my, 1) || egrd->gddone) {
827 if (!egrd->gddone && !rn2(10) && !Deaf && !u.uswallow
828 && !(u.ustuck && !sticks(youmonst.data)))
830 verbalize("Move along!");
832 verbalize("
\97£
\82ê
\82é
\82È
\81I");
834 return 0; /* didn't move */
842 /* look around (hor & vert only) for accessible places */
843 for (nx = x - 1; nx <= x + 1; nx++)
844 for (ny = y - 1; ny <= y + 1; ny++) {
845 if ((nx == x || ny == y) && (nx != x || ny != y)
847 typ = (crm = &levl[nx][ny])->typ;
848 if (!IS_STWALL(typ) && !IS_POOL(typ)) {
849 if (in_fcorridor(grd, nx, ny))
852 if (*in_rooms(nx, ny, VAULT))
855 /* seems we found a good place to leave him alone */
865 crm->typ = (typ == SCORR) ? CORR : DOOR;
867 if (crm->typ == DOOR)
868 crm->doormask = D_NODOOR;
880 dx = (gx > x) ? 1 : (gx < x) ? -1 : 0;
881 dy = (gy > y) ? 1 : (gy < y) ? -1 : 0;
882 if (abs(gx - x) >= abs(gy - y))
887 while ((typ = (crm = &levl[nx][ny])->typ) != 0) {
888 /* in view of the above we must have IS_WALL(typ) or typ == POOL */
889 /* must be a wall here */
890 if (isok(nx + nx - x, ny + ny - y) && !IS_POOL(typ)
891 && IS_ROOM(levl[nx + nx - x][ny + ny - y].typ)) {
893 crm->doormask = D_NODOOR;
907 /* I don't like this, but ... */
910 crm->doormask = D_NODOOR;
918 unblock_point(nx, ny); /* doesn't block light */
922 fcp = &(egrd->fakecorr[egrd->fcend]);
923 if (egrd->fcend++ == FCSIZ)
924 panic("fakecorr overflow");
930 /* The following is a kludge. We need to keep */
931 /* the guard around in order to be able to make */
932 /* the fake corridor disappear as the player */
933 /* moves out of it, but we also need the guard */
934 /* out of the way. We send the guard to never- */
935 /* never land. We set ogx ogy to mx my in order */
936 /* to avoid a check at the top of this function. */
937 /* At the end of the process, the guard is killed */
938 /* in restfakecorr(). */
943 see_guard = canspotmon(grd);
945 remove_monster(grd->mx, grd->my);
946 newsym(grd->mx, grd->my);
947 place_monster(grd, 0, 0);
951 if (!semi_dead && (in_fcorridor(grd, u.ux, u.uy) || cansee(x, y))) {
952 if (!disappear_msg_seen && see_guard)
954 pline("Suddenly, %s disappears.", noit_mon_nam(grd));
956 pline("
\93Ë
\91R
\81C%s
\82Í
\8fÁ
\82¦
\82½
\81D", noit_mon_nam(grd));
961 egrd->ogx = grd->mx; /* update old positions */
963 remove_monster(grd->mx, grd->my);
964 place_monster(grd, nx, ny);
965 if (newspot && g_at(nx, ny)) {
966 /* if there's gold already here (most likely from mineralize()),
967 pick it up now so that guard doesn't later think hero dropped
968 it and give an inappropriate message */
971 pline("%s picks up some gold.", Monnam(grd));
973 newsym(grd->mx, grd->my);
978 /* Routine when dying or quitting with a vault guard around */
982 register struct monst *grd = findgd();
983 long umoney = money_cnt(invent);
984 struct obj *coins, *nextcoins;
993 Your("%ld %s goes into the Magic Memory Vault.", umoney,
996 Your("%ld%s
\82Í
\96\82\96@
\82Ì
\8bL
\94O
\91q
\8cÉ
\82É
\93ü
\82Á
\82½
\81D", umoney,
1002 if (grd->mpeaceful) { /* guard has no "right" to your gold */
1008 pline("%s remits your gold to the vault.", Monnam(grd));
1010 pline("%s
\82Í
\82 \82È
\82½
\82Ì
\8bà
\89Ý
\82ð
\91q
\8cÉ
\82É
\91\97\82Á
\82½
\81D", Monnam(grd));
1011 gx = rooms[EGD(grd)->vroom].lx + rn2(2);
1012 gy = rooms[EGD(grd)->vroom].ly + rn2(2);
1014 Sprintf(buf, "To Croesus: here's the gold recovered from %s the %s.",
1015 plname, mons[u.umonster].mname);
1017 Sprintf(buf, "
\83N
\83\8d\83C
\83\
\83X
\82Ö:
\82±
\82±
\82É%s
\82Ì%s
\82©
\82ç
\8eæ
\82è
\96ß
\82µ
\82½
\8bà
\89Ý
\82ð
\91\97\82é
\81D",
1018 mons[u.umonster].mname, plname);
1020 make_grave(gx, gy, buf);
1022 for (coins = invent; coins; coins = nextcoins) {
1023 nextcoins = coins->nobj;
1024 if (objects[coins->otyp].oc_class == COIN_CLASS) {
1026 place_object(coins, gx, gy);
1039 for (obj = invent; obj; obj = obj->nobj)
1040 if (Has_contents(obj))
1041 value += contained_gold(obj);
1042 /* unknown gold stuck inside statues may cause some consternation... */
1047 /* prevent "You hear footsteps.." when inappropriate */
1051 struct monst *grd = findgd();
1053 if (vault_occupied(u.urooms))
1056 return (boolean) (grd == (struct monst *) 0);
1060 vault_gd_watching(activity)
1061 unsigned int activity;
1063 struct monst *guard = findgd();
1065 if (guard && guard->mcansee && m_canseeu(guard)) {
1066 if (activity == GD_EATGOLD || activity == GD_DESTROYGOLD)
1067 EGD(guard)->witness = activity;