OSDN Git Service

patch src/
[jnethack/source.git] / src / lock.c
1 /* NetHack 3.6  lock.c  $NHDT-Date: 1446955300 2015/11/08 04:01:40 $  $NHDT-Branch: master $:$NHDT-Revision: 1.67 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
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. */
9
10 #include "hack.h"
11
12 STATIC_PTR int NDECL(picklock);
13 STATIC_PTR int NDECL(forcelock);
14
15 /* at most one of `door' and `box' should be non-null at any given time */
16 STATIC_VAR NEARDATA struct xlock_s {
17     struct rm *door;
18     struct obj *box;
19     int picktyp, /* key|pick|card for unlock, sharp vs blunt for #force */
20         chance, usedtime;
21 } xlock;
22
23 STATIC_DCL const char *NDECL(lock_action);
24 STATIC_DCL boolean FDECL(obstructed, (int, int, BOOLEAN_P));
25 STATIC_DCL void FDECL(chest_shatter_msg, (struct obj *));
26
27 boolean
28 picking_lock(x, y)
29 int *x, *y;
30 {
31     if (occupation == picklock) {
32         *x = u.ux + u.dx;
33         *y = u.uy + u.dy;
34         return TRUE;
35     } else {
36         *x = *y = 0;
37         return FALSE;
38     }
39 }
40
41 boolean
42 picking_at(x, y)
43 int x, y;
44 {
45     return (boolean) (occupation == picklock && xlock.door == &levl[x][y]);
46 }
47
48 /* produce an occupation string appropriate for the current activity */
49 STATIC_OVL const char *
50 lock_action()
51 {
52     /* "unlocking"+2 == "locking" */
53     static const char *actions[] = {
54 #if 0 /*JP*/
55         "unlocking the door",   /* [0] */
56         "unlocking the chest",  /* [1] */
57         "unlocking the box",    /* [2] */
58         "picking the lock"      /* [3] */
59 #else 
60         "\94à\82Ì\8c®\82ð\82Í\82¸\82·", 
61         "\95ó\94 \82Ì\8c®\82ð\82Í\82¸\82·",
62         "\94 \82Ì\8c®\82ð\82Í\82¸\82·",
63         "\8c®\82ð\82Í\82¸\82·"
64 #endif
65     };
66
67     /* if the target is currently unlocked, we're trying to lock it now */
68     if (xlock.door && !(xlock.door->doormask & D_LOCKED))
69 #if 0 /*JP*/
70         return actions[0] + 2; /* "locking the door" */
71 #else /* \89p\8cê\82Í un \82ð\8eæ\82ê\82Î\8bt\82Ì\88Ó\96¡\82É\82È\82é\82ª\81C\93ú\96{\8cê\82Í\82»\82¤\82Í\82¢\82©\82È\82¢\82Ì\82Å\83\8a\83e\83\89\83\8b\82ð\8f\91\82­ */
72         return "\94à\82É\8c®\82ð\82©\82¯\82é";
73 #endif
74     else if (xlock.box && !xlock.box->olocked)
75 #if 0 /*JP*/
76         return xlock.box->otyp == CHEST ? actions[1] + 2 : actions[2] + 2;
77 #else
78         return xlock.box->otyp == CHEST ? "\95ó\94 \82É\8c®\82ð\82©\82¯\82é" : "\94 \82É\8c®\82ð\82©\82¯\82é";
79 #endif
80     /* otherwise we're trying to unlock it */
81     else if (xlock.picktyp == LOCK_PICK)
82         return actions[3]; /* "picking the lock" */
83     else if (xlock.picktyp == CREDIT_CARD)
84         return actions[3]; /* same as lock_pick */
85     else if (xlock.door)
86         return actions[0]; /* "unlocking the door" */
87     else if (xlock.box)
88         return xlock.box->otyp == CHEST ? actions[1] : actions[2];
89     else
90         return actions[3];
91 }
92
93 /* try to open/close a lock */
94 STATIC_PTR int
95 picklock(VOID_ARGS)
96 {
97     if (xlock.box) {
98         if ((xlock.box->ox != u.ux) || (xlock.box->oy != u.uy)) {
99             return ((xlock.usedtime = 0)); /* you or it moved */
100         }
101     } else { /* door */
102         if (xlock.door != &(levl[u.ux + u.dx][u.uy + u.dy])) {
103             return ((xlock.usedtime = 0)); /* you moved */
104         }
105         switch (xlock.door->doormask) {
106         case D_NODOOR:
107 /*JP
108             pline("This doorway has no door.");
109 */
110             pline("\8fo\93ü\8cû\82É\82Í\94à\82ª\82È\82¢\81D");
111             return ((xlock.usedtime = 0));
112         case D_ISOPEN:
113 /*JP
114             You("cannot lock an open door.");
115 */
116             pline("\8aJ\82¢\82Ä\82é\94à\82É\8c®\82ð\82©\82¯\82ç\82ê\82È\82¢\81D");
117             return ((xlock.usedtime = 0));
118         case D_BROKEN:
119 /*JP
120             pline("This door is broken.");
121 */
122             pline("\94à\82Í\89ó\82ê\82Ä\82¢\82é\81D");
123             return ((xlock.usedtime = 0));
124         }
125     }
126
127     if (xlock.usedtime++ >= 50 || nohands(youmonst.data)) {
128 /*JP
129         You("give up your attempt at %s.", lock_action());
130 */
131         pline("%s\82Ì\82ð\82 \82«\82ç\82ß\82½\81D", lock_action());
132         exercise(A_DEX, TRUE); /* even if you don't succeed */
133         return ((xlock.usedtime = 0));
134     }
135
136     if (rn2(100) >= xlock.chance)
137         return 1; /* still busy */
138
139 /*JP
140     You("succeed in %s.", lock_action());
141 */
142     You("%s\82Ì\82É\90¬\8c÷\82µ\82½\81D", lock_action());
143     if (xlock.door) {
144         if (xlock.door->doormask & D_TRAPPED) {
145 /*JP
146             b_trapped("door", FINGER);
147 */
148             b_trapped("\94à", FINGER);
149             xlock.door->doormask = D_NODOOR;
150             unblock_point(u.ux + u.dx, u.uy + u.dy);
151             if (*in_rooms(u.ux + u.dx, u.uy + u.dy, SHOPBASE))
152                 add_damage(u.ux + u.dx, u.uy + u.dy, 0L);
153             newsym(u.ux + u.dx, u.uy + u.dy);
154         } else if (xlock.door->doormask & D_LOCKED)
155             xlock.door->doormask = D_CLOSED;
156         else
157             xlock.door->doormask = D_LOCKED;
158     } else {
159         xlock.box->olocked = !xlock.box->olocked;
160         xlock.box->lknown = 1;
161         if (xlock.box->otrapped)
162             (void) chest_trap(xlock.box, FINGER, FALSE);
163     }
164     exercise(A_DEX, TRUE);
165     return ((xlock.usedtime = 0));
166 }
167
168 void
169 breakchestlock(box, destroyit)
170 struct obj *box;
171 boolean destroyit;
172 {
173     if (!destroyit) { /* bill for the box but not for its contents */
174         struct obj *hide_contents = box->cobj;
175
176         box->cobj = 0;
177         costly_alteration(box, COST_BRKLCK);
178         box->cobj = hide_contents;
179         box->olocked = 0;
180         box->obroken = 1;
181         box->lknown = 1;
182     } else { /* #force has destroyed this box (at <u.ux,u.uy>) */
183         struct obj *otmp;
184         struct monst *shkp = (*u.ushops && costly_spot(u.ux, u.uy))
185                                  ? shop_keeper(*u.ushops)
186                                  : 0;
187         boolean costly = (boolean) (shkp != 0),
188                 peaceful_shk = costly && (boolean) shkp->mpeaceful;
189         long loss = 0L;
190
191 /*JP
192         pline("In fact, you've totally destroyed %s.", the(xname(box)));
193 */
194         pline("\8eÀ\8dÛ\82Ì\82Æ\82±\82ë\81C%s\82ð\8a®\91S\82É\89ó\82µ\82Ä\82µ\82Ü\82Á\82½\81D", xname(xlock.box));
195         /* Put the contents on ground at the hero's feet. */
196         while ((otmp = box->cobj) != 0) {
197             obj_extract_self(otmp);
198             if (!rn2(3) || otmp->oclass == POTION_CLASS) {
199                 chest_shatter_msg(otmp);
200                 if (costly)
201                     loss +=
202                         stolen_value(otmp, u.ux, u.uy, peaceful_shk, TRUE);
203                 if (otmp->quan == 1L) {
204                     obfree(otmp, (struct obj *) 0);
205                     continue;
206                 }
207                 useup(otmp);
208             }
209             if (box->otyp == ICE_BOX && otmp->otyp == CORPSE) {
210                 otmp->age = monstermoves - otmp->age; /* actual age */
211                 start_corpse_timeout(otmp);
212             }
213             place_object(otmp, u.ux, u.uy);
214             stackobj(otmp);
215         }
216         if (costly)
217             loss += stolen_value(box, u.ux, u.uy, peaceful_shk, TRUE);
218         if (loss)
219 /*JP
220             You("owe %ld %s for objects destroyed.", loss, currency(loss));
221 */
222             You("\8aí\95¨\94j\91¹\82Å%ld%s\82Ì\8eØ\82è\82ð\82Â\82­\82Á\82½\81D", loss, currency(loss));
223         delobj(box);
224     }
225 }
226
227 /* try to force a locked chest */
228 STATIC_PTR int
229 forcelock(VOID_ARGS)
230 {
231     if ((xlock.box->ox != u.ux) || (xlock.box->oy != u.uy))
232         return ((xlock.usedtime = 0)); /* you or it moved */
233
234     if (xlock.usedtime++ >= 50 || !uwep || nohands(youmonst.data)) {
235 /*JP
236         You("give up your attempt to force the lock.");
237 */
238         pline("\8c®\82ð\82±\82\8aJ\82¯\82é\82Ì\82ð\82 \82«\82ç\82ß\82½\81D");
239         if (xlock.usedtime >= 50) /* you made the effort */
240             exercise((xlock.picktyp) ? A_DEX : A_STR, TRUE);
241         return ((xlock.usedtime = 0));
242     }
243
244     if (xlock.picktyp) { /* blade */
245         if (rn2(1000 - (int) uwep->spe) > (992 - greatest_erosion(uwep) * 10)
246             && !uwep->cursed && !obj_resists(uwep, 0, 99)) {
247             /* for a +0 weapon, probability that it survives an unsuccessful
248              * attempt to force the lock is (.992)^50 = .67
249              */
250 #if 0 /*JP*/
251             pline("%sour %s broke!", (uwep->quan > 1L) ? "One of y" : "Y",
252                   xname(uwep));
253 #else
254             pline("%s\82Í\89ó\82ê\82Ä\82µ\82Ü\82Á\82½\81I",xname(uwep));
255 #endif
256             useup(uwep);
257 /*JP
258             You("give up your attempt to force the lock.");
259 */
260             pline("\8c®\82ð\82±\82\8aJ\82¯\82é\82Ì\82ð\82 \82«\82ç\82ß\82½\81D");
261             exercise(A_DEX, TRUE);
262             return ((xlock.usedtime = 0));
263         }
264     } else             /* blunt */
265         wake_nearby(); /* due to hammering on the container */
266
267     if (rn2(100) >= xlock.chance)
268         return 1; /* still busy */
269
270 /*JP
271     You("succeed in forcing the lock.");
272 */
273     pline("\8c®\82ð\82±\82\8aJ\82¯\82½\81D");
274     breakchestlock(xlock.box, (boolean) (!xlock.picktyp && !rn2(3)));
275
276     exercise((xlock.picktyp) ? A_DEX : A_STR, TRUE);
277     return ((xlock.usedtime = 0));
278 }
279
280 void
281 reset_pick()
282 {
283     xlock.usedtime = xlock.chance = xlock.picktyp = 0;
284     xlock.door = 0;
285     xlock.box = 0;
286 }
287
288 /* for doapply(); if player gives a direction or resumes an interrupted
289    previous attempt then it costs hero a move even if nothing ultimately
290    happens; when told "can't do that" before being asked for direction
291    or player cancels with ESC while giving direction, it doesn't */
292 #define PICKLOCK_LEARNED_SOMETHING (-1) /* time passes */
293 #define PICKLOCK_DID_NOTHING 0          /* no time passes */
294 #define PICKLOCK_DID_SOMETHING 1
295
296 /* player is applying a key, lock pick, or credit card */
297 int
298 pick_lock(pick)
299 struct obj *pick;
300 {
301     int picktyp, c, ch;
302     coord cc;
303     struct rm *door;
304     struct obj *otmp;
305     char qbuf[QBUFSZ];
306
307     picktyp = pick->otyp;
308
309     /* check whether we're resuming an interrupted previous attempt */
310     if (xlock.usedtime && picktyp == xlock.picktyp) {
311 /*JP
312         static char no_longer[] = "Unfortunately, you can no longer %s %s.";
313 */
314         static char no_longer[] = "\82´\82ñ\82Ë\82ñ\82È\82ª\82ç\81C\82 \82È\82½\82Í%s%s";
315
316         if (nohands(youmonst.data)) {
317 /*JP
318             const char *what = (picktyp == LOCK_PICK) ? "pick" : "key";
319 */
320             const char *what = (picktyp == LOCK_PICK) ? "\8c®\8aJ\82¯\8aí\8bï" : "\8c®";
321             if (picktyp == CREDIT_CARD)
322 /*JP
323                 what = "card";
324 */
325                 what = "\83J\81[\83h";
326 /*JP
327             pline(no_longer, "hold the", what);
328 */
329             pline(no_longer, what, "\82ð\82Â\82©\82ß\82È\82¢");
330             reset_pick();
331             return PICKLOCK_LEARNED_SOMETHING;
332         } else if (u.uswallow || (xlock.box && !can_reach_floor(TRUE))) {
333 /*JP
334             pline(no_longer, "reach the", "lock");
335 */
336             pline(no_longer, "\8c®\82É", "\93Í\82©\82È\82¢");
337             reset_pick();
338             return PICKLOCK_LEARNED_SOMETHING;
339         } else {
340             const char *action = lock_action();
341
342 /*JP
343             You("resume your attempt at %s.", action);
344 */
345             pline("%s\82Ì\82ð\8dÄ\8aJ\82µ\82½\81D", action);
346             set_occupation(picklock, action, 0);
347             return PICKLOCK_DID_SOMETHING;
348         }
349     }
350
351     if (nohands(youmonst.data)) {
352 /*JP
353         You_cant("hold %s -- you have no hands!", doname(pick));
354 */
355         You("%s\82ð\82Â\82©\82Þ\82±\82Æ\82ª\82Å\82«\82È\82¢\81I\8eè\82ª\82È\82¢\82ñ\82¾\82à\82Ì\81I", xname(pick));
356         return PICKLOCK_DID_NOTHING;
357     } else if (u.uswallow) {
358         You_cant("%sunlock %s.", (picktyp == CREDIT_CARD) ? "" : "lock or ",
359                  mon_nam(u.ustuck));
360         return PICKLOCK_DID_NOTHING;
361     }
362
363     if ((picktyp != LOCK_PICK && picktyp != CREDIT_CARD
364          && picktyp != SKELETON_KEY)) {
365         impossible("picking lock with object %d?", picktyp);
366         return PICKLOCK_DID_NOTHING;
367     }
368     ch = 0; /* lint suppression */
369
370 /*JP
371     if (!get_adjacent_loc((char *) 0, "Invalid location!", u.ux, u.uy, &cc))
372 */
373     if (!get_adjacent_loc((char *) 0, "\88Ê\92u\82ª\82¨\82©\82µ\82¢\81I", u.ux, u.uy, &cc))
374         return PICKLOCK_DID_NOTHING;
375
376     if (cc.x == u.ux && cc.y == u.uy) { /* pick lock on a container */
377         const char *verb;
378         char qsfx[QBUFSZ];
379         boolean it;
380         int count;
381
382         if (u.dz < 0) {
383 #if 0 /*JP*/
384             There("isn't any sort of lock up %s.",
385                   Levitation ? "here" : "there");
386 #else
387             pline("%s\82É\82Í\8c®\82ð\82©\82¯\82é\82æ\82¤\82È\95¨\82Í\82È\82¢\81D",
388                   Levitation ? "\82±\82±" : "\89º\95û");
389 #endif
390             return PICKLOCK_LEARNED_SOMETHING;
391         } else if (is_lava(u.ux, u.uy)) {
392 /*JP
393             pline("Doing that would probably melt %s.", yname(pick));
394 */
395             pline("\82»\82ñ\82È\82±\82Æ\82ð\82µ\82½\82ç%s\82ª\97n\82¯\82Ä\82µ\82Ü\82¤\81D", yname(pick));
396             return PICKLOCK_LEARNED_SOMETHING;
397         } else if (is_pool(u.ux, u.uy) && !Underwater) {
398 /*JP
399             pline_The("water has no lock.");
400 */
401             pline("\90\85\82É\8fù\91O\82Í\82È\82¢\81D");
402             return PICKLOCK_LEARNED_SOMETHING;
403         }
404
405         count = 0;
406         c = 'n'; /* in case there are no boxes here */
407         for (otmp = level.objects[cc.x][cc.y]; otmp; otmp = otmp->nexthere)
408             if (Is_box(otmp)) {
409                 ++count;
410                 if (!can_reach_floor(TRUE)) {
411 /*JP
412                     You_cant("reach %s from up here.", the(xname(otmp)));
413 */
414                     You("\82±\82±\82©\82ç%s\82É\93Í\82©\82È\82¢\81D", the(xname(otmp)));
415                     return PICKLOCK_LEARNED_SOMETHING;
416                 }
417                 it = 0;
418                 if (otmp->obroken)
419 /*JP
420                     verb = "fix";
421 */
422                     verb = "\8fC\95\9c\82·\82é";
423                 else if (!otmp->olocked)
424 /*JP
425                     verb = "lock", it = 1;
426 */
427                     verb = "\8c®\82ð\82©\82¯\82é", it = 1;
428                 else if (picktyp != LOCK_PICK)
429 /*JP
430                     verb = "unlock", it = 1;
431 */
432                     verb = "\8c®\82ð\82Í\82¸\82·", it = 1;
433                 else
434 /*JP
435                     verb = "pick";
436 */
437                     verb = "\82±\82\82 \82¯\82é";
438
439                 /* "There is <a box> here; <verb> <it|its lock>?" */
440 /*JP
441                 Sprintf(qsfx, " here; %s %s?", verb, it ? "it" : "its lock");
442 */
443                 Sprintf(qsfx, "\82ª\82 \82é\81D%s\81H", verb);
444 #if 0 /*JP*/
445                 (void) safe_qbuf(qbuf, "There is ", qsfx, otmp, doname,
446                                  ansimpleoname, "a box");
447 #else
448                 (void) safe_qbuf(qbuf, "\82±\82±\82É\82Í", qsfx, otmp, doname,
449                                  ansimpleoname, "\94 ");
450 #endif
451                 otmp->lknown = 1;
452
453                 c = ynq(qbuf);
454                 if (c == 'q')
455                     return 0;
456                 if (c == 'n')
457                     continue;
458
459                 if (otmp->obroken) {
460 /*JP
461                     You_cant("fix its broken lock with %s.", doname(pick));
462 */
463                     You("\89ó\82ê\82½\8c®\82ð%s\82Å\8fC\95\9c\82Å\82«\82È\82¢\81D", doname(pick));
464                     return PICKLOCK_LEARNED_SOMETHING;
465                 } else if (picktyp == CREDIT_CARD && !otmp->olocked) {
466                     /* credit cards are only good for unlocking */
467 #if 0 /*JP*/
468                     You_cant("do that with %s.",
469                              an(simple_typename(picktyp)));
470 #else
471                     pline("%s\82\82á\82»\82ñ\82È\82±\82Æ\82Í\82Å\82«\82È\82¢\81D",
472                           simple_typename(picktyp));
473 #endif
474                     return PICKLOCK_LEARNED_SOMETHING;
475                 }
476                 switch (picktyp) {
477                 case CREDIT_CARD:
478                     ch = ACURR(A_DEX) + 20 * Role_if(PM_ROGUE);
479                     break;
480                 case LOCK_PICK:
481                     ch = 4 * ACURR(A_DEX) + 25 * Role_if(PM_ROGUE);
482                     break;
483                 case SKELETON_KEY:
484                     ch = 75 + ACURR(A_DEX);
485                     break;
486                 default:
487                     ch = 0;
488                 }
489                 if (otmp->cursed)
490                     ch /= 2;
491
492                 xlock.picktyp = picktyp;
493                 xlock.box = otmp;
494                 xlock.door = 0;
495                 break;
496             }
497         if (c != 'y') {
498             if (!count)
499 /*JP
500                 There("doesn't seem to be any sort of lock here.");
501 */
502                 pline("\82±\82±\82É\82Í\8c®\82ð\82©\82¯\82é\82æ\82¤\82È\95¨\82Í\82È\82¢\82æ\82¤\82¾\81D");
503             return PICKLOCK_LEARNED_SOMETHING; /* decided against all boxes */
504         }
505     } else { /* pick the lock in a door */
506         struct monst *mtmp;
507
508         if (u.utrap && u.utraptype == TT_PIT) {
509 /*JP
510             You_cant("reach over the edge of the pit.");
511 */
512             pline("\97\8e\82µ\8c\8a\82Ì\92\86\82©\82ç\82Å\82Í\93Í\82©\82È\82¢\81D");
513             return PICKLOCK_LEARNED_SOMETHING;
514         }
515
516         door = &levl[cc.x][cc.y];
517         mtmp = m_at(cc.x, cc.y);
518         if (mtmp && canseemon(mtmp) && mtmp->m_ap_type != M_AP_FURNITURE
519             && mtmp->m_ap_type != M_AP_OBJECT) {
520             if (picktyp == CREDIT_CARD
521                 && (mtmp->isshk || mtmp->data == &mons[PM_ORACLE]))
522 /*JP
523                 verbalize("No checks, no credit, no problem.");
524 */
525                 verbalize("\82¢\82Â\82à\83j\83R\83j\83R\8c»\8bà\95¥\82¢\81D");
526             else
527 #if 0 /*JP*/
528                 pline("I don't think %s would appreciate that.",
529                       mon_nam(mtmp));
530 #else
531                 pline("%s\82ª\82»\82Ì\89¿\92l\82ð\94F\82ß\82é\82Æ\82Í\8ev\82¦\82È\82¢\81D", mon_nam(mtmp));
532 #endif
533             return PICKLOCK_LEARNED_SOMETHING;
534         } else if (mtmp && is_door_mappear(mtmp)) {
535             /* "The door actually was a <mimic>!" */
536             stumble_onto_mimic(mtmp);
537             /* mimic might keep the key (50% chance, 10% for PYEC) */
538             maybe_absorb_item(mtmp, pick, 50, 10);
539             return PICKLOCK_LEARNED_SOMETHING;
540         }
541         if (!IS_DOOR(door->typ)) {
542             if (is_drawbridge_wall(cc.x, cc.y) >= 0)
543 /*JP
544                 You("%s no lock on the drawbridge.", Blind ? "feel" : "see");
545 */
546                 pline("\92µ\82Ë\8b´\82É\82Í\8c®\82ª\82È\82¢%s\81D", Blind ? "\82æ\82¤\82¾" : "\82æ\82¤\82É\8c©\82¦\82é");
547             else
548 /*JP
549                 You("%s no door there.", Blind ? "feel" : "see");
550 */
551                 pline("\82±\82±\82É\82Í\94à\82ª\82È\82¢%s\81D", Blind ? "\82æ\82¤\82¾" : "\82æ\82¤\82É\8c©\82¦\82é");
552             return PICKLOCK_LEARNED_SOMETHING;
553         }
554         switch (door->doormask) {
555         case D_NODOOR:
556 /*JP
557             pline("This doorway has no door.");
558 */
559             pline("\82±\82Ì\8fo\93ü\8cû\82É\82Í\94à\82ª\82È\82¢\81D");
560             return PICKLOCK_LEARNED_SOMETHING;
561         case D_ISOPEN:
562 /*JP
563             You("cannot lock an open door.");
564 */
565             pline("\8aJ\82¢\82Ä\82é\94à\82É\82Í\8c®\82ð\82©\82¯\82ç\82ê\82È\82¢\81D");
566             return PICKLOCK_LEARNED_SOMETHING;
567         case D_BROKEN:
568 /*JP
569             pline("This door is broken.");
570 */
571             pline("\82±\82Ì\94à\82Í\89ó\82ê\82Ä\82¢\82é\81D");
572             return PICKLOCK_LEARNED_SOMETHING;
573         default:
574             /* credit cards are only good for unlocking */
575             if (picktyp == CREDIT_CARD && !(door->doormask & D_LOCKED)) {
576 /*JP
577                 You_cant("lock a door with a credit card.");
578 */
579                 You("\83N\83\8c\83W\83b\83g\83J\81[\83h\82Å\94à\82É\8c®\82ð\82©\82¯\82é\82±\82Æ\82Í\82Å\82«\82È\82¢\81D");
580                 return PICKLOCK_LEARNED_SOMETHING;
581             }
582
583 #if 0 /*JP*/
584             Sprintf(qbuf, "%s it?",
585                     (door->doormask & D_LOCKED) ? "Unlock" : "Lock");
586 #else
587             Sprintf(qbuf, "%s\82Ü\82·\82©\81H",
588                     (door->doormask & D_LOCKED) ? "\82Í\82¸\82µ" : "\82©\82¯" );
589 #endif
590
591             c = yn(qbuf);
592             if (c == 'n')
593                 return 0;
594
595             switch (picktyp) {
596             case CREDIT_CARD:
597                 ch = 2 * ACURR(A_DEX) + 20 * Role_if(PM_ROGUE);
598                 break;
599             case LOCK_PICK:
600                 ch = 3 * ACURR(A_DEX) + 30 * Role_if(PM_ROGUE);
601                 break;
602             case SKELETON_KEY:
603                 ch = 70 + ACURR(A_DEX);
604                 break;
605             default:
606                 ch = 0;
607             }
608             xlock.door = door;
609             xlock.box = 0;
610         }
611     }
612     context.move = 0;
613     xlock.chance = ch;
614     xlock.picktyp = picktyp;
615     xlock.usedtime = 0;
616     set_occupation(picklock, lock_action(), 0);
617     return PICKLOCK_DID_SOMETHING;
618 }
619
620 /* try to force a chest with your weapon */
621 int
622 doforce()
623 {
624     register struct obj *otmp;
625     register int c, picktyp;
626     char qbuf[QBUFSZ];
627
628     if (u.uswallow) {
629         You_cant("force anything from inside here.");
630         return 0;
631     }
632     if (!uwep /* proper type test */
633         || ((uwep->oclass == WEAPON_CLASS || is_weptool(uwep))
634                ? (objects[uwep->otyp].oc_skill < P_DAGGER
635                   || objects[uwep->otyp].oc_skill == P_FLAIL
636                   || objects[uwep->otyp].oc_skill > P_LANCE)
637                : uwep->oclass != ROCK_CLASS)) {
638 #if 0 /*JP*/
639         You_cant("force anything %s weapon.",
640                  !uwep ? "when not wielding a"
641                        : (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))
642                              ? "without a proper"
643                              : "with that");
644 #else
645         You_cant("%s\95\90\8aí\82È\82µ\82Å\8c®\82ð\82±\82\8aJ\82¯\82é\82±\82Æ\82Í\82Å\82«\82È\82¢\81D",
646                  !uwep ? "\91\95\94õ\82µ\82Ä\82¢\82é"
647                        : (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))
648                              ? "\93K\90Ø\82È"
649                              : "");
650 #endif
651         return 0;
652     }
653     if (!can_reach_floor(TRUE)) {
654         cant_reach_floor(u.ux, u.uy, FALSE, TRUE);
655         return 0;
656     }
657
658     picktyp = is_blade(uwep) && !is_pick(uwep);
659     if (xlock.usedtime && xlock.box && picktyp == xlock.picktyp) {
660 /*JP
661         You("resume your attempt to force the lock.");
662 */
663         pline("\8c®\82ð\82±\82\82 \82¯\82é\82Ì\82ð\8dÄ\8aJ\82µ\82½\81D");
664 /*JP
665         set_occupation(forcelock, "forcing the lock", 0);
666 */
667         set_occupation(forcelock, "\8c®\82ð\82±\82\82 \82¯\82é", 0);
668         return 1;
669     }
670
671     /* A lock is made only for the honest man, the thief will break it. */
672     xlock.box = (struct obj *) 0;
673     for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
674         if (Is_box(otmp)) {
675             if (otmp->obroken || !otmp->olocked) {
676 #if 0 /*JP*/
677                 There("is %s here, but its lock is already %s.", doname(otmp),
678                       otmp->obroken ? "broken" : "unlocked");
679 #else
680                 pline("\82±\82±\82É\82Í%s\82ª\82 \82é\81C\82µ\82©\82µ\82»\82Ì\8c®\82Í\82à\82¤%s\81D", doname(otmp),
681                       otmp->obroken ? "\89ó\82ê\82Ä\82¢\82é" : "\82Í\82¸\82³\82ê\82Ä\82¢\82é");
682 #endif
683                 otmp->lknown = 1;
684                 continue;
685             }
686 #if 0 /*JP*/
687             (void) safe_qbuf(qbuf, "There is ", " here; force its lock?",
688                              otmp, doname, ansimpleoname, "a box");
689 #else
690             (void) safe_qbuf(qbuf, "\82±\82±\82É\82Í", "\82ª\82 \82é\81C\8c®\82ð\82±\82\8aJ\82¯\82Ü\82·\82©\81H",
691                              otmp, doname, ansimpleoname, "\94 ");
692 #endif
693             otmp->lknown = 1;
694
695             c = ynq(qbuf);
696             if (c == 'q')
697                 return 0;
698             if (c == 'n')
699                 continue;
700
701             if (picktyp)
702 /*JP
703                 You("force %s into a crack and pry.", yname(uwep));
704 */
705                 You("%s\82ð\82·\82«\8aÔ\82É\8d·\82µ\82±\82ñ\82Å\82±\82\82 \82¯\82æ\82¤\82Æ\82µ\82½\81D",xname(uwep));
706             else
707 /*JP
708                 You("start bashing it with %s.", yname(uwep));
709 */
710                 pline("%s\82Å\89£\82è\82Â\82¯\82½\81D", xname(uwep));
711             xlock.box = otmp;
712             xlock.chance = objects[uwep->otyp].oc_wldam * 2;
713             xlock.picktyp = picktyp;
714             xlock.usedtime = 0;
715             break;
716         }
717
718     if (xlock.box)
719 /*JP
720         set_occupation(forcelock, "forcing the lock", 0);
721 */
722         set_occupation(forcelock, "\8c®\82ð\82±\82\82 \82¯\82é", 0);
723     else
724 /*JP
725         You("decide not to force the issue.");
726 */
727         pline("\82»\82ê\82Í\96³\88Ó\96¡\82È\8ds\88×\82¾\81D");
728     return 1;
729 }
730
731 boolean
732 stumble_on_door_mimic(x, y)
733 int x, y;
734 {
735     struct monst *mtmp;
736
737     if ((mtmp = m_at(x, y)) && is_door_mappear(mtmp)
738         && !Protection_from_shape_changers) {
739         stumble_onto_mimic(mtmp);
740         return TRUE;
741     }
742     return FALSE;
743 }
744
745 /* the 'O' command - try to open a door */
746 int
747 doopen()
748 {
749     return doopen_indir(0, 0);
750 }
751
752 /* try to open a door in direction u.dx/u.dy */
753 int
754 doopen_indir(x, y)
755 int x, y;
756 {
757     coord cc;
758     register struct rm *door;
759     boolean portcullis;
760     int res = 0;
761
762     if (nohands(youmonst.data)) {
763 /*JP
764         You_cant("open anything -- you have no hands!");
765 */
766         You("\89½\82à\8aJ\82¯\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81I\8eè\82ª\82È\82¢\82ñ\82¾\82à\82Ì\81I");
767         return 0;
768     }
769
770     if (u.utrap && u.utraptype == TT_PIT) {
771 /*JP
772         You_cant("reach over the edge of the pit.");
773 */
774         pline("\97\8e\82µ\8c\8a\82Ì\92\86\82©\82ç\93Í\82©\82È\82¢\81D");
775         return 0;
776     }
777
778     if (x > 0 && y > 0) {
779         cc.x = x;
780         cc.y = y;
781     } else if (!get_adjacent_loc((char *) 0, (char *) 0, u.ux, u.uy, &cc))
782         return 0;
783
784     if ((cc.x == u.ux) && (cc.y == u.uy))
785         return 0;
786
787     if (stumble_on_door_mimic(cc.x, cc.y))
788         return 1;
789
790     /* when choosing a direction is impaired, use a turn
791        regardless of whether a door is successfully targetted */
792     if (Confusion || Stunned)
793         res = 1;
794
795     door = &levl[cc.x][cc.y];
796     portcullis = (is_drawbridge_wall(cc.x, cc.y) >= 0);
797     if (Blind) {
798         int oldglyph = door->glyph;
799         schar oldlastseentyp = lastseentyp[cc.x][cc.y];
800
801         feel_location(cc.x, cc.y);
802         if (door->glyph != oldglyph
803             || lastseentyp[cc.x][cc.y] != oldlastseentyp)
804             res = 1; /* learned something */
805     }
806
807     if (portcullis || !IS_DOOR(door->typ)) {
808         /* closed portcullis or spot that opened bridge would span */
809         if (is_db_wall(cc.x, cc.y) || door->typ == DRAWBRIDGE_UP)
810 /*JP
811             There("is no obvious way to open the drawbridge.");
812 */
813             pline("\92µ\82Ë\8b´\82ð\8d~\82ë\82·\96¾\94\92\82È\95û\96@\82Í\82È\82¢\81D");
814         else if (portcullis || door->typ == DRAWBRIDGE_DOWN)
815 /*JP
816             pline_The("drawbridge is already open.");
817 */
818             pline_The("\92µ\82Ë\8b´\82Í\82à\82¤\8aJ\82¢\82Ä\82¢\82é\81D");
819         else
820 /*JP
821             You("%s no door there.", Blind ? "feel" : "see");
822 */
823             pline("\82»\82±\82É\82Í\94à\82Í\82È\82¢\82æ\82¤%s\81D", Blind ? "\82¾" : "\82É\8c©\82¦\82é");
824         return res;
825     }
826
827     if (!(door->doormask & D_CLOSED)) {
828         const char *mesg;
829
830         switch (door->doormask) {
831         case D_BROKEN:
832 /*JP
833             mesg = " is broken";
834 */
835             mesg = "\94à\82Í\89ó\82ê\82Ä\82¢\82é";
836             break;
837         case D_NODOOR:
838 /*JP
839             mesg = "way has no door";
840 */
841             mesg = "\8fo\93ü\8cû\82É\82Í\94à\82ª\82È\82¢";
842             break;
843         case D_ISOPEN:
844 /*JP
845             mesg = " is already open";
846 */
847             mesg = "\94à\82Í\82à\82¤\8aJ\82¢\82Ä\82¢\82é";
848             break;
849         default:
850 /*JP
851             mesg = " is locked";
852 */
853             mesg = "\94à\82É\82Í\8c®\82ª\8a|\82©\82Á\82Ä\82¢\82é";
854             break;
855         }
856 /*JP
857         pline("This door%s.", mesg);
858 */
859         pline("%s\81D", mesg);
860         return res;
861     }
862
863     if (verysmall(youmonst.data)) {
864 /*JP
865         pline("You're too small to pull the door open.");
866 */
867         You("\94à\82ð\89\9f\82·\82É\82Í\8f¬\82³\82·\82¬\82é\81D");
868         return res;
869     }
870
871     /* door is known to be CLOSED */
872     if (rnl(20) < (ACURRSTR + ACURR(A_DEX) + ACURR(A_CON)) / 3) {
873 /*JP
874         pline_The("door opens.");
875 */
876         pline("\94à\82Í\8aJ\82¢\82½\81D");
877         if (door->doormask & D_TRAPPED) {
878 /*JP
879             b_trapped("door", FINGER);
880 */
881             b_trapped("\94à", FINGER);
882             door->doormask = D_NODOOR;
883             if (*in_rooms(cc.x, cc.y, SHOPBASE))
884                 add_damage(cc.x, cc.y, 0L);
885         } else
886             door->doormask = D_ISOPEN;
887         feel_newsym(cc.x, cc.y); /* the hero knows she opened it */
888         unblock_point(cc.x, cc.y); /* vision: new see through there */
889     } else {
890         exercise(A_STR, TRUE);
891 /*JP
892         pline_The("door resists!");
893 */
894         pline("\82È\82©\82È\82©\8aJ\82©\82È\82¢\81I");
895     }
896
897     return 1;
898 }
899
900 STATIC_OVL boolean
901 obstructed(x, y, quietly)
902 register int x, y;
903 boolean quietly;
904 {
905     register struct monst *mtmp = m_at(x, y);
906
907     if (mtmp && mtmp->m_ap_type != M_AP_FURNITURE) {
908         if (mtmp->m_ap_type == M_AP_OBJECT)
909             goto objhere;
910         if (!quietly) {
911             if ((mtmp->mx != x) || (mtmp->my != y)) {
912                 /* worm tail */
913 #if 0 /*JP*/
914                 pline("%s%s blocks the way!",
915                       !canspotmon(mtmp) ? Something : s_suffix(Monnam(mtmp)),
916                       !canspotmon(mtmp) ? "" : " tail");
917 #else
918                 pline("%s%s\82ª\97§\82¿\82Ó\82³\82ª\82Á\82Ä\82¢\82é\81I",
919                       !canspotmon(mtmp) ? "\89½\82©" : Monnam(mtmp),
920                       !canspotmon(mtmp) ? "" : "\82Ì\90K\94ö");
921 #endif
922             } else {
923 #if 0 /*JP*/
924                 pline("%s blocks the way!",
925                       !canspotmon(mtmp) ? "Some creature" : Monnam(mtmp));
926 #else
927                 pline("%s\82ª\97§\82¿\82Ó\82³\82ª\82Á\82Ä\82¢\82é\81I",
928                       !canspotmon(mtmp) ? "\89½\8eÒ\82©" : Monnam(mtmp));
929 #endif
930             }
931         }
932         if (!canspotmon(mtmp))
933             map_invisible(x, y);
934         return TRUE;
935     }
936     if (OBJ_AT(x, y)) {
937     objhere:
938         if (!quietly)
939 /*JP
940             pline("%s's in the way.", Something);
941 */
942             pline("\89½\82©\82ª\8fo\93ü\8cû\82É\82 \82é\81D");
943         return TRUE;
944     }
945     return FALSE;
946 }
947
948 /* the 'C' command - try to close a door */
949 int
950 doclose()
951 {
952     register int x, y;
953     register struct rm *door;
954     boolean portcullis;
955     int res = 0;
956
957     if (nohands(youmonst.data)) {
958 /*JP
959         You_cant("close anything -- you have no hands!");
960 */
961         You("\95Â\82ß\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81I\8eè\82ª\82È\82¢\82ñ\82¾\82à\82Ì\81I");
962         return 0;
963     }
964
965     if (u.utrap && u.utraptype == TT_PIT) {
966 /*JP
967         You_cant("reach over the edge of the pit.");
968 */
969         pline("\97\8e\82µ\8c\8a\82Ì\92\86\82©\82ç\93Í\82©\82È\82¢\81D");
970         return 0;
971     }
972
973     if (!getdir((char *) 0))
974         return 0;
975
976     x = u.ux + u.dx;
977     y = u.uy + u.dy;
978     if ((x == u.ux) && (y == u.uy)) {
979 /*JP
980         You("are in the way!");
981 */
982         pline("\82 \82È\82½\82ª\8fo\93ü\8cû\82É\82¢\82é\82Ì\82Å\95Â\82Ü\82ç\82È\82¢\81I");
983         return 1;
984     }
985
986     if (!isok(x, y))
987         goto nodoor;
988
989     if (stumble_on_door_mimic(x, y))
990         return 1;
991
992     /* when choosing a direction is impaired, use a turn
993        regardless of whether a door is successfully targetted */
994     if (Confusion || Stunned)
995         res = 1;
996
997     door = &levl[x][y];
998     portcullis = (is_drawbridge_wall(x, y) >= 0);
999     if (Blind) {
1000         int oldglyph = door->glyph;
1001         schar oldlastseentyp = lastseentyp[x][y];
1002
1003         feel_location(x, y);
1004         if (door->glyph != oldglyph || lastseentyp[x][y] != oldlastseentyp)
1005             res = 1; /* learned something */
1006     }
1007
1008     if (portcullis || !IS_DOOR(door->typ)) {
1009         /* is_db_wall: closed portcullis */
1010         if (is_db_wall(x, y) || door->typ == DRAWBRIDGE_UP)
1011 /*JP
1012             pline_The("drawbridge is already closed.");
1013 */
1014             pline_The("\92µ\82Ë\8b´\82Í\82à\82¤\95Â\82\82Ä\82¢\82é\81D");
1015         else if (portcullis || door->typ == DRAWBRIDGE_DOWN)
1016 /*JP
1017             There("is no obvious way to close the drawbridge.");
1018 */
1019             pline("\92µ\82Ë\8b´\82ð\95Â\82ß\82é\96¾\94\92\82È\95û\96@\82Í\82È\82¢\81D");
1020         else {
1021         nodoor:
1022 /*JP
1023             You("%s no door there.", Blind ? "feel" : "see");
1024 */
1025             pline("\82»\82±\82É\94à\82Í\82È\82¢\82æ\82¤%s\81D", Blind ? "\82¾" : "\82É\8c©\82¦\82é");
1026         }
1027         return res;
1028     }
1029
1030     if (door->doormask == D_NODOOR) {
1031 /*JP
1032         pline("This doorway has no door.");
1033 */
1034         pline("\8fo\93ü\8cû\82É\82Í\94à\82ª\82È\82¢\81D");
1035         return res;
1036     } else if (obstructed(x, y, FALSE)) {
1037         return res;
1038     } else if (door->doormask == D_BROKEN) {
1039 /*JP
1040         pline("This door is broken.");
1041 */
1042         pline("\94à\82Í\89ó\82ê\82Ä\82¢\82é\81D");
1043         return res;
1044     } else if (door->doormask & (D_CLOSED | D_LOCKED)) {
1045 /*JP
1046         pline("This door is already closed.");
1047 */
1048         pline("\94à\82Í\82à\82¤\95Â\82\82Ä\82¢\82é\81D");
1049         return res;
1050     }
1051
1052     if (door->doormask == D_ISOPEN) {
1053         if (verysmall(youmonst.data) && !u.usteed) {
1054 /*JP
1055             pline("You're too small to push the door closed.");
1056 */
1057             You("\8f¬\82³\82·\82¬\82Ä\94à\82ð\95Â\82ß\82ç\82ê\82È\82¢\81D");
1058             return res;
1059         }
1060         if (u.usteed
1061             || rn2(25) < (ACURRSTR + ACURR(A_DEX) + ACURR(A_CON)) / 3) {
1062 /*JP
1063             pline_The("door closes.");
1064 */
1065             pline("\94à\82Í\95Â\82\82½\81D");
1066             door->doormask = D_CLOSED;
1067             feel_newsym(x, y); /* the hero knows she closed it */
1068             block_point(x, y); /* vision:  no longer see there */
1069         } else {
1070             exercise(A_STR, TRUE);
1071 /*JP
1072             pline_The("door resists!");
1073 */
1074             pline("\82È\82©\82È\82©\95Â\82Ü\82ç\82È\82¢\81I");
1075         }
1076     }
1077
1078     return 1;
1079 }
1080
1081 /* box obj was hit with spell or wand effect otmp;
1082    returns true if something happened */
1083 boolean
1084 boxlock(obj, otmp)
1085 struct obj *obj, *otmp; /* obj *is* a box */
1086 {
1087     boolean res = 0;
1088
1089     switch (otmp->otyp) {
1090     case WAN_LOCKING:
1091     case SPE_WIZARD_LOCK:
1092         if (!obj->olocked) { /* lock it; fix if broken */
1093 /*JP
1094             pline("Klunk!");
1095 */
1096             pline("\83J\83`\81I");
1097             obj->olocked = 1;
1098             obj->obroken = 0;
1099             if (Role_if(PM_WIZARD))
1100                 obj->lknown = 1;
1101             else
1102                 obj->lknown = 0;
1103             res = 1;
1104         } /* else already closed and locked */
1105         break;
1106     case WAN_OPENING:
1107     case SPE_KNOCK:
1108         if (obj->olocked) { /* unlock; couldn't be broken */
1109 /*JP
1110             pline("Klick!");
1111 */
1112             pline("\83R\83\93\83R\83\93\81I");
1113             obj->olocked = 0;
1114             res = 1;
1115             if (Role_if(PM_WIZARD))
1116                 obj->lknown = 1;
1117             else
1118                 obj->lknown = 0;
1119         } else /* silently fix if broken */
1120             obj->obroken = 0;
1121         break;
1122     case WAN_POLYMORPH:
1123     case SPE_POLYMORPH:
1124         /* maybe start unlocking chest, get interrupted, then zap it;
1125            we must avoid any attempt to resume unlocking it */
1126         if (xlock.box == obj)
1127             reset_pick();
1128         break;
1129     }
1130     return res;
1131 }
1132
1133 /* Door/secret door was hit with spell or wand effect otmp;
1134    returns true if something happened */
1135 boolean
1136 doorlock(otmp, x, y)
1137 struct obj *otmp;
1138 int x, y;
1139 {
1140     register struct rm *door = &levl[x][y];
1141     boolean res = TRUE;
1142     int loudness = 0;
1143     const char *msg = (const char *) 0;
1144 /*JP
1145     const char *dustcloud = "A cloud of dust";
1146 */
1147     const char *dustcloud = "\82Ù\82±\82è";
1148 /*JP
1149     const char *quickly_dissipates = "quickly dissipates";
1150 */
1151     const char *quickly_dissipates = "\82 \82Á\82Æ\8c¾\82¤\82Ü\82É\94ò\82Ñ\8eU\82Á\82½";
1152     boolean mysterywand = (otmp->oclass == WAND_CLASS && !otmp->dknown);
1153
1154     if (door->typ == SDOOR) {
1155         switch (otmp->otyp) {
1156         case WAN_OPENING:
1157         case SPE_KNOCK:
1158         case WAN_STRIKING:
1159         case SPE_FORCE_BOLT:
1160             door->typ = DOOR;
1161             door->doormask = D_CLOSED | (door->doormask & D_TRAPPED);
1162             newsym(x, y);
1163             if (cansee(x, y))
1164 /*JP
1165                 pline("A door appears in the wall!");
1166 */
1167                 pline("\95Ç\82©\82ç\94à\82ª\8c»\82ê\82½\81I");
1168             if (otmp->otyp == WAN_OPENING || otmp->otyp == SPE_KNOCK)
1169                 return TRUE;
1170             break; /* striking: continue door handling below */
1171         case WAN_LOCKING:
1172         case SPE_WIZARD_LOCK:
1173         default:
1174             return FALSE;
1175         }
1176     }
1177
1178     switch (otmp->otyp) {
1179     case WAN_LOCKING:
1180     case SPE_WIZARD_LOCK:
1181         if (Is_rogue_level(&u.uz)) {
1182             boolean vis = cansee(x, y);
1183             /* Can't have real locking in Rogue, so just hide doorway */
1184             if (vis)
1185 /*JP
1186                 pline("%s springs up in the older, more primitive doorway.",
1187 */
1188                 pline("\8cÃ\82­\82³\82¢\81C\8c´\8en\93I\82È\8fo\93ü\8cû\82É%s\82ª\97§\82¿\82±\82ß\82½\81D",
1189                       dustcloud);
1190             else
1191 /*JP
1192                 You_hear("a swoosh.");
1193 */
1194                 You_hear("\83V\83\85\81[\83b\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D");
1195             if (obstructed(x, y, mysterywand)) {
1196                 if (vis)
1197 /*JP
1198                     pline_The("cloud %s.", quickly_dissipates);
1199 */
1200                     pline("\82Ù\82±\82è\82Í%s\81D",quickly_dissipates);
1201                 return FALSE;
1202             }
1203             block_point(x, y);
1204             door->typ = SDOOR;
1205             if (vis)
1206 /*JP
1207                 pline_The("doorway vanishes!");
1208 */
1209                 pline("\8fo\93ü\8cû\82Í\8fÁ\82¦\82½\81I");
1210             newsym(x, y);
1211             return TRUE;
1212         }
1213         if (obstructed(x, y, mysterywand))
1214             return FALSE;
1215         /* Don't allow doors to close over traps.  This is for pits */
1216         /* & trap doors, but is it ever OK for anything else? */
1217         if (t_at(x, y)) {
1218             /* maketrap() clears doormask, so it should be NODOOR */
1219 #if 0 /*JP*/
1220             pline("%s springs up in the doorway, but %s.", dustcloud,
1221                   quickly_dissipates);
1222 #else
1223             pline("%s\82ª\8fo\93ü\8cû\82É\97§\82¿\82±\82ß\82½\81C\82µ\82©\82µ%s", dustcloud,
1224                   quickly_dissipates);
1225 #endif
1226             return FALSE;
1227         }
1228
1229         switch (door->doormask & ~D_TRAPPED) {
1230         case D_CLOSED:
1231 /*JP
1232             msg = "The door locks!";
1233 */
1234                 msg = "\94à\82É\8c®\82ª\82©\82©\82Á\82½\81I";
1235             break;
1236         case D_ISOPEN:
1237 /*JP
1238             msg = "The door swings shut, and locks!";
1239 */
1240             msg = "\94à\82Í\90¨\82¢\82æ\82­\95Â\82Ü\82è\81C\8c®\82ª\82©\82©\82Á\82½\81I";
1241             break;
1242         case D_BROKEN:
1243 /*JP
1244             msg = "The broken door reassembles and locks!";
1245 */
1246             msg = "\89ó\82ê\82½\94à\82ª\8dÄ\8d\\90¬\82³\82ê\81C\8c®\82ª\82©\82©\82Á\82½\81I";
1247             break;
1248         case D_NODOOR:
1249             msg =
1250 /*JP
1251                "A cloud of dust springs up and assembles itself into a door!";
1252 */
1253                 "\82Ù\82±\82è\82ª\82½\82¿\82±\82ß\81C\8fW\82Ü\82Á\82Ä\94à\82É\82È\82Á\82½\81I";
1254             break;
1255         default:
1256             res = FALSE;
1257             break;
1258         }
1259         block_point(x, y);
1260         door->doormask = D_LOCKED | (door->doormask & D_TRAPPED);
1261         newsym(x, y);
1262         break;
1263     case WAN_OPENING:
1264     case SPE_KNOCK:
1265         if (door->doormask & D_LOCKED) {
1266 /*JP
1267             msg = "The door unlocks!";
1268 */
1269             msg = "\94à\82Ì\8c®\82Í\82Í\82¸\82ê\82½\81I";
1270             door->doormask = D_CLOSED | (door->doormask & D_TRAPPED);
1271         } else
1272             res = FALSE;
1273         break;
1274     case WAN_STRIKING:
1275     case SPE_FORCE_BOLT:
1276         if (door->doormask & (D_LOCKED | D_CLOSED)) {
1277             if (door->doormask & D_TRAPPED) {
1278                 if (MON_AT(x, y))
1279                     (void) mb_trapped(m_at(x, y));
1280                 else if (flags.verbose) {
1281                     if (cansee(x, y))
1282 /*JP
1283                         pline("KABOOM!!  You see a door explode.");
1284 */
1285                         pline("\82¿\82ã\82Ç\81[\82ñ\81I\94à\82ª\94\9a\94­\82µ\82½\81D");
1286                     else
1287 /*JP
1288                         You_hear("a distant explosion.");
1289 */
1290                         You_hear("\89\93\82­\82Ì\94\9a\94­\89¹\82ð\95·\82¢\82½\81D");
1291                 }
1292                 door->doormask = D_NODOOR;
1293                 unblock_point(x, y);
1294                 newsym(x, y);
1295                 loudness = 40;
1296                 break;
1297             }
1298             door->doormask = D_BROKEN;
1299             if (flags.verbose) {
1300                 if (cansee(x, y))
1301 /*JP
1302                     pline_The("door crashes open!");
1303 */
1304                     pline("\94à\82Í\89ó\82ê\8aJ\82¢\82½\81I");
1305                 else
1306 /*JP
1307                     You_hear("a crashing sound.");
1308 */
1309                     You_hear("\89½\82©\82ª\89ó\82ê\82é\89¹\82ð\95·\82¢\82½\81D");
1310             }
1311             unblock_point(x, y);
1312             newsym(x, y);
1313             /* force vision recalc before printing more messages */
1314             if (vision_full_recalc)
1315                 vision_recalc(0);
1316             loudness = 20;
1317         } else
1318             res = FALSE;
1319         break;
1320     default:
1321         impossible("magic (%d) attempted on door.", otmp->otyp);
1322         break;
1323     }
1324     if (msg && cansee(x, y))
1325         pline1(msg);
1326     if (loudness > 0) {
1327         /* door was destroyed */
1328         wake_nearto(x, y, loudness);
1329         if (*in_rooms(x, y, SHOPBASE))
1330             add_damage(x, y, 0L);
1331     }
1332
1333     if (res && picking_at(x, y)) {
1334         /* maybe unseen monster zaps door you're unlocking */
1335         stop_occupation();
1336         reset_pick();
1337     }
1338     return res;
1339 }
1340
1341 STATIC_OVL void
1342 chest_shatter_msg(otmp)
1343 struct obj *otmp;
1344 {
1345     const char *disposition;
1346     const char *thing;
1347     long save_Blinded;
1348
1349     if (otmp->oclass == POTION_CLASS) {
1350 #if 0 /*JP*/
1351         You("%s %s shatter!", Blind ? "hear" : "see", an(bottlename()));
1352 #else
1353         if (Blind)
1354             You_hear("%s\82ª\8a\84\82ê\82é\89¹\82ð\95·\82¢\82½\81I", bottlename());
1355         else
1356             pline("%s\82ª\8a\84\82ê\82½\81I", bottlename());
1357 #endif
1358         if (!breathless(youmonst.data) || haseyes(youmonst.data))
1359             potionbreathe(otmp);
1360         return;
1361     }
1362     /* We have functions for distant and singular names, but not one */
1363     /* which does _both_... */
1364     save_Blinded = Blinded;
1365     Blinded = 1;
1366     thing = singular(otmp, xname);
1367     Blinded = save_Blinded;
1368     switch (objects[otmp->otyp].oc_material) {
1369     case PAPER:
1370 /*JP
1371         disposition = "is torn to shreds";
1372 */
1373         disposition = "\82Í\90¡\92f\82³\82ê\82½";
1374         break;
1375     case WAX:
1376 /*JP
1377         disposition = "is crushed";
1378 */
1379         disposition = "\82ð\8f°\82É\82Ô\82¿\82Ü\82¯\82½";
1380         break;
1381     case VEGGY:
1382 /*JP
1383         disposition = "is pulped";
1384 */
1385         disposition = "\82Í\82Ç\82ë\82Ç\82ë\82É\82È\82Á\82½";
1386         break;
1387     case FLESH:
1388 /*JP
1389         disposition = "is mashed";
1390 */
1391         disposition = "\82Í\82Ç\82ë\82Ç\82ë\82É\82È\82Á\82½";
1392         break;
1393     case GLASS:
1394 /*JP
1395         disposition = "shatters";
1396 */
1397         disposition = "\82Í\8a\84\82ê\82½";
1398         break;
1399     case WOOD:
1400 /*JP
1401         disposition = "splinters to fragments";
1402 */
1403         disposition = "\82Í\82©\82¯\82ç\82É\82È\82Á\82½";
1404         break;
1405     default:
1406 /*JP
1407         disposition = "is destroyed";
1408 */
1409         disposition = "\82Í\89ó\82ê\82½";
1410         break;
1411     }
1412 /*JP
1413     pline("%s %s!", An(thing), disposition);
1414 */
1415     pline("%s%s\81I", thing, disposition);
1416 }
1417
1418 /*lock.c*/