OSDN Git Service

add translation
[jnethack/source.git] / src / do_wear.c
1 /* NetHack 3.6  do_wear.c       $NHDT-Date: 1446975698 2015/11/08 09:41:38 $  $NHDT-Branch: master $:$NHDT-Revision: 1.87 $ */
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 NEARDATA const char see_yourself[] = "see yourself";
13 static NEARDATA const char unknown_type[] = "Unknown type of %s (%d)";
14 #if 0 /*JP*/
15 static NEARDATA const char c_armor[] = "armor", c_suit[] = "suit",
16                            c_shirt[] = "shirt", c_cloak[] = "cloak",
17                            c_gloves[] = "gloves", c_boots[] = "boots",
18                            c_helmet[] = "helmet", c_shield[] = "shield",
19                            c_weapon[] = "weapon", c_sword[] = "sword",
20                            c_axe[] = "axe", c_that_[] = "that";
21 #else
22 static NEARDATA const char c_armor[]  = "\8aZ", c_suit[]   = "\95\9e",
23                            c_shirt[]  = "\83V\83\83\83c", c_cloak[]  = "\83N\83\8d\81[\83N",
24                            c_gloves[] = "\8f¬\8eè", c_boots[]  = "\8cC",
25                            c_helmet[] = "\8a\95", c_shield[] = "\8f\82",
26                            c_weapon[] = "\95\90\8aí", c_sword[]  = "\8c\95",
27                            c_axe[]    = "\95\80", c_that_[]  = "\82»\82ê";
28 #endif
29
30 static NEARDATA const long takeoff_order[] = {
31     WORN_BLINDF, W_WEP,      WORN_SHIELD, WORN_GLOVES, LEFT_RING,
32     RIGHT_RING,  WORN_CLOAK, WORN_HELMET, WORN_AMUL,   WORN_ARMOR,
33     WORN_SHIRT,  WORN_BOOTS, W_SWAPWEP,   W_QUIVER,    0L
34 };
35
36 STATIC_DCL void FDECL(on_msg, (struct obj *));
37 STATIC_DCL void FDECL(toggle_stealth, (struct obj *, long, BOOLEAN_P));
38 STATIC_DCL void FDECL(toggle_displacement, (struct obj *, long, BOOLEAN_P));
39 STATIC_PTR int NDECL(Armor_on);
40 STATIC_PTR int NDECL(Boots_on);
41 STATIC_PTR int NDECL(Cloak_on);
42 STATIC_PTR int NDECL(Helmet_on);
43 STATIC_PTR int NDECL(Gloves_on);
44 STATIC_DCL void FDECL(wielding_corpse, (struct obj *, BOOLEAN_P));
45 STATIC_PTR int NDECL(Shield_on);
46 STATIC_PTR int NDECL(Shirt_on);
47 STATIC_DCL void NDECL(Amulet_on);
48 STATIC_DCL void FDECL(learnring, (struct obj *, BOOLEAN_P));
49 STATIC_DCL void FDECL(Ring_off_or_gone, (struct obj *, BOOLEAN_P));
50 STATIC_PTR int FDECL(select_off, (struct obj *));
51 STATIC_DCL struct obj *NDECL(do_takeoff);
52 STATIC_PTR int NDECL(take_off);
53 STATIC_DCL int FDECL(menu_remarm, (int));
54 STATIC_DCL void FDECL(count_worn_stuff, (struct obj **, BOOLEAN_P));
55 STATIC_PTR int FDECL(armor_or_accessory_off, (struct obj *));
56 STATIC_PTR int FDECL(accessory_or_armor_on, (struct obj *));
57 #if 0 /*JP*/
58 STATIC_DCL void FDECL(already_wearing, (const char *));
59 #else
60 STATIC_DCL void FDECL(already_wearing, (const char*, struct obj *));
61 #endif
62 STATIC_DCL void FDECL(already_wearing2, (const char *, const char *));
63
64 void
65 off_msg(otmp)
66 struct obj *otmp;
67 {
68 #if 0 /*JP*/
69     if (flags.verbose)
70         You("were wearing %s.", doname(otmp));
71 #else
72     const char *j;
73     const char *m;
74     m = joffmsg(otmp, &j);
75     if(flags.verbose)
76         You("%s%s%s\81D", doname(otmp), j, jpast(m));
77 #endif
78 }
79
80 /* for items that involve no delay */
81 STATIC_OVL void
82 on_msg(otmp)
83 struct obj *otmp;
84 {
85     if (flags.verbose) {
86 #if 0 /*JP*/
87         char how[BUFSZ];
88         /* call xname() before obj_is_pname(); formatting obj's name
89            might set obj->dknown and that affects the pname test */
90         const char *otmp_name = xname(otmp);
91
92         how[0] = '\0';
93         if (otmp->otyp == TOWEL)
94             Sprintf(how, " around your %s", body_part(HEAD));
95         You("are now wearing %s%s.",
96             obj_is_pname(otmp) ? the(otmp_name) : an(otmp_name), how);
97 #else
98         const char *j;
99         const char *m;
100         m = jonmsg(otmp, &j);
101         You("%s%s%s\81D", xname(otmp), j, jpast(m));
102 #endif
103     }
104 }
105
106 /* starting equipment gets auto-worn at beginning of new game,
107    and we don't want stealth or displacement feedback then */
108 static boolean initial_don = FALSE; /* manipulated in set_wear() */
109
110 /* putting on or taking off an item which confers stealth;
111    give feedback and discover it iff stealth state is changing */
112 STATIC_OVL
113 void
114 toggle_stealth(obj, oldprop, on)
115 struct obj *obj;
116 long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */
117 boolean on;
118 {
119     if (on ? initial_don : context.takeoff.cancelled_don)
120         return;
121
122     if (!oldprop /* extrinsic stealth from something else */
123         && !HStealth /* intrinsic stealth */
124         && !BStealth) { /* stealth blocked by something */
125         if (obj->otyp == RIN_STEALTH)
126             learnring(obj, TRUE);
127         else
128             makeknown(obj->otyp);
129
130         if (on) {
131             if (!is_boots(obj))
132 /*JP
133                 You("move very quietly.");
134 */
135                 Your("\90Ã\82©\82É\93®\82¯\82é\82æ\82¤\82É\82È\82Á\82½\81D");
136             else if (Levitation || Flying)
137 /*JP
138                 You("float imperceptibly.");
139 */
140                 You("\82¢\82Â\82Ì\82Ü\82É\82©\95\82\82¢\82Ä\82¢\82½\81D");
141             else
142 /*JP
143                 You("walk very quietly.");
144 */
145                 Your("\91«\89¹\82Í\8f¬\82³\82­\82È\82Á\82½\81D");
146         } else {
147 /*JP
148             You("sure are noisy.");
149 */
150             Your("\91«\89¹\82Í\91å\82«\82­\82È\82Á\82½\81D");
151         }
152     }
153 }
154
155 /* putting on or taking off an item which confers displacement;
156    give feedback and discover it iff displacement state is changing *and*
157    hero is able to see self (or sense monsters) */
158 STATIC_OVL
159 void
160 toggle_displacement(obj, oldprop, on)
161 struct obj *obj;
162 long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */
163 boolean on;
164 {
165     if (on ? initial_don : context.takeoff.cancelled_don)
166         return;
167
168     if (!oldprop /* extrinsic displacement from something else */
169         && !(u.uprops[DISPLACED].intrinsic) /* (theoretical) */
170         && !(u.uprops[DISPLACED].blocked) /* (also theoretical) */
171         /* we don't use canseeself() here because it augments vision
172            with touch, which isn't appropriate for deciding whether
173            we'll notice that monsters have trouble spotting the hero */
174         && ((!Blind         /* see anything */
175              && !u.uswallow /* see surroundings */
176              && !Invisible) /* see self */
177             /* actively sensing nearby monsters via telepathy or extended
178                monster detection overrides vision considerations because
179                hero also senses self in this situation */
180             || (Unblind_telepat
181                 || (Blind_telepat && Blind)
182                 || Detect_monsters))) {
183         makeknown(obj->otyp);
184
185 #if 0 /*JP*/
186         You_feel("that monsters%s have difficulty pinpointing your location.",
187                  on ? "" : " no longer");
188 #else
189         You_feel("\89ö\95¨\82Í\82 \82È\82½\82Ì\88Ê\92u\82ª\82Í\82Á\82«\82è\82Æ\95ª\82©%s\82È\82Á\82½\82æ\82¤\82¾\81D",
190                  on ? "\82ç\82È\82­" : "\82é\82æ\82¤\82É");
191 #endif
192     }
193 }
194
195 /*
196  * The Type_on() functions should be called *after* setworn().
197  * The Type_off() functions call setworn() themselves.
198  * [Blindf_on() is an exception and calls setworn() itself.]
199  */
200
201 STATIC_PTR
202 int
203 Boots_on(VOID_ARGS)
204 {
205     long oldprop =
206         u.uprops[objects[uarmf->otyp].oc_oprop].extrinsic & ~WORN_BOOTS;
207
208     switch (uarmf->otyp) {
209     case LOW_BOOTS:
210     case IRON_SHOES:
211     case HIGH_BOOTS:
212     case JUMPING_BOOTS:
213     case KICKING_BOOTS:
214         break;
215     case WATER_WALKING_BOOTS:
216         if (u.uinwater)
217             spoteffects(TRUE);
218         /* (we don't need a lava check here since boots can't be
219            put on while feet are stuck) */
220         break;
221     case SPEED_BOOTS:
222         /* Speed boots are still better than intrinsic speed, */
223         /* though not better than potion speed */
224         if (!oldprop && !(HFast & TIMEOUT)) {
225             makeknown(uarmf->otyp);
226 #if 0 /*JP*/
227             You_feel("yourself speed up%s.",
228                      (oldprop || HFast) ? " a bit more" : "");
229 #else
230             You("%s\91f\91\81\82­\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D",
231                      (oldprop  || HFast) ? "\82³\82ç\82É" : "");
232 #endif
233         }
234         break;
235     case ELVEN_BOOTS:
236         toggle_stealth(uarmf, oldprop, TRUE);
237         break;
238     case FUMBLE_BOOTS:
239         if (!oldprop && !(HFumbling & ~TIMEOUT))
240             incr_itimeout(&HFumbling, rnd(20));
241         break;
242     case LEVITATION_BOOTS:
243         if (!oldprop && !HLevitation && !BLevitation) {
244             makeknown(uarmf->otyp);
245             float_up();
246             spoteffects(FALSE);
247         } else {
248             float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
249         }
250         break;
251     default:
252         impossible(unknown_type, c_boots, uarmf->otyp);
253     }
254     return 0;
255 }
256
257 int
258 Boots_off(VOID_ARGS)
259 {
260     struct obj *otmp = uarmf;
261     int otyp = otmp->otyp;
262     long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_BOOTS;
263
264     context.takeoff.mask &= ~W_ARMF;
265     /* For levitation, float_down() returns if Levitation, so we
266      * must do a setworn() _before_ the levitation case.
267      */
268     setworn((struct obj *) 0, W_ARMF);
269     switch (otyp) {
270     case SPEED_BOOTS:
271         if (!Very_fast && !context.takeoff.cancelled_don) {
272             makeknown(otyp);
273 /*JP
274             You_feel("yourself slow down%s.", Fast ? " a bit" : "");
275 */
276             You("%s\82Ì\82ë\82­\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", Fast ? "\82¿\82å\82Á\82Æ" : "");
277         }
278         break;
279     case WATER_WALKING_BOOTS:
280         /* check for lava since fireproofed boots make it viable */
281         if ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy))
282             && !Levitation && !Flying && !is_clinger(youmonst.data)
283             && !context.takeoff.cancelled_don
284             /* avoid recursive call to lava_effects() */
285             && !iflags.in_lava_effects) {
286             /* make boots known in case you survive the drowning */
287             makeknown(otyp);
288             spoteffects(TRUE);
289         }
290         break;
291     case ELVEN_BOOTS:
292         toggle_stealth(otmp, oldprop, FALSE);
293         break;
294     case FUMBLE_BOOTS:
295         if (!oldprop && !(HFumbling & ~TIMEOUT))
296             HFumbling = EFumbling = 0;
297         break;
298     case LEVITATION_BOOTS:
299         if (!oldprop && !HLevitation && !BLevitation
300             && !context.takeoff.cancelled_don) {
301             (void) float_down(0L, 0L);
302             makeknown(otyp);
303         } else {
304             float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
305         }
306         break;
307     case LOW_BOOTS:
308     case IRON_SHOES:
309     case HIGH_BOOTS:
310     case JUMPING_BOOTS:
311     case KICKING_BOOTS:
312         break;
313     default:
314         impossible(unknown_type, c_boots, otyp);
315     }
316     context.takeoff.cancelled_don = FALSE;
317     return 0;
318 }
319
320 STATIC_PTR int
321 Cloak_on(VOID_ARGS)
322 {
323     long oldprop =
324         u.uprops[objects[uarmc->otyp].oc_oprop].extrinsic & ~WORN_CLOAK;
325
326     switch (uarmc->otyp) {
327     case ORCISH_CLOAK:
328     case DWARVISH_CLOAK:
329     case CLOAK_OF_MAGIC_RESISTANCE:
330     case ROBE:
331     case LEATHER_CLOAK:
332         break;
333     case CLOAK_OF_PROTECTION:
334         makeknown(uarmc->otyp);
335         break;
336     case ELVEN_CLOAK:
337         toggle_stealth(uarmc, oldprop, TRUE);
338         break;
339     case CLOAK_OF_DISPLACEMENT:
340         toggle_displacement(uarmc, oldprop, TRUE);
341         break;
342     case MUMMY_WRAPPING:
343         /* Note: it's already being worn, so we have to cheat here. */
344         if ((HInvis || EInvis) && !Blind) {
345             newsym(u.ux, u.uy);
346 #if 0 /*JP*/
347             You("can %s!", See_invisible ? "no longer see through yourself"
348                                          : see_yourself);
349 #else
350             pline("%s\81I",
351                   See_invisible ? "\82 \82È\82½\82Í\93§\96¾\82Å\82È\82­\82È\82Á\82½" :
352                   "\8e©\95ª\8e©\90g\82ª\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½");
353 #endif
354         }
355         break;
356     case CLOAK_OF_INVISIBILITY:
357         /* since cloak of invisibility was worn, we know mummy wrapping
358            wasn't, so no need to check `oldprop' against blocked */
359         if (!oldprop && !HInvis && !Blind) {
360             makeknown(uarmc->otyp);
361             newsym(u.ux, u.uy);
362 #if 0 /*JP*/
363             pline("Suddenly you can%s yourself.",
364                   See_invisible ? " see through" : "not see");
365 #else
366             pline("\93Ë\91R\81C%s\82È\82Á\82½\81D",
367                   See_invisible ? "\82 \82È\82½\82Í\93§\96¾\82É" : "\8e©\95ª\8e©\90g\82ª\8c©\82¦\82È\82­");
368 #endif
369         }
370         break;
371     case OILSKIN_CLOAK:
372 /*JP
373         pline("%s very tightly.", Tobjnam(uarmc, "fit"));
374 */
375         pline("%s\82Í\82Æ\82Ä\82à\82Ò\82Á\82¿\82è\8d\87\82¤\81D",xname(uarmc));
376         break;
377     /* Alchemy smock gives poison _and_ acid resistance */
378     case ALCHEMY_SMOCK:
379         EAcid_resistance |= WORN_CLOAK;
380         break;
381     default:
382         impossible(unknown_type, c_cloak, uarmc->otyp);
383     }
384     return 0;
385 }
386
387 int
388 Cloak_off(VOID_ARGS)
389 {
390     struct obj *otmp = uarmc;
391     int otyp = otmp->otyp;
392     long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_CLOAK;
393
394     context.takeoff.mask &= ~W_ARMC;
395     /* For mummy wrapping, taking it off first resets `Invisible'. */
396     setworn((struct obj *) 0, W_ARMC);
397     switch (otyp) {
398     case ORCISH_CLOAK:
399     case DWARVISH_CLOAK:
400     case CLOAK_OF_PROTECTION:
401     case CLOAK_OF_MAGIC_RESISTANCE:
402     case OILSKIN_CLOAK:
403     case ROBE:
404     case LEATHER_CLOAK:
405         break;
406     case ELVEN_CLOAK:
407         toggle_stealth(otmp, oldprop, FALSE);
408         break;
409     case CLOAK_OF_DISPLACEMENT:
410         toggle_displacement(otmp, oldprop, FALSE);
411         break;
412     case MUMMY_WRAPPING:
413         if (Invis && !Blind) {
414             newsym(u.ux, u.uy);
415 #if 0 /*JP*/
416             You("can %s.", See_invisible ? "see through yourself"
417                                          : "no longer see yourself");
418 #else
419             pline("%s\81D", See_invisible ? "\82 \82È\82½\82Í\93§\96¾\82É\82È\82Á\82½"
420                                         : "\8e©\95ª\8e©\90g\82ª\8c©\82¦\82È\82­\82È\82Á\82½");
421 #endif
422         }
423         break;
424     case CLOAK_OF_INVISIBILITY:
425         if (!oldprop && !HInvis && !Blind) {
426             makeknown(CLOAK_OF_INVISIBILITY);
427             newsym(u.ux, u.uy);
428 #if 0 /*JP*/
429             pline("Suddenly you can %s.",
430                   See_invisible ? "no longer see through yourself"
431                                 : see_yourself);
432 #else
433             pline("\93Ë\91R\81C%s\81D",
434                   See_invisible ? "\82 \82È\82½\82Í\93§\96¾\82Å\82È\82­\82È\82Á\82½"
435                                 : "\8e©\95ª\8e©\90g\82ª\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½");
436 #endif
437         }
438         break;
439     /* Alchemy smock gives poison _and_ acid resistance */
440     case ALCHEMY_SMOCK:
441         EAcid_resistance &= ~WORN_CLOAK;
442         break;
443     default:
444         impossible(unknown_type, c_cloak, otyp);
445     }
446     return 0;
447 }
448
449 STATIC_PTR
450 int
451 Helmet_on(VOID_ARGS)
452 {
453     switch (uarmh->otyp) {
454     case FEDORA:
455     case HELMET:
456     case DENTED_POT:
457     case ELVEN_LEATHER_HELM:
458     case DWARVISH_IRON_HELM:
459     case ORCISH_HELM:
460     case HELM_OF_TELEPATHY:
461         break;
462     case HELM_OF_BRILLIANCE:
463         adj_abon(uarmh, uarmh->spe);
464         break;
465     case CORNUTHAUM:
466         /* people think marked wizards know what they're talking
467          * about, but it takes trained arrogance to pull it off,
468          * and the actual enchantment of the hat is irrelevant.
469          */
470         ABON(A_CHA) += (Role_if(PM_WIZARD) ? 1 : -1);
471         context.botl = 1;
472         makeknown(uarmh->otyp);
473         break;
474     case HELM_OF_OPPOSITE_ALIGNMENT:
475         /* changing alignment can toggle off active artifact
476            properties, including levitation; uarmh could get
477            dropped or destroyed here */
478         uchangealign((u.ualign.type != A_NEUTRAL)
479                          ? -u.ualign.type
480                          : (uarmh->o_id % 2) ? A_CHAOTIC : A_LAWFUL,
481                      1);
482     /* makeknown(uarmh->otyp);   -- moved below, after xname() */
483     /*FALLTHRU*/
484     case DUNCE_CAP:
485         if (uarmh && !uarmh->cursed) {
486             if (Blind)
487 /*JP
488                 pline("%s for a moment.", Tobjnam(uarmh, "vibrate"));
489 */
490                 pline("%s\82Í\88ê\8fu\90k\82¦\82½\81D", xname(uarmh));
491             else
492 #if 0 /*JP*/
493                 pline("%s %s for a moment.", Tobjnam(uarmh, "glow"),
494                       hcolor(NH_BLACK));
495 #else
496                 pline("%s\82Í\88ê\8fu%s\8bP\82¢\82½\81D",
497                       xname(uarmh), jconj_adj(hcolor(NH_BLACK)));
498 #endif
499             curse(uarmh);
500         }
501         context.botl = 1; /* reveal new alignment or INT & WIS */
502         if (Hallucination) {
503 #if 0 /*JP*/
504             pline("My brain hurts!"); /* Monty Python's Flying Circus */
505 #else
506             pline("\82Ì\81[\82Ý\82»\83o\81[\83\93\81I"); /*\83\82\83\93\83e\83B\83p\83C\83\\83\93\82Æ\82Í\82¿\82å\82Á\82Æ\88á\82¤\82¯\82Ç*/
507 #endif
508         } else if (uarmh && uarmh->otyp == DUNCE_CAP) {
509 #if 0 /*JP*/
510             You_feel("%s.", /* track INT change; ignore WIS */
511                      ACURR(A_INT)
512                              <= (ABASE(A_INT) + ABON(A_INT) + ATEMP(A_INT))
513                          ? "like sitting in a corner"
514                          : "giddy");
515 #else
516             You("%s\82æ\82¤\82È\8bC\82ª\82µ\82½\81D",
517                      ACURR(A_INT)
518                              <= (ABASE(A_INT) + ABON(A_INT) + ATEMP(A_INT))
519                          ? "\8b÷\82Á\82±\82É\8dÀ\82Á\82Ä\82¢\82é"
520                          : "\96Ú\82ª\82Ü\82í\82Á\82½");
521 #endif
522         } else {
523             /* [message moved to uchangealign()] */
524             makeknown(HELM_OF_OPPOSITE_ALIGNMENT);
525         }
526         break;
527     default:
528         impossible(unknown_type, c_helmet, uarmh->otyp);
529     }
530     return 0;
531 }
532
533 int
534 Helmet_off(VOID_ARGS)
535 {
536     context.takeoff.mask &= ~W_ARMH;
537
538     switch (uarmh->otyp) {
539     case FEDORA:
540     case HELMET:
541     case DENTED_POT:
542     case ELVEN_LEATHER_HELM:
543     case DWARVISH_IRON_HELM:
544     case ORCISH_HELM:
545         break;
546     case DUNCE_CAP:
547         context.botl = 1;
548         break;
549     case CORNUTHAUM:
550         if (!context.takeoff.cancelled_don) {
551             ABON(A_CHA) += (Role_if(PM_WIZARD) ? -1 : 1);
552             context.botl = 1;
553         }
554         break;
555     case HELM_OF_TELEPATHY:
556         /* need to update ability before calling see_monsters() */
557         setworn((struct obj *) 0, W_ARMH);
558         see_monsters();
559         return 0;
560     case HELM_OF_BRILLIANCE:
561         if (!context.takeoff.cancelled_don)
562             adj_abon(uarmh, -uarmh->spe);
563         break;
564     case HELM_OF_OPPOSITE_ALIGNMENT:
565         /* changing alignment can toggle off active artifact
566            properties, including levitation; uarmh could get
567            dropped or destroyed here */
568         uchangealign(u.ualignbase[A_CURRENT], 2);
569         break;
570     default:
571         impossible(unknown_type, c_helmet, uarmh->otyp);
572     }
573     setworn((struct obj *) 0, W_ARMH);
574     context.takeoff.cancelled_don = FALSE;
575     return 0;
576 }
577
578 STATIC_PTR
579 int
580 Gloves_on(VOID_ARGS)
581 {
582     long oldprop =
583         u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES;
584
585     switch (uarmg->otyp) {
586     case LEATHER_GLOVES:
587         break;
588     case GAUNTLETS_OF_FUMBLING:
589         if (!oldprop && !(HFumbling & ~TIMEOUT))
590             incr_itimeout(&HFumbling, rnd(20));
591         break;
592     case GAUNTLETS_OF_POWER:
593         makeknown(uarmg->otyp);
594         context.botl = 1; /* taken care of in attrib.c */
595         break;
596     case GAUNTLETS_OF_DEXTERITY:
597         adj_abon(uarmg, uarmg->spe);
598         break;
599     default:
600         impossible(unknown_type, c_gloves, uarmg->otyp);
601     }
602     return 0;
603 }
604
605 STATIC_OVL void
606 wielding_corpse(obj, voluntary)
607 struct obj *obj;
608 boolean voluntary; /* taking gloves off on purpose? */
609 {
610     char kbuf[BUFSZ];
611
612     if (!obj || obj->otyp != CORPSE)
613         return;
614     if (obj != uwep && (obj != uswapwep || !u.twoweap))
615         return;
616
617     if (touch_petrifies(&mons[obj->corpsenm]) && !Stone_resistance) {
618 #if 0 /*JP*/
619         You("now wield %s in your bare %s.",
620             corpse_xname(obj, (const char *) 0, CXN_ARTICLE),
621             makeplural(body_part(HAND)));
622 #else
623         You("%s\82ð\91f%s\82Å\8e\9d\82Á\82½\81D",
624             corpse_xname(obj, (const char *) 0, CXN_ARTICLE),
625             body_part(HAND));
626 #endif
627 #if 0 /*JP*/
628         Sprintf(kbuf, "%s gloves while wielding %s",
629                 voluntary ? "removing" : "losing", killer_xname(obj));
630 #else
631         Sprintf(kbuf, "%s\82ð\8e\9d\82Á\82Ä\82¢\82é\82Æ\82«\82É\8eè\91Ü\82ð%s",
632                 killer_xname(obj), voluntary ? "\8aO\82µ\82Ä" : "\8e¸\82Á\82Ä");
633 #endif
634         instapetrify(kbuf);
635         /* life-saved; can't continue wielding cockatrice corpse though */
636         remove_worn_item(obj, FALSE);
637     }
638 }
639
640 int
641 Gloves_off(VOID_ARGS)
642 {
643     long oldprop =
644         u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES;
645     boolean on_purpose = !context.mon_moving && !uarmg->in_use;
646
647     context.takeoff.mask &= ~W_ARMG;
648
649     switch (uarmg->otyp) {
650     case LEATHER_GLOVES:
651         break;
652     case GAUNTLETS_OF_FUMBLING:
653         if (!oldprop && !(HFumbling & ~TIMEOUT))
654             HFumbling = EFumbling = 0;
655         break;
656     case GAUNTLETS_OF_POWER:
657         makeknown(uarmg->otyp);
658         context.botl = 1; /* taken care of in attrib.c */
659         break;
660     case GAUNTLETS_OF_DEXTERITY:
661         if (!context.takeoff.cancelled_don)
662             adj_abon(uarmg, -uarmg->spe);
663         break;
664     default:
665         impossible(unknown_type, c_gloves, uarmg->otyp);
666     }
667     setworn((struct obj *) 0, W_ARMG);
668     context.takeoff.cancelled_don = FALSE;
669     (void) encumber_msg(); /* immediate feedback for GoP */
670
671     /* prevent wielding cockatrice when not wearing gloves */
672     if (uwep && uwep->otyp == CORPSE)
673         wielding_corpse(uwep, on_purpose);
674
675     /* KMH -- ...or your secondary weapon when you're wielding it
676        [This case can't actually happen; twoweapon mode won't
677        engage if a corpse has been set up as the alternate weapon.] */
678     if (u.twoweap && uswapwep && uswapwep->otyp == CORPSE)
679         wielding_corpse(uswapwep, on_purpose);
680
681     return 0;
682 }
683
684 STATIC_PTR int
685 Shield_on(VOID_ARGS)
686 {
687     /* no shield currently requires special handling when put on, but we
688        keep this uncommented in case somebody adds a new one which does */
689     switch (uarms->otyp) {
690     case SMALL_SHIELD:
691     case ELVEN_SHIELD:
692     case URUK_HAI_SHIELD:
693     case ORCISH_SHIELD:
694     case DWARVISH_ROUNDSHIELD:
695     case LARGE_SHIELD:
696     case SHIELD_OF_REFLECTION:
697         break;
698     default:
699         impossible(unknown_type, c_shield, uarms->otyp);
700     }
701
702     return 0;
703 }
704
705 int
706 Shield_off(VOID_ARGS)
707 {
708     context.takeoff.mask &= ~W_ARMS;
709
710     /* no shield currently requires special handling when taken off, but we
711        keep this uncommented in case somebody adds a new one which does */
712     switch (uarms->otyp) {
713     case SMALL_SHIELD:
714     case ELVEN_SHIELD:
715     case URUK_HAI_SHIELD:
716     case ORCISH_SHIELD:
717     case DWARVISH_ROUNDSHIELD:
718     case LARGE_SHIELD:
719     case SHIELD_OF_REFLECTION:
720         break;
721     default:
722         impossible(unknown_type, c_shield, uarms->otyp);
723     }
724
725     setworn((struct obj *) 0, W_ARMS);
726     return 0;
727 }
728
729 STATIC_PTR int
730 Shirt_on(VOID_ARGS)
731 {
732     /* no shirt currently requires special handling when put on, but we
733        keep this uncommented in case somebody adds a new one which does */
734     switch (uarmu->otyp) {
735     case HAWAIIAN_SHIRT:
736     case T_SHIRT:
737         break;
738     default:
739         impossible(unknown_type, c_shirt, uarmu->otyp);
740     }
741
742     return 0;
743 }
744
745 int
746 Shirt_off(VOID_ARGS)
747 {
748     context.takeoff.mask &= ~W_ARMU;
749
750     /* no shirt currently requires special handling when taken off, but we
751        keep this uncommented in case somebody adds a new one which does */
752     switch (uarmu->otyp) {
753     case HAWAIIAN_SHIRT:
754     case T_SHIRT:
755         break;
756     default:
757         impossible(unknown_type, c_shirt, uarmu->otyp);
758     }
759
760     setworn((struct obj *) 0, W_ARMU);
761     return 0;
762 }
763
764 /* This must be done in worn.c, because one of the possible intrinsics
765  * conferred is fire resistance, and we have to immediately set
766  * HFire_resistance in worn.c since worn.c will check it before returning.
767  */
768 STATIC_PTR
769 int
770 Armor_on(VOID_ARGS)
771 {
772     return 0;
773 }
774
775 int
776 Armor_off(VOID_ARGS)
777 {
778     context.takeoff.mask &= ~W_ARM;
779     setworn((struct obj *) 0, W_ARM);
780     context.takeoff.cancelled_don = FALSE;
781     return 0;
782 }
783
784 /* The gone functions differ from the off functions in that if you die from
785  * taking it off and have life saving, you still die.
786  */
787 int
788 Armor_gone()
789 {
790     context.takeoff.mask &= ~W_ARM;
791     setnotworn(uarm);
792     context.takeoff.cancelled_don = FALSE;
793     return 0;
794 }
795
796 STATIC_OVL void
797 Amulet_on()
798 {
799     /* make sure amulet isn't wielded; can't use remove_worn_item()
800        here because it has already been set worn in amulet slot */
801     if (uamul == uwep)
802         setuwep((struct obj *) 0);
803     else if (uamul == uswapwep)
804         setuswapwep((struct obj *) 0);
805     else if (uamul == uquiver)
806         setuqwep((struct obj *) 0);
807
808     switch (uamul->otyp) {
809     case AMULET_OF_ESP:
810     case AMULET_OF_LIFE_SAVING:
811     case AMULET_VERSUS_POISON:
812     case AMULET_OF_REFLECTION:
813     case AMULET_OF_MAGICAL_BREATHING:
814     case FAKE_AMULET_OF_YENDOR:
815         break;
816     case AMULET_OF_UNCHANGING:
817         if (Slimed)
818             make_slimed(0L, (char *) 0);
819         break;
820     case AMULET_OF_CHANGE: {
821         int orig_sex = poly_gender();
822
823         if (Unchanging)
824             break;
825         change_sex();
826         /* Don't use same message as polymorph */
827         if (orig_sex != poly_gender()) {
828             makeknown(AMULET_OF_CHANGE);
829 #if 0 /*JP*/
830             You("are suddenly very %s!",
831                 flags.female ? "feminine" : "masculine");
832 #else
833             You("\93Ë\91R%s\82Á\82Û\82­\82È\82Á\82½\81I",
834                 flags.female ? "\8f\97" : "\92j");
835 #endif
836             context.botl = 1;
837         } else
838             /* already polymorphed into single-gender monster; only
839                changed the character's base sex */
840 /*JP
841             You("don't feel like yourself.");
842 */
843             You("\8e©\95ª\8e©\90g\82\82á\82È\82­\82È\82Á\82½\8bC\82ª\82µ\82½\81D");
844 /*JP
845         pline_The("amulet disintegrates!");
846 */
847         pline("\96\82\8f\9c\82¯\82Í\82±\82È\82²\82È\82É\82È\82Á\82½\81I");
848         if (orig_sex == poly_gender() && uamul->dknown
849             && !objects[AMULET_OF_CHANGE].oc_name_known
850             && !objects[AMULET_OF_CHANGE].oc_uname)
851             docall(uamul);
852         useup(uamul);
853         break;
854     }
855     case AMULET_OF_STRANGULATION:
856         if (can_be_strangled(&youmonst)) {
857             makeknown(AMULET_OF_STRANGULATION);
858 /*JP
859             pline("It constricts your throat!");
860 */
861             pline("\96\82\8f\9c\82¯\82Í\82 \82È\82½\82Ì\8dA\82ð\8di\82ß\82Â\82¯\82½\81I");
862             Strangled = 6L;
863         }
864         break;
865     case AMULET_OF_RESTFUL_SLEEP: {
866         long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT);
867
868         /* avoid clobbering FROMOUTSIDE bit, which might have
869            gotten set by previously eating one of these amulets */
870         if (newnap < oldnap || oldnap == 0L)
871             HSleepy = (HSleepy & ~TIMEOUT) | newnap;
872     } break;
873     case AMULET_OF_YENDOR:
874         break;
875     }
876 }
877
878 void
879 Amulet_off()
880 {
881     context.takeoff.mask &= ~W_AMUL;
882
883     switch (uamul->otyp) {
884     case AMULET_OF_ESP:
885         /* need to update ability before calling see_monsters() */
886         setworn((struct obj *) 0, W_AMUL);
887         see_monsters();
888         return;
889     case AMULET_OF_LIFE_SAVING:
890     case AMULET_VERSUS_POISON:
891     case AMULET_OF_REFLECTION:
892     case AMULET_OF_CHANGE:
893     case AMULET_OF_UNCHANGING:
894     case FAKE_AMULET_OF_YENDOR:
895         break;
896     case AMULET_OF_MAGICAL_BREATHING:
897         if (Underwater) {
898             /* HMagical_breathing must be set off
899                 before calling drown() */
900             setworn((struct obj *) 0, W_AMUL);
901             if (!breathless(youmonst.data) && !amphibious(youmonst.data)
902                 && !Swimming) {
903 /*JP
904                 You("suddenly inhale an unhealthy amount of water!");
905 */
906                 You("\93Ë\91R\81C\91å\97Ê\82Ì\90\85\82ð\88ù\82Ý\8d\9e\82ñ\82¾\81I");
907                 (void) drown();
908             }
909             return;
910         }
911         break;
912     case AMULET_OF_STRANGULATION:
913         if (Strangled) {
914             if (Breathless)
915 /*JP
916                 Your("%s is no longer constricted!", body_part(NECK));
917 */
918                 pline("%s\82ª\8ay\82É\82È\82Á\82½\81I", body_part(NECK));
919             else
920 /*JP
921                 You("can breathe more easily!");
922 */
923                 You("\8ay\82É\8cÄ\8bz\82Å\82«\82é\82æ\82¤\82É\82È\82Á\82½\81I");
924             Strangled = 0L;
925         }
926         break;
927     case AMULET_OF_RESTFUL_SLEEP:
928         setworn((struct obj *) 0, W_AMUL);
929         /* HSleepy = 0L; -- avoid clobbering FROMOUTSIDE bit */
930         if (!ESleepy && !(HSleepy & ~TIMEOUT))
931             HSleepy &= ~TIMEOUT; /* clear timeout bits */
932         return;
933     case AMULET_OF_YENDOR:
934         break;
935     }
936     setworn((struct obj *) 0, W_AMUL);
937     return;
938 }
939
940 /* handle ring discovery; comparable to learnwand() */
941 STATIC_OVL void
942 learnring(ring, observed)
943 struct obj *ring;
944 boolean observed;
945 {
946     int ringtype = ring->otyp;
947
948     /* if effect was observeable then we usually discover the type */
949     if (observed) {
950         /* if we already know the ring type which accomplishes this
951            effect (assumes there is at most one type for each effect),
952            mark this ring as having been seen (no need for makeknown);
953            otherwise if we have seen this ring, discover its type */
954         if (objects[ringtype].oc_name_known)
955             ring->dknown = 1;
956         else if (ring->dknown)
957             makeknown(ringtype);
958 #if 0 /* see learnwand() */
959         else
960             ring->eknown = 1;
961 #endif
962     }
963
964     /* make enchantment of charged ring known (might be +0) and update
965        perm invent window if we've seen this ring and know its type */
966     if (ring->dknown && objects[ringtype].oc_name_known) {
967         if (objects[ringtype].oc_charged)
968             ring->known = 1;
969         update_inventory();
970     }
971 }
972
973 void
974 Ring_on(obj)
975 register struct obj *obj;
976 {
977     long oldprop = u.uprops[objects[obj->otyp].oc_oprop].extrinsic;
978     int old_attrib, which;
979     boolean observable;
980
981     /* make sure ring isn't wielded; can't use remove_worn_item()
982        here because it has already been set worn in a ring slot */
983     if (obj == uwep)
984         setuwep((struct obj *) 0);
985     else if (obj == uswapwep)
986         setuswapwep((struct obj *) 0);
987     else if (obj == uquiver)
988         setuqwep((struct obj *) 0);
989
990     /* only mask out W_RING when we don't have both
991        left and right rings of the same type */
992     if ((oldprop & W_RING) != W_RING)
993         oldprop &= ~W_RING;
994
995     switch (obj->otyp) {
996     case RIN_TELEPORTATION:
997     case RIN_REGENERATION:
998     case RIN_SEARCHING:
999     case RIN_HUNGER:
1000     case RIN_AGGRAVATE_MONSTER:
1001     case RIN_POISON_RESISTANCE:
1002     case RIN_FIRE_RESISTANCE:
1003     case RIN_COLD_RESISTANCE:
1004     case RIN_SHOCK_RESISTANCE:
1005     case RIN_CONFLICT:
1006     case RIN_TELEPORT_CONTROL:
1007     case RIN_POLYMORPH:
1008     case RIN_POLYMORPH_CONTROL:
1009     case RIN_FREE_ACTION:
1010     case RIN_SLOW_DIGESTION:
1011     case RIN_SUSTAIN_ABILITY:
1012     case MEAT_RING:
1013         break;
1014     case RIN_STEALTH:
1015         toggle_stealth(obj, oldprop, TRUE);
1016         break;
1017     case RIN_WARNING:
1018         see_monsters();
1019         break;
1020     case RIN_SEE_INVISIBLE:
1021         /* can now see invisible monsters */
1022         set_mimic_blocking(); /* do special mimic handling */
1023         see_monsters();
1024
1025         if (Invis && !oldprop && !HSee_invisible && !Blind) {
1026             newsym(u.ux, u.uy);
1027 /*JP
1028             pline("Suddenly you are transparent, but there!");
1029 */
1030             pline("\93Ë\91R\93§\96¾\82É\82È\82Á\82½\81D\82µ\82©\82µ\91\8dÝ\82Í\82µ\82Ä\82¢\82é\81I");
1031             learnring(obj, TRUE);
1032         }
1033         break;
1034     case RIN_INVISIBILITY:
1035         if (!oldprop && !HInvis && !BInvis && !Blind) {
1036             learnring(obj, TRUE);
1037             newsym(u.ux, u.uy);
1038             self_invis_message();
1039         }
1040         break;
1041     case RIN_LEVITATION:
1042         if (!oldprop && !HLevitation && !BLevitation) {
1043             float_up();
1044             learnring(obj, TRUE);
1045             spoteffects(FALSE); /* for sinks */
1046         } else {
1047             float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
1048         }
1049         break;
1050     case RIN_GAIN_STRENGTH:
1051         which = A_STR;
1052         goto adjust_attrib;
1053     case RIN_GAIN_CONSTITUTION:
1054         which = A_CON;
1055         goto adjust_attrib;
1056     case RIN_ADORNMENT:
1057         which = A_CHA;
1058     adjust_attrib:
1059         old_attrib = ACURR(which);
1060         ABON(which) += obj->spe;
1061         observable = (old_attrib != ACURR(which));
1062         /* if didn't change, usually means ring is +0 but might
1063            be because nonzero couldn't go below min or above max;
1064            learn +0 enchantment if attribute value is not stuck
1065            at a limit [and ring has been seen and its type is
1066            already discovered, both handled by learnring()] */
1067         if (observable || !extremeattr(which))
1068             learnring(obj, observable);
1069         context.botl = 1;
1070         break;
1071     case RIN_INCREASE_ACCURACY: /* KMH */
1072         u.uhitinc += obj->spe;
1073         break;
1074     case RIN_INCREASE_DAMAGE:
1075         u.udaminc += obj->spe;
1076         break;
1077     case RIN_PROTECTION_FROM_SHAPE_CHAN:
1078         rescham();
1079         break;
1080     case RIN_PROTECTION:
1081         /* usually learn enchantment and discover type;
1082            won't happen if ring is unseen or if it's +0
1083            and the type hasn't been discovered yet */
1084         observable = (obj->spe != 0);
1085         learnring(obj, observable);
1086         if (obj->spe)
1087             find_ac(); /* updates botl */
1088         break;
1089     }
1090 }
1091
1092 STATIC_OVL void
1093 Ring_off_or_gone(obj, gone)
1094 register struct obj *obj;
1095 boolean gone;
1096 {
1097     long mask = (obj->owornmask & W_RING);
1098     int old_attrib, which;
1099     boolean observable;
1100
1101     context.takeoff.mask &= ~mask;
1102     if (!(u.uprops[objects[obj->otyp].oc_oprop].extrinsic & mask))
1103         impossible("Strange... I didn't know you had that ring.");
1104     if (gone)
1105         setnotworn(obj);
1106     else
1107         setworn((struct obj *) 0, obj->owornmask);
1108
1109     switch (obj->otyp) {
1110     case RIN_TELEPORTATION:
1111     case RIN_REGENERATION:
1112     case RIN_SEARCHING:
1113     case RIN_HUNGER:
1114     case RIN_AGGRAVATE_MONSTER:
1115     case RIN_POISON_RESISTANCE:
1116     case RIN_FIRE_RESISTANCE:
1117     case RIN_COLD_RESISTANCE:
1118     case RIN_SHOCK_RESISTANCE:
1119     case RIN_CONFLICT:
1120     case RIN_TELEPORT_CONTROL:
1121     case RIN_POLYMORPH:
1122     case RIN_POLYMORPH_CONTROL:
1123     case RIN_FREE_ACTION:
1124     case RIN_SLOW_DIGESTION:
1125     case RIN_SUSTAIN_ABILITY:
1126     case MEAT_RING:
1127         break;
1128     case RIN_STEALTH:
1129         toggle_stealth(obj, (EStealth & ~mask), FALSE);
1130         break;
1131     case RIN_WARNING:
1132         see_monsters();
1133         break;
1134     case RIN_SEE_INVISIBLE:
1135         /* Make invisible monsters go away */
1136         if (!See_invisible) {
1137             set_mimic_blocking(); /* do special mimic handling */
1138             see_monsters();
1139         }
1140
1141         if (Invisible && !Blind) {
1142             newsym(u.ux, u.uy);
1143 /*JP
1144             pline("Suddenly you cannot see yourself.");
1145 */
1146             pline("\93Ë\91R\81C\8e©\95ª\8e©\90g\82ª\8c©\82¦\82È\82­\82È\82Á\82½\81D");
1147             learnring(obj, TRUE);
1148         }
1149         break;
1150     case RIN_INVISIBILITY:
1151         if (!Invis && !BInvis && !Blind) {
1152             newsym(u.ux, u.uy);
1153 #if 0 /*JP*/
1154             Your("body seems to unfade%s.",
1155                  See_invisible ? " completely" : "..");
1156 #else
1157             Your("\91Ì\82ª%s\81D",
1158                  See_invisible ? "\8a®\91S\82É\8c»\82í\82ê\82½" : "\8e\9f\91æ\82É\8c»\82í\82ê\82Ä\82«\82½\81D\81D");
1159 #endif
1160             learnring(obj, TRUE);
1161         }
1162         break;
1163     case RIN_LEVITATION:
1164         if (!BLevitation) {
1165             (void) float_down(0L, 0L);
1166             if (!Levitation)
1167                 learnring(obj, TRUE);
1168         } else {
1169             float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
1170         }
1171         break;
1172     case RIN_GAIN_STRENGTH:
1173         which = A_STR;
1174         goto adjust_attrib;
1175     case RIN_GAIN_CONSTITUTION:
1176         which = A_CON;
1177         goto adjust_attrib;
1178     case RIN_ADORNMENT:
1179         which = A_CHA;
1180     adjust_attrib:
1181         old_attrib = ACURR(which);
1182         ABON(which) -= obj->spe;
1183         observable = (old_attrib != ACURR(which));
1184         /* same criteria as Ring_on() */
1185         if (observable || !extremeattr(which))
1186             learnring(obj, observable);
1187         context.botl = 1;
1188         break;
1189     case RIN_INCREASE_ACCURACY: /* KMH */
1190         u.uhitinc -= obj->spe;
1191         break;
1192     case RIN_INCREASE_DAMAGE:
1193         u.udaminc -= obj->spe;
1194         break;
1195     case RIN_PROTECTION:
1196         /* might have been put on while blind and we can now see
1197            or perhaps been forgotten due to amnesia */
1198         observable = (obj->spe != 0);
1199         learnring(obj, observable);
1200         if (obj->spe)
1201             find_ac(); /* updates botl */
1202         break;
1203     case RIN_PROTECTION_FROM_SHAPE_CHAN:
1204         /* If you're no longer protected, let the chameleons
1205          * change shape again -dgk
1206          */
1207         restartcham();
1208         break;
1209     }
1210 }
1211
1212 void
1213 Ring_off(obj)
1214 struct obj *obj;
1215 {
1216     Ring_off_or_gone(obj, FALSE);
1217 }
1218
1219 void
1220 Ring_gone(obj)
1221 struct obj *obj;
1222 {
1223     Ring_off_or_gone(obj, TRUE);
1224 }
1225
1226 void
1227 Blindf_on(otmp)
1228 register struct obj *otmp;
1229 {
1230     boolean already_blind = Blind, changed = FALSE;
1231
1232     /* blindfold might be wielded; release it for wearing */
1233     if (otmp->owornmask & W_WEAPON)
1234         remove_worn_item(otmp, FALSE);
1235     setworn(otmp, W_TOOL);
1236     on_msg(otmp);
1237
1238     if (Blind && !already_blind) {
1239         changed = TRUE;
1240         if (flags.verbose)
1241 /*JP
1242             You_cant("see any more.");
1243 */
1244             You("\89½\82à\8c©\82¦\82È\82­\82È\82Á\82½\81D");
1245         /* set ball&chain variables before the hero goes blind */
1246         if (Punished)
1247             set_bc(0);
1248     } else if (already_blind && !Blind) {
1249         changed = TRUE;
1250         /* "You are now wearing the Eyes of the Overworld." */
1251         if (u.uroleplay.blind) {
1252             /* this can only happen by putting on the Eyes of the Overworld;
1253                that shouldn't actually produce a permanent cure, but we
1254                can't let the "blind from birth" conduct remain intact */
1255 /*JP
1256             pline("For the first time in your life, you can see!");
1257 */
1258             pline("\90l\90\82Å\8f\89\82ß\82Ä\81C\96Ú\82ª\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81I");
1259             u.uroleplay.blind = FALSE;
1260         } else
1261 /*JP
1262             You("can see!");
1263 */
1264             You("\96Ú\82ª\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81I");
1265     }
1266     if (changed) {
1267         /* blindness has just been toggled */
1268         if (Blind_telepat || Infravision)
1269             see_monsters();
1270         vision_full_recalc = 1; /* recalc vision limits */
1271         if (!Blind)
1272             learn_unseen_invent();
1273         context.botl = 1;
1274     }
1275 }
1276
1277 void
1278 Blindf_off(otmp)
1279 register struct obj *otmp;
1280 {
1281     boolean was_blind = Blind, changed = FALSE;
1282
1283     if (!otmp) {
1284         impossible("Blindf_off without otmp");
1285         return;
1286     }
1287     context.takeoff.mask &= ~W_TOOL;
1288     setworn((struct obj *) 0, otmp->owornmask);
1289     off_msg(otmp);
1290
1291     if (Blind) {
1292         if (was_blind) {
1293             /* "still cannot see" makes no sense when removing lenses
1294                since they can't have been the cause of your blindness */
1295             if (otmp->otyp != LENSES)
1296 /*JP
1297                 You("still cannot see.");
1298 */
1299                 You("\82Ü\82¾\96Ú\82ª\8c©\82¦\82È\82¢\81D");
1300         } else {
1301             changed = TRUE; /* !was_blind */
1302             /* "You were wearing the Eyes of the Overworld." */
1303 /*JP
1304             You_cant("see anything now!");
1305 */
1306             You("\8d¡\82Í\89½\82à\8c©\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81I");
1307             /* set ball&chain variables before the hero goes blind */
1308             if (Punished)
1309                 set_bc(0);
1310         }
1311     } else if (was_blind) {
1312         if (!gulp_blnd_check()) {
1313             changed = TRUE; /* !Blind */
1314 /*JP
1315             You("can see again.");
1316 */
1317             You("\82Ó\82½\82½\82Ñ\96Ú\82ª\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81D");
1318         }
1319     }
1320     if (changed) {
1321         /* blindness has just been toggled */
1322         if (Blind_telepat || Infravision)
1323             see_monsters();
1324         vision_full_recalc = 1; /* recalc vision limits */
1325         if (!Blind)
1326             learn_unseen_invent();
1327         context.botl = 1;
1328     }
1329 }
1330
1331 /* called in moveloop()'s prologue to set side-effects of worn start-up items;
1332    also used by poly_obj() when a worn item gets transformed */
1333 void
1334 set_wear(obj)
1335 struct obj *obj; /* if null, do all worn items; otherwise just obj itself */
1336 {
1337     initial_don = !obj;
1338
1339     if (!obj ? ublindf != 0 : (obj == ublindf))
1340         (void) Blindf_on(ublindf);
1341     if (!obj ? uright != 0 : (obj == uright))
1342         (void) Ring_on(uright);
1343     if (!obj ? uleft != 0 : (obj == uleft))
1344         (void) Ring_on(uleft);
1345     if (!obj ? uamul != 0 : (obj == uamul))
1346         (void) Amulet_on();
1347
1348     if (!obj ? uarmu != 0 : (obj == uarmu))
1349         (void) Shirt_on();
1350     if (!obj ? uarm != 0 : (obj == uarm))
1351         (void) Armor_on();
1352     if (!obj ? uarmc != 0 : (obj == uarmc))
1353         (void) Cloak_on();
1354     if (!obj ? uarmf != 0 : (obj == uarmf))
1355         (void) Boots_on();
1356     if (!obj ? uarmg != 0 : (obj == uarmg))
1357         (void) Gloves_on();
1358     if (!obj ? uarmh != 0 : (obj == uarmh))
1359         (void) Helmet_on();
1360     if (!obj ? uarms != 0 : (obj == uarms))
1361         (void) Shield_on();
1362
1363     initial_don = FALSE;
1364 }
1365
1366 /* check whether the target object is currently being put on (or taken off--
1367    also checks for doffing) */
1368 boolean
1369 donning(otmp)
1370 struct obj *otmp;
1371 {
1372     /* long what = (occupation == take_off) ? context.takeoff.what : 0L; */
1373     long what = context.takeoff.what; /* if nonzero, occupation is implied */
1374     boolean result = FALSE;
1375
1376     /* 'W' and 'T' set afternmv, 'A' sets context.takeoff.what */
1377     if (otmp == uarm)
1378         result = (afternmv == Armor_on || afternmv == Armor_off
1379                   || what == WORN_ARMOR);
1380     else if (otmp == uarmu)
1381         result = (afternmv == Shirt_on || afternmv == Shirt_off
1382                   || what == WORN_SHIRT);
1383     else if (otmp == uarmc)
1384         result = (afternmv == Cloak_on || afternmv == Cloak_off
1385                   || what == WORN_CLOAK);
1386     else if (otmp == uarmf)
1387         result = (afternmv == Boots_on || afternmv == Boots_off
1388                   || what == WORN_BOOTS);
1389     else if (otmp == uarmh)
1390         result = (afternmv == Helmet_on || afternmv == Helmet_off
1391                   || what == WORN_HELMET);
1392     else if (otmp == uarmg)
1393         result = (afternmv == Gloves_on || afternmv == Gloves_off
1394                   || what == WORN_GLOVES);
1395     else if (otmp == uarms)
1396         result = (afternmv == Shield_on || afternmv == Shield_off
1397                   || what == WORN_SHIELD);
1398
1399     return result;
1400 }
1401
1402 /* check whether the target object is currently being taken off,
1403    so that stop_donning() and steal() can vary messages */
1404 boolean
1405 doffing(otmp)
1406 struct obj *otmp;
1407 {
1408     long what = context.takeoff.what;
1409     boolean result = FALSE;
1410
1411     /* 'T' (also 'W') sets afternmv, 'A' sets context.takeoff.what */
1412     if (otmp == uarm)
1413         result = (afternmv == Armor_off || what == WORN_ARMOR);
1414     else if (otmp == uarmu)
1415         result = (afternmv == Shirt_off || what == WORN_SHIRT);
1416     else if (otmp == uarmc)
1417         result = (afternmv == Cloak_off || what == WORN_CLOAK);
1418     else if (otmp == uarmf)
1419         result = (afternmv == Boots_off || what == WORN_BOOTS);
1420     else if (otmp == uarmh)
1421         result = (afternmv == Helmet_off || what == WORN_HELMET);
1422     else if (otmp == uarmg)
1423         result = (afternmv == Gloves_off || what == WORN_GLOVES);
1424     else if (otmp == uarms)
1425         result = (afternmv == Shield_off || what == WORN_SHIELD);
1426
1427     return result;
1428 }
1429
1430 void
1431 cancel_don()
1432 {
1433     /* the piece of armor we were donning/doffing has vanished, so stop
1434      * wasting time on it (and don't dereference it when donning would
1435      * otherwise finish)
1436      */
1437     context.takeoff.cancelled_don =
1438         (afternmv == Boots_on || afternmv == Helmet_on
1439          || afternmv == Gloves_on || afternmv == Armor_on);
1440     afternmv = 0;
1441     nomovemsg = (char *) 0;
1442     multi = 0;
1443     context.takeoff.delay = 0;
1444     context.takeoff.what = 0L;
1445 }
1446
1447 /* called by steal() during theft from hero; interrupt donning/doffing */
1448 int
1449 stop_donning(stolenobj)
1450 struct obj *stolenobj; /* no message if stolenobj is already being doffing */
1451 {
1452     char buf[BUFSZ];
1453     struct obj *otmp;
1454     boolean putting_on;
1455     int result = 0;
1456
1457     for (otmp = invent; otmp; otmp = otmp->nobj)
1458         if ((otmp->owornmask & W_ARMOR) && donning(otmp))
1459             break;
1460     /* at most one item will pass donning() test at any given time */
1461     if (!otmp)
1462         return 0;
1463
1464     /* donning() returns True when doffing too; doffing() is more specific */
1465     putting_on = !doffing(otmp);
1466     /* cancel_don() looks at afternmv; it also serves as cancel_doff() */
1467     cancel_don();
1468     /* don't want <armor>_on() or <armor>_off() being called
1469        by unmul() since the on or off action isn't completing */
1470     afternmv = 0;
1471     if (putting_on || otmp != stolenobj) {
1472 #if 0 /*JP*/
1473         Sprintf(buf, "You stop %s %s.",
1474                 putting_on ? "putting on" : "taking off",
1475                 thesimpleoname(otmp));
1476 #else
1477         Sprintf(buf, "\82 \82È\82½\82Í%s\82ð%s\82Ì\82ð\8e~\82ß\82½\81D",
1478                 thesimpleoname(otmp),
1479                 putting_on ? "\90g\82É\82Â\82¯\82é" : "\8aO\82·");
1480 #endif
1481     } else {
1482         buf[0] = '\0';   /* silently stop doffing stolenobj */
1483         result = -multi; /* remember this before calling unmul() */
1484     }
1485     unmul(buf);
1486     /* while putting on, item becomes worn immediately but side-effects are
1487        deferred until the delay expires; when interrupted, make it unworn
1488        (while taking off, item stays worn until the delay expires; when
1489        interrupted, leave it worn) */
1490     if (putting_on)
1491         remove_worn_item(otmp, FALSE);
1492
1493     return result;
1494 }
1495
1496 /* both 'clothes' and 'accessories' now include both armor and accessories;
1497    TOOL_CLASS is for eyewear, FOOD_CLASS is for MEAT_RING */
1498 static NEARDATA const char clothes[] = {
1499     ARMOR_CLASS, RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, 0
1500 };
1501 static NEARDATA const char accessories[] = {
1502     RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, ARMOR_CLASS, 0
1503 };
1504 STATIC_VAR NEARDATA int Narmorpieces, Naccessories;
1505
1506 /* assign values to Narmorpieces and Naccessories */
1507 STATIC_OVL void
1508 count_worn_stuff(which, accessorizing)
1509 struct obj **which; /* caller wants this when count is 1 */
1510 boolean accessorizing;
1511 {
1512     struct obj *otmp;
1513
1514     Narmorpieces = Naccessories = 0;
1515
1516 #define MOREWORN(x,wtyp) do { if (x) { wtyp++; otmp = x; } } while (0)
1517     otmp = 0;
1518     MOREWORN(uarmh, Narmorpieces);
1519     MOREWORN(uarms, Narmorpieces);
1520     MOREWORN(uarmg, Narmorpieces);
1521     MOREWORN(uarmf, Narmorpieces);
1522     /* for cloak/suit/shirt, we only count the outermost item so that it
1523        can be taken off without confirmation if final count ends up as 1 */
1524     if (uarmc)
1525         MOREWORN(uarmc, Narmorpieces);
1526     else if (uarm)
1527         MOREWORN(uarm, Narmorpieces);
1528     else if (uarmu)
1529         MOREWORN(uarmu, Narmorpieces);
1530     if (!accessorizing)
1531         *which = otmp; /* default item iff Narmorpieces is 1 */
1532
1533     otmp = 0;
1534     MOREWORN(uleft, Naccessories);
1535     MOREWORN(uright, Naccessories);
1536     MOREWORN(uamul, Naccessories);
1537     MOREWORN(ublindf, Naccessories);
1538     if (accessorizing)
1539         *which = otmp; /* default item iff Naccessories is 1 */
1540 #undef MOREWORN
1541 }
1542
1543 /* take off one piece or armor or one accessory;
1544    shared by dotakeoff('T') and doremring('R') */
1545 STATIC_OVL int
1546 armor_or_accessory_off(obj)
1547 struct obj *obj;
1548 {
1549     if (!(obj->owornmask & (W_ARMOR | W_ACCESSORY))) {
1550 /*JP
1551         You("are not wearing that.");
1552 */
1553         You("\82»\82ê\82ð\90g\82É\82Â\82¯\82Ä\82¢\82È\82¢\81D");
1554         return 0;
1555     }
1556
1557     reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */
1558     (void) select_off(obj);
1559     if (!context.takeoff.mask)
1560         return 0;
1561     /* none of armoroff()/Ring_/Amulet/Blindf_off() use context.takeoff.mask */
1562     reset_remarm();
1563
1564     if (obj->owornmask & W_ARMOR) {
1565         (void) armoroff(obj);
1566     } else if (obj == uright || obj == uleft) {
1567         /* Sometimes we want to give the off_msg before removing and
1568          * sometimes after; for instance, "you were wearing a moonstone
1569          * ring (on right hand)" is desired but "you were wearing a
1570          * square amulet (being worn)" is not because of the redundant
1571          * "being worn".
1572          */
1573         off_msg(obj);
1574         Ring_off(obj);
1575     } else if (obj == uamul) {
1576         Amulet_off();
1577         off_msg(obj);
1578     } else if (obj == ublindf) {
1579         Blindf_off(obj); /* does its own off_msg */
1580     } else {
1581         impossible("removing strange accessory?");
1582         if (obj->owornmask)
1583             remove_worn_item(obj, FALSE);
1584     }
1585     return 1;
1586 }
1587
1588 /* the 'T' command */
1589 int
1590 dotakeoff()
1591 {
1592     struct obj *otmp = (struct obj *) 0;
1593 #if 1 /*JP*/
1594     const char *j;
1595     const char *m;
1596 #endif
1597
1598     count_worn_stuff(&otmp, FALSE);
1599     if (!Narmorpieces && !Naccessories) {
1600         /* assert( GRAY_DRAGON_SCALES > YELLOW_DRAGON_SCALE_MAIL ); */
1601         if (uskin)
1602 #if 0 /*JP*/
1603             pline_The("%s merged with your skin!",
1604                       uskin->otyp >= GRAY_DRAGON_SCALES
1605                           ? "dragon scales are"
1606                           : "dragon scale mail is");
1607 #else
1608             pline("\83h\83\89\83S\83\93\82Ì\97Ø%s\82Í\82 \82È\82½\82Ì\94§\82Æ\97Z\8d\87\82µ\82Ä\82µ\82Ü\82Á\82Ä\82¢\82é\81I",
1609                       uskin->otyp >= GRAY_DRAGON_SCALES
1610                           ? "" : "\8aZ");
1611 #endif
1612         else
1613 /*JP
1614             pline("Not wearing any armor or accessories.");
1615 */
1616             pline("\8aZ\82â\91\95\8fü\95i\82ð\90g\82É\82Â\82¯\82Ä\82¢\82È\82¢\81D");
1617         return 0;
1618     }
1619     if (Narmorpieces != 1 || ParanoidRemove)
1620         otmp = getobj(clothes, "take off");
1621     if (!otmp)
1622         return 0;
1623     if (otmp == uskin
1624         || ((otmp == uarm) && uarmc)
1625         || ((otmp == uarmu) && (uarmc || uarm))) {
1626         char why[BUFSZ], what[BUFSZ];
1627
1628         why[0] = what[0] = '\0';
1629         if (otmp != uskin) {
1630             if (uarmc)
1631                 Strcat(what, cloak_simple_name(uarmc));
1632             if ((otmp == uarmu) && uarm) {
1633                 if (uarmc)
1634                     Strcat(what, " and ");
1635                 Strcat(what, suit_simple_name(uarm));
1636             }
1637             Sprintf(why, " without taking off your %s first", what);
1638         }
1639 #if 0 /*JP*/
1640         You_cant("take that off%s.", why);
1641 #else
1642         m = joffmsg(otmp, &j);
1643         You("\82»\82ê%s%s\82±\82Æ\82Í\82Å\82«\82È\82¢\81D", j, m);
1644 #endif
1645         return 0;
1646     }
1647
1648     return armor_or_accessory_off(otmp);
1649 }
1650
1651 /* the 'R' command */
1652 int
1653 doremring()
1654 {
1655     struct obj *otmp = 0;
1656
1657     count_worn_stuff(&otmp, TRUE);
1658     if (!Naccessories && !Narmorpieces) {
1659 /*JP
1660         pline("Not wearing any accessories or armor.");
1661 */
1662         pline("\91\95\8fü\95i\82â\8aZ\82ð\90g\82É\82Â\82¯\82Ä\82¢\82È\82¢\81D");
1663         return 0;
1664     }
1665     if (Naccessories != 1 || ParanoidRemove)
1666         otmp = getobj(accessories, "remove");
1667     if (!otmp)
1668         return 0;
1669
1670     return armor_or_accessory_off(otmp);
1671 }
1672
1673 /* Check if something worn is cursed _and_ unremovable. */
1674 int
1675 cursed(otmp)
1676 register struct obj *otmp;
1677 {
1678     /* Curses, like chickens, come home to roost. */
1679     if ((otmp == uwep) ? welded(otmp) : (int) otmp->cursed) {
1680 #if 0 /*JP*/
1681         boolean use_plural = (is_boots(otmp) || is_gloves(otmp)
1682                               || otmp->otyp == LENSES || otmp->quan > 1L);
1683
1684         You("can't.  %s cursed.", use_plural ? "They are" : "It is");
1685 #else
1686         pline("\96³\97\9d\82¾\81D\82»\82ê\82Í\8eô\82í\82ê\82Ä\82¢\82é\81D");
1687 #endif
1688         otmp->bknown = TRUE;
1689         return 1;
1690     }
1691     return 0;
1692 }
1693
1694 int
1695 armoroff(otmp)
1696 register struct obj *otmp;
1697 {
1698     register int delay = -objects[otmp->otyp].oc_delay;
1699
1700     if (cursed(otmp))
1701         return 0;
1702     if (delay) {
1703         nomul(delay);
1704         multi_reason = "disrobing";
1705         if (is_helmet(otmp)) {
1706             /* ick... */
1707 /*JP
1708             nomovemsg = !strcmp(helm_simple_name(otmp), "hat")
1709 */
1710             nomovemsg = !strcmp(helm_simple_name(otmp), "\96X\8eq")
1711 /*JP
1712                             ? "You finish taking off your hat."
1713 */
1714                             ? "\82 \82È\82½\82Í\8a\95\82ð\92E\82¬\82¨\82¦\82½\81D"
1715 /*JP
1716                             : "You finish taking off your helmet.";
1717 */
1718                             : "\82 \82È\82½\82Í\96X\8eq\82ð\92E\82¬\82¨\82¦\82½\81D";
1719             afternmv = Helmet_off;
1720         } else if (is_gloves(otmp)) {
1721 /*JP
1722             nomovemsg = "You finish taking off your gloves.";
1723 */
1724             nomovemsg = "\82 \82È\82½\82Í\8f¬\8eè\82ð\92E\82¬\82¨\82¦\82½\81D";
1725             afternmv = Gloves_off;
1726         } else if (is_boots(otmp)) {
1727 /*JP
1728             nomovemsg = "You finish taking off your boots.";
1729 */
1730             nomovemsg = "\82 \82È\82½\82Í\8cC\82ð\92E\82¬\82¨\82¦\82½\81D";
1731             afternmv = Boots_off;
1732         } else {
1733 /*JP
1734             nomovemsg = "You finish taking off your suit.";
1735 */
1736             nomovemsg = "\82 \82È\82½\82Í\92\85\82Ä\82¢\82é\95¨\82ð\92E\82¬\82¨\82¦\82½\81D";
1737             afternmv = Armor_off;
1738         }
1739     } else {
1740         /* Be warned!  We want off_msg after removing the item to
1741          * avoid "You were wearing ____ (being worn)."  However, an
1742          * item which grants fire resistance might cause some trouble
1743          * if removed in Hell and lifesaving puts it back on; in this
1744          * case the message will be printed at the wrong time (after
1745          * the messages saying you died and were lifesaved).  Luckily,
1746          * no cloak, shield, or fast-removable armor grants fire
1747          * resistance, so we can safely do the off_msg afterwards.
1748          * Rings do grant fire resistance, but for rings we want the
1749          * off_msg before removal anyway so there's no problem.  Take
1750          * care in adding armors granting fire resistance; this code
1751          * might need modification.
1752          * 3.2 (actually 3.1 even): that comment is obsolete since
1753          * fire resistance is not required for Gehennom so setworn()
1754          * doesn't force the resistance granting item to be re-worn
1755          * after being lifesaved anymore.
1756          */
1757         if (is_cloak(otmp))
1758             (void) Cloak_off();
1759         else if (is_shield(otmp))
1760             (void) Shield_off();
1761         else
1762             setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
1763         off_msg(otmp);
1764     }
1765     context.takeoff.mask = context.takeoff.what = 0L;
1766     return 1;
1767 }
1768
1769 /*JP 
1770 ** \95¨\82É\82æ\82Á\82Ä\93®\8e\8c\82ª\95Ï\89»\82·\82é\82Ì\82Å otmp\82ð\92Ç\89Á
1771 */
1772 STATIC_OVL void
1773 #if 0 /*JP*/
1774 already_wearing(cc)
1775 const char *cc;
1776 #else
1777 already_wearing(cc, otmp)
1778 const char *cc;
1779 struct obj *otmp;
1780 #endif
1781 {
1782 #if 1 /*JP*/
1783     const char *j;
1784     const char *m;
1785     m = jconj(jonmsg(otmp, &j), "\82Ä\82¢\82é");
1786 #endif
1787 /*JP
1788     You("are already wearing %s%c", cc, (cc == c_that_) ? '!' : '.');
1789 */
1790     You("\82à\82¤%s%s%s%s", cc, j,  m, (cc == c_that_) ? "\81I" : "\81D");
1791 }
1792
1793 STATIC_OVL void
1794 already_wearing2(cc1, cc2)
1795 const char *cc1, *cc2;
1796 {
1797 /*JP
1798     You_cant("wear %s because you're wearing %s there already.", cc1, cc2);
1799 */
1800     You_cant("%s\82ð\90g\82É\95t\82¯\82Ä\82¢\82é\82Ì\82Å%s\82ð\90g\82É\82Â\82¯\82ç\82ê\82È\82¢\81D", cc2, cc1);
1801 }
1802
1803 /*
1804  * canwearobj checks to see whether the player can wear a piece of armor
1805  *
1806  * inputs: otmp (the piece of armor)
1807  *         noisy (if TRUE give error messages, otherwise be quiet about it)
1808  * output: mask (otmp's armor type)
1809  */
1810 int
1811 canwearobj(otmp, mask, noisy)
1812 struct obj *otmp;
1813 long *mask;
1814 boolean noisy;
1815 {
1816     int err = 0;
1817     const char *which;
1818 #if 1 /*JP*/
1819     const char *m;
1820     const char *j;
1821 #endif
1822
1823     which = is_cloak(otmp)
1824                 ? c_cloak
1825                 : is_shirt(otmp)
1826                     ? c_shirt
1827                     : is_suit(otmp)
1828                         ? c_suit
1829                         : 0;
1830     if (which && cantweararm(youmonst.data)
1831         /* same exception for cloaks as used in m_dowear() */
1832         && (which != c_cloak || youmonst.data->msize != MZ_SMALL)
1833         && (racial_exception(&youmonst, otmp) < 1)) {
1834         if (noisy)
1835 /*JP
1836             pline_The("%s will not fit on your body.", which);
1837 */
1838             pline("%s\82Í\82 \82È\82½\82Ì\91Ì\82É\8d\87\82í\82È\82¢\81D", which);
1839         return 0;
1840     } else if (otmp->owornmask & W_ARMOR) {
1841         if (noisy)
1842 #if 0 /*JP*/
1843             already_wearing(c_that_);
1844 #else
1845             already_wearing(c_that_, otmp);
1846 #endif
1847         return 0;
1848     }
1849
1850     if (welded(uwep) && bimanual(uwep) && (is_suit(otmp) || is_shirt(otmp))) {
1851         if (noisy)
1852 /*JP
1853             You("cannot do that while holding your %s.",
1854 */
1855             pline("%s\82ð\8e\9d\82Á\82½\82Ü\82Ü\82Å\82Í\82»\82ê\82Í\8fo\97\88\82È\82¢\81D",
1856                 is_sword(uwep) ? c_sword : c_weapon);
1857         return 0;
1858     }
1859
1860     if (is_helmet(otmp)) {
1861         if (uarmh) {
1862             if (noisy)
1863 #if 0 /*JP*/
1864                 already_wearing(an(helm_simple_name(uarmh)));
1865 #else
1866                 already_wearing(helm_simple_name(uarmh), uarmh);
1867 #endif
1868             err++;
1869         } else if (Upolyd && has_horns(youmonst.data) && !is_flimsy(otmp)) {
1870             /* (flimsy exception matches polyself handling) */
1871             if (noisy)
1872 #if 0 /*JP*/
1873                 pline_The("%s won't fit over your horn%s.",
1874                           helm_simple_name(otmp),
1875                           plur(num_horns(youmonst.data)));
1876 #else
1877                 pline("\8ap\82ª\82\82á\82Ü\82Å%s\82ð\90g\82É\82Â\82¯\82ç\82ê\82È\82¢\81D",
1878                       helm_simple_name(otmp));
1879 #endif
1880             err++;
1881         } else
1882             *mask = W_ARMH;
1883     } else if (is_shield(otmp)) {
1884         if (uarms) {
1885             if (noisy)
1886 #if 0 /*JP*/
1887                 already_wearing(an(c_shield));
1888 #else
1889                 already_wearing(c_shield, uarms);
1890 #endif
1891             err++;
1892         } else if (uwep && bimanual(uwep)) {
1893             if (noisy)
1894 #if 0 /*JP*/
1895                 You("cannot wear a shield while wielding a two-handed %s.",
1896                     is_sword(uwep) ? c_sword : (uwep->otyp == BATTLE_AXE)
1897                                                    ? c_axe
1898                                                    : c_weapon);
1899 #else
1900                 {
1901                     m = jconj(jonmsg(uwep, &j), "\82Ä\82¢\82é");
1902                     You("\97¼\8eè\8e\9d\82¿\82Ì%s%s%s\82Ì\82Å\8f\82\82Å\90g\82ð\8eç\82ê\82È\82¢\81D",
1903                         is_sword(uwep) ? c_sword :
1904                         uwep->otyp == BATTLE_AXE ? c_axe : c_weapon,
1905                         j, m);
1906                 }
1907 #endif
1908             err++;
1909         } else if (u.twoweap) {
1910             if (noisy)
1911 /*JP
1912                 You("cannot wear a shield while wielding two weapons.");
1913 */
1914                 You("\93ñ\93\81\97¬\82ð\82µ\82Ä\82¢\82é\82Ì\82Å\8f\82\82Å\90g\82ð\8eç\82ê\82È\82¢\81D");
1915             err++;
1916         } else
1917             *mask = W_ARMS;
1918     } else if (is_boots(otmp)) {
1919         if (uarmf) {
1920             if (noisy)
1921 #if 0 /*JP*/
1922                 already_wearing(c_boots);
1923 #else
1924                 already_wearing(c_boots, uarmf);
1925 #endif
1926             err++;
1927         } else if (Upolyd && slithy(youmonst.data)) {
1928             if (noisy)
1929 #if 0 /*JP*/
1930                 You("have no feet..."); /* not body_part(FOOT) */
1931 #else
1932                 You("\91«\82ª\82È\82¢\81D\81D\81D");  /* not body_part(FOOT) */
1933 #endif
1934             err++;
1935         } else if (Upolyd && youmonst.data->mlet == S_CENTAUR) {
1936             /* break_armor() pushes boots off for centaurs,
1937                so don't let dowear() put them back on... */
1938             if (noisy)
1939 #if 0 /*JP*/
1940                 pline("You have too many hooves to wear %s.",
1941                       c_boots); /* makeplural(body_part(FOOT)) yields
1942                                    "rear hooves" which sounds odd */
1943 #else
1944                 pline("%s\82ð\97\9a\82­\82É\82Í\91«\82ª\91½\82·\82¬\82é\81D", c_boots);
1945 #endif
1946             err++;
1947         } else if (u.utrap
1948                    && (u.utraptype == TT_BEARTRAP || u.utraptype == TT_INFLOOR
1949                        || u.utraptype == TT_LAVA
1950                        || u.utraptype == TT_BURIEDBALL)) {
1951             if (u.utraptype == TT_BEARTRAP) {
1952                 if (noisy)
1953 /*JP
1954                     Your("%s is trapped!", body_part(FOOT));
1955 */
1956                     Your("%s\82Íã©\82É\82©\82©\82Á\82Ä\82¢\82é\81I", body_part(FOOT));
1957             } else if (u.utraptype == TT_INFLOOR || u.utraptype == TT_LAVA) {
1958                 if (noisy)
1959 #if 0 /*JP*/
1960                     Your("%s are stuck in the %s!",
1961                          makeplural(body_part(FOOT)), surface(u.ux, u.uy));
1962 #else
1963                     Your("%s\82Í%s\82É\82Í\82Ü\82Á\82Ä\82¢\82é\81I",
1964                          body_part(FOOT), surface(u.ux, u.uy));
1965 #endif
1966             } else { /*TT_BURIEDBALL*/
1967                 if (noisy)
1968 #if 0 /*JP*/
1969                     Your("%s is attached to the buried ball!",
1970                          body_part(LEG));
1971 #else
1972                     Your("%s\82Í\96\84\82Ü\82Á\82Ä\82¢\82é\8b\85\82É\82Â\82È\82ª\82Á\82Ä\82¢\82é\81I",
1973                          body_part(LEG));
1974 #endif
1975             }
1976             err++;
1977         } else
1978             *mask = W_ARMF;
1979     } else if (is_gloves(otmp)) {
1980         if (uarmg) {
1981             if (noisy)
1982 #if 0 /*JP*/
1983                 already_wearing(c_gloves);
1984 #else
1985                 already_wearing(c_gloves, uarmg);
1986 #endif
1987             err++;
1988         } else if (welded(uwep)) {
1989             if (noisy)
1990 /*JP
1991                 You("cannot wear gloves over your %s.",
1992 */
1993                 You("%s\82Ì\8fã\82©\82ç\8f¬\8eè\82ð\91\95\94õ\82Å\82«\82È\82¢\81D",
1994                     is_sword(uwep) ? c_sword : c_weapon);
1995             err++;
1996         } else
1997             *mask = W_ARMG;
1998     } else if (is_shirt(otmp)) {
1999         if (uarm || uarmc || uarmu) {
2000             if (uarmu) {
2001                 if (noisy)
2002 #if 0 /*JP*/
2003                     already_wearing(an(c_shirt));
2004 #else
2005                     already_wearing(c_shirt, uarmu);
2006 #endif
2007             } else {
2008                 if (noisy)
2009 /*JP
2010                     You_cant("wear that over your %s.",
2011 */
2012                     You("%s\82Ì\8fã\82©\82ç\92\85\82é\82±\82Æ\82Í\82Å\82«\82È\82¢\81D",
2013                              (uarm && !uarmc) ? c_armor
2014                                               : cloak_simple_name(uarmc));
2015             }
2016             err++;
2017         } else
2018             *mask = W_ARMU;
2019     } else if (is_cloak(otmp)) {
2020         if (uarmc) {
2021             if (noisy)
2022 /*JP
2023                 already_wearing(an(cloak_simple_name(uarmc)));
2024 */
2025                 already_wearing(cloak_simple_name(uarmc), otmp);
2026             err++;
2027         } else
2028             *mask = W_ARMC;
2029     } else if (is_suit(otmp)) {
2030         if (uarmc) {
2031             if (noisy)
2032 /*JP
2033                 You("cannot wear armor over a %s.", cloak_simple_name(uarmc));
2034 */
2035                 You("%s\82Ì\8fã\82©\82ç\92\85\82é\82±\82Æ\82Í\82Å\82«\82È\82¢\81D", cloak_simple_name(uarmc));
2036             err++;
2037         } else if (uarm) {
2038             if (noisy)
2039 /*JP
2040                 already_wearing("some armor");
2041 */
2042                 already_wearing("\8aZ", uarm);
2043             err++;
2044         } else
2045             *mask = W_ARM;
2046     } else {
2047         /* getobj can't do this after setting its allow_all flag; that
2048            happens if you have armor for slots that are covered up or
2049            extra armor for slots that are filled */
2050         if (noisy)
2051 /*JP
2052             silly_thing("wear", otmp);
2053 */
2054             silly_thing("\90g\82É\82Â\82¯\82é", otmp);
2055         err++;
2056     }
2057     /* Unnecessary since now only weapons and special items like pick-axes get
2058      * welded to your hand, not armor
2059         if (welded(otmp)) {
2060             if (!err++) {
2061                 if (noisy) weldmsg(otmp);
2062             }
2063         }
2064      */
2065     return !err;
2066 }
2067
2068 STATIC_OVL int
2069 accessory_or_armor_on(obj)
2070 struct obj *obj;
2071 {
2072     long mask = 0L;
2073     boolean armor, ring, eyewear;
2074
2075     if (obj->owornmask & (W_ACCESSORY | W_ARMOR)) {
2076 #if 0 /*JP*/
2077         already_wearing(c_that_);
2078 #else
2079         already_wearing(c_that_, obj);
2080 #endif
2081         return 0;
2082     }
2083     armor = (obj->oclass == ARMOR_CLASS);
2084     ring = (obj->oclass == RING_CLASS || obj->otyp == MEAT_RING);
2085     eyewear = (obj->otyp == BLINDFOLD || obj->otyp == TOWEL
2086                || obj->otyp == LENSES);
2087     /* checks which are performed prior to actually touching the item */
2088     if (armor) {
2089         if (!canwearobj(obj, &mask, TRUE))
2090             return 0;
2091
2092         if (obj->otyp == HELM_OF_OPPOSITE_ALIGNMENT
2093             && qstart_level.dnum == u.uz.dnum) { /* in quest */
2094             if (u.ualignbase[A_CURRENT] == u.ualignbase[A_ORIGINAL])
2095 /*JP
2096                 You("narrowly avoid losing all chance at your goal.");
2097 */
2098                 You("\96Ú\93I\82ð\92B\90¬\82·\82é\89Â\94\\90«\82ð\8e¸\82¤\82±\82Æ\82ð\82È\82ñ\82Æ\82©\89ñ\94ð\82µ\82½\81D");
2099             else /* converted */
2100 /*JP
2101                 You("are suddenly overcome with shame and change your mind.");
2102 */
2103                 You("\93Ë\91R\92p\82¸\82©\82µ\82­\82È\82Á\82Ä\8dl\82¦\82ð\95Ï\82¦\82½\81D");
2104             u.ublessed = 0; /* lose your god's protection */
2105             makeknown(obj->otyp);
2106             context.botl = 1; /*for AC after zeroing u.ublessed */
2107             return 1;
2108         }
2109     } else {
2110         /* accessory */
2111         if (ring) {
2112             char answer, qbuf[QBUFSZ];
2113             int res = 0;
2114
2115             if (nolimbs(youmonst.data)) {
2116 /*JP
2117                 You("cannot make the ring stick to your body.");
2118 */
2119                 You("\8ew\97Ö\82ð\82Í\82ß\82ç\82ê\82È\82¢\91Ì\82¾\81D");
2120                 return 0;
2121             }
2122             if (uleft && uright) {
2123 #if 0 /*JP*/
2124                 There("are no more %s%s to fill.",
2125                       humanoid(youmonst.data) ? "ring-" : "",
2126                       makeplural(body_part(FINGER)));
2127 #else
2128                 pline("\82Í\82ß\82é\82±\82Æ\82Ì\82Å\82«\82é%s%s\82ª\82È\82¢\81D",
2129                       humanoid(youmonst.data) ? "\96ò" : "",
2130                       body_part(FINGER));
2131 #endif
2132                 return 0;
2133             }
2134             if (uleft) {
2135                 mask = RIGHT_RING;
2136             } else if (uright) {
2137                 mask = LEFT_RING;
2138             } else {
2139                 do {
2140 #if 0 /*JP*/
2141                     Sprintf(qbuf, "Which %s%s, Right or Left?",
2142                             humanoid(youmonst.data) ? "ring-" : "",
2143                             body_part(FINGER));
2144 #else
2145                     Sprintf(qbuf, "\82Ç\82¿\82ç\82Ì%s%s\81C\89E(r)\82»\82ê\82Æ\82à\8d¶(l)\81H",
2146                             humanoid(youmonst.data) ? "\96ò" : "",
2147                             body_part(FINGER));
2148 #endif
2149                     answer = yn_function(qbuf, "rl", '\0');
2150                     switch (answer) {
2151                     case '\0':
2152                         return 0;
2153                     case 'l':
2154                     case 'L':
2155                         mask = LEFT_RING;
2156                         break;
2157                     case 'r':
2158                     case 'R':
2159                         mask = RIGHT_RING;
2160                         break;
2161                     }
2162                 } while (!mask);
2163             }
2164             if (uarmg && uarmg->cursed) {
2165                 res = !uarmg->bknown;
2166                 uarmg->bknown = 1;
2167 /*JP
2168                 You("cannot remove your gloves to put on the ring.");
2169 */
2170                 You("\8ew\97Ö\82ð\82Í\82ß\82æ\82¤\82Æ\82µ\82½\82ª\8f¬\8eè\82ª\92E\82°\82È\82¢\81D");
2171                 return res; /* uses move iff we learned gloves are cursed */
2172             }
2173             if (uwep) {
2174                 res = !uwep->bknown; /* check this before calling welded() */
2175                 if ((mask == RIGHT_RING || bimanual(uwep)) && welded(uwep)) {
2176                     const char *hand = body_part(HAND);
2177
2178                     /* welded will set bknown */
2179                     if (bimanual(uwep))
2180                         hand = makeplural(hand);
2181 /*JP
2182                     You("cannot free your weapon %s to put on the ring.",
2183 */
2184                     You("\8ew\97Ö\82ð\82Í\82ß\82æ\82¤\82Æ\82µ\82½\82ª\97\98%s\82Ì\8e©\97R\82ª\82«\82©\82È\82¢\81D",
2185                         hand);
2186                     return res; /* uses move iff we learned weapon is cursed */
2187                 }
2188             }
2189         } else if (obj->oclass == AMULET_CLASS) {
2190             if (uamul) {
2191 #if 0 /*JP*/
2192                 already_wearing("an amulet");
2193 #else
2194                 already_wearing("\96\82\8f\9c\82¯", uamul);
2195 #endif
2196                 return 0;
2197             }
2198         } else if (eyewear) {
2199             if (ublindf) {
2200                 if (ublindf->otyp == TOWEL)
2201 #if 0 /*JP:T*/
2202                     Your("%s is already covered by a towel.",
2203                          body_part(FACE));
2204 #else
2205                     You("\8aù\82É\83^\83I\83\8b\82ð\90g\82É\82Â\82¯\82Ä\82¢\82é\81D");
2206 #endif
2207                 else if (ublindf->otyp == BLINDFOLD) {
2208                     if (obj->otyp == LENSES)
2209 /*JP
2210                         already_wearing2("lenses", "a blindfold");
2211 */
2212                         already_wearing2("\83\8c\83\93\83Y", "\96Ú\89B\82µ");
2213                     else
2214 #if 0 /*JP*/
2215                         already_wearing("a blindfold");
2216 #else
2217                         already_wearing("\96Ú\89B\82µ", ublindf);
2218 #endif
2219                 } else if (ublindf->otyp == LENSES) {
2220                     if (obj->otyp == BLINDFOLD)
2221 /*JP
2222                         already_wearing2("a blindfold", "some lenses");
2223 */
2224                         already_wearing2("\96Ú\89B\82µ", "\83\8c\83\93\83Y");
2225                     else
2226 #if 0 /*JP*/
2227                         already_wearing("some lenses");
2228 #else
2229                         already_wearing("\83\8c\83\93\83Y", ublindf);
2230 #endif
2231                 } else {
2232 #if 0 /*JP*/
2233                     already_wearing(something); /* ??? */
2234 #else
2235                     already_wearing("\89½\82©", ublindf); /* ??? */
2236 #endif
2237                 }
2238                 return 0;
2239             }
2240         } else {
2241             /* neither armor nor accessory */
2242 /*JP
2243             You_cant("wear that!");
2244 */
2245             You_cant("\82»\82ê\82ð\90g\82É\82Â\82¯\82ç\82ê\82È\82¢\81I");
2246             return 0;
2247         }
2248     }
2249
2250     if (!retouch_object(&obj, FALSE))
2251         return 1; /* costs a turn even though it didn't get worn */
2252
2253     if (armor) {
2254         int delay;
2255
2256         obj->known = 1; /* since AC is shown on the status line */
2257         /* if the armor is wielded, release it for wearing */
2258         if (obj->owornmask & W_WEAPON)
2259             remove_worn_item(obj, FALSE);
2260         setworn(obj, mask);
2261         delay = -objects[obj->otyp].oc_delay;
2262         if (delay) {
2263             nomul(delay);
2264             multi_reason = "dressing up";
2265             if (is_boots(obj))
2266                 afternmv = Boots_on;
2267             if (is_helmet(obj))
2268                 afternmv = Helmet_on;
2269             if (is_gloves(obj))
2270                 afternmv = Gloves_on;
2271             if (obj == uarm)
2272                 afternmv = Armor_on;
2273 /*JP
2274             nomovemsg = "You finish your dressing maneuver.";
2275 */
2276             nomovemsg = "\91\95\94õ\82µ\8fI\82¦\82½\81D";
2277         } else {
2278             if (is_cloak(obj))
2279                 (void) Cloak_on();
2280             if (is_shield(obj))
2281                 (void) Shield_on();
2282             if (is_shirt(obj))
2283                 (void) Shirt_on();
2284             on_msg(obj);
2285         }
2286         context.takeoff.mask = context.takeoff.what = 0L;
2287     } else { /* not armor */
2288         boolean give_feedback = FALSE;
2289
2290         /* [releasing wielded accessory handled in Xxx_on()] */
2291         if (ring) {
2292             setworn(obj, mask);
2293             Ring_on(obj);
2294             give_feedback = TRUE;
2295         } else if (obj->oclass == AMULET_CLASS) {
2296             setworn(obj, W_AMUL);
2297             Amulet_on();
2298             /* no feedback here if amulet of change got used up */
2299             give_feedback = (uamul != 0);
2300         } else if (eyewear) {
2301             /* setworn() handled by Blindf_on() */
2302             Blindf_on(obj);
2303             /* message handled by Blindf_on(); leave give_feedback False */
2304         }
2305         /* feedback for ring or for amulet other than 'change' */
2306         if (give_feedback && is_worn(obj))
2307             prinv((char *) 0, obj, 0L);
2308     }
2309     return 1;
2310 }
2311
2312 /* the 'W' command */
2313 int
2314 dowear()
2315 {
2316     struct obj *otmp;
2317
2318     /* cantweararm() checks for suits of armor, not what we want here;
2319        verysmall() or nohands() checks for shields, gloves, etc... */
2320     if ((verysmall(youmonst.data) || nohands(youmonst.data))) {
2321 /*JP
2322         pline("Don't even bother.");
2323 */
2324         pline("\82»\82ñ\82È\82Â\82Ü\82ç\82È\82¢\82±\82Æ\82É\82±\82¾\82í\82é\82È\81D");
2325         return 0;
2326     }
2327     if (uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf
2328         && uleft && uright && uamul && ublindf) {
2329         /* 'W' message doesn't mention accessories */
2330 /*JP
2331         You("are already wearing a full complement of armor.");
2332 */
2333         You("\82·\82Å\82É\8a®\91S\91\95\94õ\82µ\82Ä\82¢\82é\81D");
2334         return 0;
2335     }
2336     otmp = getobj(clothes, "wear");
2337     return otmp ? accessory_or_armor_on(otmp) : 0;
2338 }
2339
2340 /* the 'P' command */
2341 int
2342 doputon()
2343 {
2344     struct obj *otmp;
2345
2346     if (uleft && uright && uamul && ublindf
2347         && uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf) {
2348         /* 'P' message doesn't mention armor */
2349 #if 0 /*JP*/
2350         Your("%s%s are full, and you're already wearing an amulet and %s.",
2351              humanoid(youmonst.data) ? "ring-" : "",
2352              makeplural(body_part(FINGER)),
2353              (ublindf->otyp == LENSES) ? "some lenses" : "a blindfold");
2354 #else
2355         Your("%s%s\82Í\82Ó\82³\82ª\82Á\82Ä\82é\82µ\81C\82·\82Å\82É\96\82\8f\9c\82¯\82Æ%s\82à\90g\82É\82Â\82¯\82Ä\82¢\82é\81D",
2356              humanoid(youmonst.data) ? "\96ò" : "",
2357              body_part(FINGER),
2358              ublindf->otyp==LENSES ? "\83\8c\83\93\83Y" : "\96Ú\89B\82µ");
2359 #endif
2360         return 0;
2361     }
2362     otmp = getobj(accessories, "put on");
2363     return otmp ? accessory_or_armor_on(otmp) : 0;
2364 }
2365
2366 /* calculate current armor class */
2367 void
2368 find_ac()
2369 {
2370     int uac = mons[u.umonnum].ac; /* base armor class for current form */
2371
2372     /* armor class from worn gear */
2373     if (uarm)
2374         uac -= ARM_BONUS(uarm);
2375     if (uarmc)
2376         uac -= ARM_BONUS(uarmc);
2377     if (uarmh)
2378         uac -= ARM_BONUS(uarmh);
2379     if (uarmf)
2380         uac -= ARM_BONUS(uarmf);
2381     if (uarms)
2382         uac -= ARM_BONUS(uarms);
2383     if (uarmg)
2384         uac -= ARM_BONUS(uarmg);
2385     if (uarmu)
2386         uac -= ARM_BONUS(uarmu);
2387     if (uleft && uleft->otyp == RIN_PROTECTION)
2388         uac -= uleft->spe;
2389     if (uright && uright->otyp == RIN_PROTECTION)
2390         uac -= uright->spe;
2391
2392     /* armor class from other sources */
2393     if (HProtection & INTRINSIC)
2394         uac -= u.ublessed;
2395     uac -= u.uspellprot;
2396
2397     /* [The magic binary numbers 127 and -128 should be replaced with the
2398      * mystic decimal numbers 99 and -99 which require no explanation to
2399      * the uninitiated and would cap the width of a status line value at
2400      * one less character.]
2401      */
2402     if (uac < -128)
2403         uac = -128; /* u.uac is an schar */
2404     else if (uac > 127)
2405         uac = 127; /* for completeness */
2406
2407     if (uac != u.uac) {
2408         u.uac = uac;
2409         context.botl = 1;
2410     }
2411 }
2412
2413 void
2414 glibr()
2415 {
2416     register struct obj *otmp;
2417     int xfl = 0;
2418     boolean leftfall, rightfall, wastwoweap = FALSE;
2419     const char *otherwep = 0, *thiswep, *which, *hand;
2420
2421     leftfall = (uleft && !uleft->cursed
2422                 && (!uwep || !welded(uwep) || !bimanual(uwep)));
2423     rightfall = (uright && !uright->cursed && (!welded(uwep)));
2424     if (!uarmg && (leftfall || rightfall) && !nolimbs(youmonst.data)) {
2425         /* changed so cursed rings don't fall off, GAN 10/30/86 */
2426 #if 0 /*JP*/
2427         Your("%s off your %s.",
2428              (leftfall && rightfall) ? "rings slip" : "ring slips",
2429              (leftfall && rightfall) ? makeplural(body_part(FINGER))
2430                                      : body_part(FINGER));
2431 #else
2432         Your("\8ew\97Ö\82Í%s\82©\82ç\8a\8a\82è\97\8e\82¿\82½\81D", body_part(FINGER));
2433 #endif
2434         xfl++;
2435         if (leftfall) {
2436             otmp = uleft;
2437             Ring_off(uleft);
2438             dropx(otmp);
2439         }
2440         if (rightfall) {
2441             otmp = uright;
2442             Ring_off(uright);
2443             dropx(otmp);
2444         }
2445     }
2446
2447     otmp = uswapwep;
2448     if (u.twoweap && otmp) {
2449         /* secondary weapon doesn't need nearly as much handling as
2450            primary; when in two-weapon mode, we know it's one-handed
2451            with something else in the other hand and also that it's
2452            a weapon or weptool rather than something unusual, plus
2453            we don't need to compare its type with the primary */
2454         otherwep = is_sword(otmp) ? c_sword : weapon_descr(otmp);
2455         if (otmp->quan > 1L)
2456             otherwep = makeplural(otherwep);
2457         hand = body_part(HAND);
2458         which = "left ";
2459 #if 0 /*JP*/
2460         Your("%s %s%s from your %s%s.", otherwep, xfl ? "also " : "",
2461              otense(otmp, "slip"), which, hand);
2462 #else
2463         You("%s%s%s\82©\82ç\8a\8a\82è\97\8e\82Æ\82µ\82½\81D", otherwep, xfl ? "\82à\82Ü\82½" : "\82ð",
2464             body_part(HAND));
2465 #endif
2466         xfl++;
2467         wastwoweap = TRUE;
2468         setuswapwep((struct obj *) 0); /* clears u.twoweap */
2469         if (canletgo(otmp, ""))
2470             dropx(otmp);
2471     }
2472     otmp = uwep;
2473     if (otmp && !welded(otmp)) {
2474         long savequan = otmp->quan;
2475
2476         /* nice wording if both weapons are the same type */
2477         thiswep = is_sword(otmp) ? c_sword : weapon_descr(otmp);
2478         if (otherwep && strcmp(thiswep, makesingular(otherwep)))
2479             otherwep = 0;
2480         if (otmp->quan > 1L) {
2481             /* most class names for unconventional wielded items
2482                are ok, but if wielding multiple apples or rations
2483                we don't want "your foods slip", so force non-corpse
2484                food to be singular; skipping makeplural() isn't
2485                enough--we need to fool otense() too */
2486             if (!strcmp(thiswep, "food"))
2487                 otmp->quan = 1L;
2488             else
2489                 thiswep = makeplural(thiswep);
2490         }
2491         hand = body_part(HAND);
2492         which = "";
2493         if (bimanual(otmp))
2494             hand = makeplural(hand);
2495         else if (wastwoweap)
2496             which = "right "; /* preceding msg was about left */
2497 #if 0 /*JP*/
2498         pline("%s %s%s %s%s from your %s%s.",
2499               !strncmp(thiswep, "corpse", 6) ? "The" : "Your",
2500               otherwep ? "other " : "", thiswep, xfl ? "also " : "",
2501               otense(otmp, "slip"), which, hand);
2502 #else
2503         You("%s%s%s%s\82©\82ç\8a\8a\82è\97\8e\82Æ\82µ\82½\81D",
2504             otherwep ? "\82à\82¤\82Ð\82Æ\82Â\82Ì" : "", thiswep,
2505             xfl ? "\82à\82Ü\82½" : "\82ð",
2506             body_part(HAND));
2507 #endif
2508         /* xfl++; */
2509         otmp->quan = savequan;
2510         setuwep((struct obj *) 0);
2511         if (canletgo(otmp, ""))
2512             dropx(otmp);
2513     }
2514 }
2515
2516 struct obj *
2517 some_armor(victim)
2518 struct monst *victim;
2519 {
2520     register struct obj *otmph, *otmp;
2521
2522     otmph = (victim == &youmonst) ? uarmc : which_armor(victim, W_ARMC);
2523     if (!otmph)
2524         otmph = (victim == &youmonst) ? uarm : which_armor(victim, W_ARM);
2525     if (!otmph)
2526         otmph = (victim == &youmonst) ? uarmu : which_armor(victim, W_ARMU);
2527
2528     otmp = (victim == &youmonst) ? uarmh : which_armor(victim, W_ARMH);
2529     if (otmp && (!otmph || !rn2(4)))
2530         otmph = otmp;
2531     otmp = (victim == &youmonst) ? uarmg : which_armor(victim, W_ARMG);
2532     if (otmp && (!otmph || !rn2(4)))
2533         otmph = otmp;
2534     otmp = (victim == &youmonst) ? uarmf : which_armor(victim, W_ARMF);
2535     if (otmp && (!otmph || !rn2(4)))
2536         otmph = otmp;
2537     otmp = (victim == &youmonst) ? uarms : which_armor(victim, W_ARMS);
2538     if (otmp && (!otmph || !rn2(4)))
2539         otmph = otmp;
2540     return otmph;
2541 }
2542
2543 /* used for praying to check and fix levitation trouble */
2544 struct obj *
2545 stuck_ring(ring, otyp)
2546 struct obj *ring;
2547 int otyp;
2548 {
2549     if (ring != uleft && ring != uright) {
2550         impossible("stuck_ring: neither left nor right?");
2551         return (struct obj *) 0;
2552     }
2553
2554     if (ring && ring->otyp == otyp) {
2555         /* reasons ring can't be removed match those checked by select_off();
2556            limbless case has extra checks because ordinarily it's temporary */
2557         if (nolimbs(youmonst.data) && uamul
2558             && uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed)
2559             return uamul;
2560         if (welded(uwep) && (ring == uright || bimanual(uwep)))
2561             return uwep;
2562         if (uarmg && uarmg->cursed)
2563             return uarmg;
2564         if (ring->cursed)
2565             return ring;
2566     }
2567     /* either no ring or not right type or nothing prevents its removal */
2568     return (struct obj *) 0;
2569 }
2570
2571 /* also for praying; find worn item that confers "Unchanging" attribute */
2572 struct obj *
2573 unchanger()
2574 {
2575     if (uamul && uamul->otyp == AMULET_OF_UNCHANGING)
2576         return uamul;
2577     return 0;
2578 }
2579
2580 STATIC_PTR
2581 int
2582 select_off(otmp)
2583 register struct obj *otmp;
2584 {
2585     struct obj *why;
2586     char buf[BUFSZ];
2587
2588     if (!otmp)
2589         return 0;
2590     *buf = '\0'; /* lint suppression */
2591
2592     /* special ring checks */
2593     if (otmp == uright || otmp == uleft) {
2594         if (nolimbs(youmonst.data)) {
2595 #if 0 /*JP*/
2596             pline_The("ring is stuck.");
2597 #else
2598             pline("\8ew\97Ö\82Í\91Ì\82É\96\84\82Ü\82Á\82Ä\82µ\82Ü\82Á\82Ä\82¢\82é\81D");
2599 #endif
2600             return 0;
2601         }
2602         why = 0; /* the item which prevents ring removal */
2603         if (welded(uwep) && (otmp == uright || bimanual(uwep))) {
2604 /*JP
2605             Sprintf(buf, "free a weapon %s", body_part(HAND));
2606 */
2607             Sprintf(buf, "\97\98\98r\82Ì\8e©\97R\82ª\82«\82©\82È\82¢");
2608             why = uwep;
2609         } else if (uarmg && uarmg->cursed) {
2610 /*JP
2611             Sprintf(buf, "take off your %s", c_gloves);
2612 */
2613             Sprintf(buf, "%s\82ª\92E\82°\82È\82¢", c_gloves);
2614             why = uarmg;
2615         }
2616         if (why) {
2617 /*JP
2618             You("cannot %s to remove the ring.", buf);
2619 */
2620             You("\8ew\97Ö\82ð\82Í\82¸\82»\82¤\82Æ\82µ\82½\82ª%s\81D", buf);
2621             why->bknown = TRUE;
2622             return 0;
2623         }
2624     }
2625     /* special glove checks */
2626     if (otmp == uarmg) {
2627         if (welded(uwep)) {
2628 #if 0 /*JP*/
2629             You("are unable to take off your %s while wielding that %s.",
2630                 c_gloves, is_sword(uwep) ? c_sword : c_weapon);
2631 #else
2632             You("%s\82ð\8e\9d\82Á\82½\82Ü\82Ü%s\82ð\82Í\82¸\82·\82±\82Æ\82Í\82Å\82«\82È\82¢\81D",
2633                 is_sword(uwep) ? c_sword : c_weapon, c_gloves);
2634 #endif
2635             uwep->bknown = TRUE;
2636             return 0;
2637         } else if (Glib) {
2638 #if 0 /*JP*/
2639             You_cant("take off the slippery %s with your slippery %s.",
2640                      c_gloves, makeplural(body_part(FINGER)));
2641 #else
2642             You_cant("\8a\8a\82è\82â\82·\82¢%s\82ð\8a\8a\82è\82â\82·\82¢%s\82Å\82Í\82¸\82¹\82È\82¢\81D",
2643                      c_gloves, body_part(FINGER));
2644 #endif
2645             return 0;
2646         }
2647     }
2648     /* special boot checks */
2649     if (otmp == uarmf) {
2650         if (u.utrap && u.utraptype == TT_BEARTRAP) {
2651 /*JP
2652             pline_The("bear trap prevents you from pulling your %s out.",
2653 */
2654             pline("%s\82ª\8cF\82Ìã©\82É\82Â\82©\82Ü\82Á\82Ä\82¢\82é\82Ì\82Å\92E\82®\82±\82Æ\82ª\82Å\82«\82È\82¢\81D",
2655                       body_part(FOOT));
2656             return 0;
2657         } else if (u.utrap && u.utraptype == TT_INFLOOR) {
2658 /*JP
2659             You("are stuck in the %s, and cannot pull your %s out.",
2660 */
2661             You("%s\82ª%s\82É\82Í\82Ü\82Á\82Ä\82¢\82é\82Ì\82Å\92E\82®\82±\82Æ\82ª\82Å\82«\82È\82¢\81D",
2662                 surface(u.ux, u.uy), makeplural(body_part(FOOT)));
2663             return 0;
2664         }
2665     }
2666     /* special suit and shirt checks */
2667     if (otmp == uarm || otmp == uarmu) {
2668         why = 0; /* the item which prevents disrobing */
2669         if (uarmc && uarmc->cursed) {
2670 /*JP
2671             Sprintf(buf, "remove your %s", cloak_simple_name(uarmc));
2672 */
2673             Sprintf(buf, "%s\82ª\92E\82°\82È\82¢", cloak_simple_name(uarmc));
2674             why = uarmc;
2675         } else if (otmp == uarmu && uarm && uarm->cursed) {
2676 /*JP
2677             Sprintf(buf, "remove your %s", c_suit);
2678 */
2679             Sprintf(buf, "%s\82ª\92E\82°\82È\82¢", c_suit);
2680             why = uarm;
2681         } else if (welded(uwep) && bimanual(uwep)) {
2682 #if 0 /*JP*/
2683             Sprintf(buf, "release your %s",
2684                     is_sword(uwep) ? c_sword : (uwep->otyp == BATTLE_AXE)
2685                                                    ? c_axe
2686                                                    : c_weapon);
2687 #else
2688             Sprintf(buf, "%s\82ª\8eè\95ú\82¹\82È\82¢",
2689                     is_sword(uwep) ? c_sword : (uwep->otyp == BATTLE_AXE)
2690                                                    ? c_axe
2691                                                    : c_weapon);
2692 #endif
2693             why = uwep;
2694         }
2695         if (why) {
2696 /*JP
2697             You("cannot %s to take off %s.", buf, the(xname(otmp)));
2698 */
2699             You("%s\82ð\82Í\82¸\82»\82¤\82Æ\82µ\82½\82ª%s\81D", xname(otmp), buf);
2700             why->bknown = TRUE;
2701             return 0;
2702         }
2703     }
2704     /* basic curse check */
2705     if (otmp == uquiver || (otmp == uswapwep && !u.twoweap)) {
2706         ; /* some items can be removed even when cursed */
2707     } else {
2708         /* otherwise, this is fundamental */
2709         if (cursed(otmp))
2710             return 0;
2711     }
2712
2713     if (otmp == uarm)
2714         context.takeoff.mask |= WORN_ARMOR;
2715     else if (otmp == uarmc)
2716         context.takeoff.mask |= WORN_CLOAK;
2717     else if (otmp == uarmf)
2718         context.takeoff.mask |= WORN_BOOTS;
2719     else if (otmp == uarmg)
2720         context.takeoff.mask |= WORN_GLOVES;
2721     else if (otmp == uarmh)
2722         context.takeoff.mask |= WORN_HELMET;
2723     else if (otmp == uarms)
2724         context.takeoff.mask |= WORN_SHIELD;
2725     else if (otmp == uarmu)
2726         context.takeoff.mask |= WORN_SHIRT;
2727     else if (otmp == uleft)
2728         context.takeoff.mask |= LEFT_RING;
2729     else if (otmp == uright)
2730         context.takeoff.mask |= RIGHT_RING;
2731     else if (otmp == uamul)
2732         context.takeoff.mask |= WORN_AMUL;
2733     else if (otmp == ublindf)
2734         context.takeoff.mask |= WORN_BLINDF;
2735     else if (otmp == uwep)
2736         context.takeoff.mask |= W_WEP;
2737     else if (otmp == uswapwep)
2738         context.takeoff.mask |= W_SWAPWEP;
2739     else if (otmp == uquiver)
2740         context.takeoff.mask |= W_QUIVER;
2741
2742     else
2743         impossible("select_off: %s???", doname(otmp));
2744
2745     return 0;
2746 }
2747
2748 STATIC_OVL struct obj *
2749 do_takeoff()
2750 {
2751     struct obj *otmp = (struct obj *) 0;
2752     struct takeoff_info *doff = &context.takeoff;
2753
2754     if (doff->what == W_WEP) {
2755         if (!cursed(uwep)) {
2756             setuwep((struct obj *) 0);
2757 /*JP
2758             You("are empty %s.", body_part(HANDED));
2759 */
2760             You("\89½\82à%s\82É\82µ\82Ä\82¢\82È\82¢\81D", body_part(HAND));
2761             u.twoweap = FALSE;
2762         }
2763     } else if (doff->what == W_SWAPWEP) {
2764         setuswapwep((struct obj *) 0);
2765 /*JP
2766         You("no longer have a second weapon readied.");
2767 */
2768         You("\97\\94õ\82Ì\95\90\8aí\82ð\82¨\82³\82ß\82½\81D");
2769         u.twoweap = FALSE;
2770     } else if (doff->what == W_QUIVER) {
2771         setuqwep((struct obj *) 0);
2772 /*JP
2773         You("no longer have ammunition readied.");
2774 */
2775         You("\8f\80\94õ\82µ\82½\96î\92e\82ð\82¨\82³\82ß\82½\81D");
2776     } else if (doff->what == WORN_ARMOR) {
2777         otmp = uarm;
2778         if (!cursed(otmp))
2779             (void) Armor_off();
2780     } else if (doff->what == WORN_CLOAK) {
2781         otmp = uarmc;
2782         if (!cursed(otmp))
2783             (void) Cloak_off();
2784     } else if (doff->what == WORN_BOOTS) {
2785         otmp = uarmf;
2786         if (!cursed(otmp))
2787             (void) Boots_off();
2788     } else if (doff->what == WORN_GLOVES) {
2789         otmp = uarmg;
2790         if (!cursed(otmp))
2791             (void) Gloves_off();
2792     } else if (doff->what == WORN_HELMET) {
2793         otmp = uarmh;
2794         if (!cursed(otmp))
2795             (void) Helmet_off();
2796     } else if (doff->what == WORN_SHIELD) {
2797         otmp = uarms;
2798         if (!cursed(otmp))
2799             (void) Shield_off();
2800     } else if (doff->what == WORN_SHIRT) {
2801         otmp = uarmu;
2802         if (!cursed(otmp))
2803             (void) Shirt_off();
2804     } else if (doff->what == WORN_AMUL) {
2805         otmp = uamul;
2806         if (!cursed(otmp))
2807             Amulet_off();
2808     } else if (doff->what == LEFT_RING) {
2809         otmp = uleft;
2810         if (!cursed(otmp))
2811             Ring_off(uleft);
2812     } else if (doff->what == RIGHT_RING) {
2813         otmp = uright;
2814         if (!cursed(otmp))
2815             Ring_off(uright);
2816     } else if (doff->what == WORN_BLINDF) {
2817         if (!cursed(ublindf))
2818             Blindf_off(ublindf);
2819     } else {
2820         impossible("do_takeoff: taking off %lx", doff->what);
2821     }
2822
2823     return otmp;
2824 }
2825
2826 /* occupation callback for 'A' */
2827 STATIC_PTR
2828 int
2829 take_off(VOID_ARGS)
2830 {
2831     register int i;
2832     register struct obj *otmp;
2833     struct takeoff_info *doff = &context.takeoff;
2834
2835     if (doff->what) {
2836         if (doff->delay > 0) {
2837             doff->delay--;
2838             return 1; /* still busy */
2839         } else {
2840             if ((otmp = do_takeoff()))
2841                 off_msg(otmp);
2842         }
2843         doff->mask &= ~doff->what;
2844         doff->what = 0L;
2845     }
2846
2847     for (i = 0; takeoff_order[i]; i++)
2848         if (doff->mask & takeoff_order[i]) {
2849             doff->what = takeoff_order[i];
2850             break;
2851         }
2852
2853     otmp = (struct obj *) 0;
2854     doff->delay = 0;
2855
2856     if (doff->what == 0L) {
2857 /*JP
2858         You("finish %s.", doff->disrobing);
2859 */
2860         You("\91\95\94õ\82ð\89ð\82«\82¨\82¦\82½\81D");
2861         return 0;
2862     } else if (doff->what == W_WEP) {
2863         doff->delay = 1;
2864     } else if (doff->what == W_SWAPWEP) {
2865         doff->delay = 1;
2866     } else if (doff->what == W_QUIVER) {
2867         doff->delay = 1;
2868     } else if (doff->what == WORN_ARMOR) {
2869         otmp = uarm;
2870         /* If a cloak is being worn, add the time to take it off and put
2871          * it back on again.  Kludge alert! since that time is 0 for all
2872          * known cloaks, add 1 so that it actually matters...
2873          */
2874         if (uarmc)
2875             doff->delay += 2 * objects[uarmc->otyp].oc_delay + 1;
2876     } else if (doff->what == WORN_CLOAK) {
2877         otmp = uarmc;
2878     } else if (doff->what == WORN_BOOTS) {
2879         otmp = uarmf;
2880     } else if (doff->what == WORN_GLOVES) {
2881         otmp = uarmg;
2882     } else if (doff->what == WORN_HELMET) {
2883         otmp = uarmh;
2884     } else if (doff->what == WORN_SHIELD) {
2885         otmp = uarms;
2886     } else if (doff->what == WORN_SHIRT) {
2887         otmp = uarmu;
2888         /* add the time to take off and put back on armor and/or cloak */
2889         if (uarm)
2890             doff->delay += 2 * objects[uarm->otyp].oc_delay;
2891         if (uarmc)
2892             doff->delay += 2 * objects[uarmc->otyp].oc_delay + 1;
2893     } else if (doff->what == WORN_AMUL) {
2894         doff->delay = 1;
2895     } else if (doff->what == LEFT_RING) {
2896         doff->delay = 1;
2897     } else if (doff->what == RIGHT_RING) {
2898         doff->delay = 1;
2899     } else if (doff->what == WORN_BLINDF) {
2900         doff->delay = 2;
2901     } else {
2902         impossible("take_off: taking off %lx", doff->what);
2903         return 0; /* force done */
2904     }
2905
2906     if (otmp)
2907         doff->delay += objects[otmp->otyp].oc_delay;
2908
2909     /* Since setting the occupation now starts the counter next move, that
2910      * would always produce a delay 1 too big per item unless we subtract
2911      * 1 here to account for it.
2912      */
2913     if (doff->delay > 0)
2914         doff->delay--;
2915
2916     set_occupation(take_off, doff->disrobing, 0);
2917     return 1; /* get busy */
2918 }
2919
2920 /* clear saved context to avoid inappropriate resumption of interrupted 'A' */
2921 void
2922 reset_remarm()
2923 {
2924     context.takeoff.what = context.takeoff.mask = 0L;
2925     context.takeoff.disrobing[0] = '\0';
2926 }
2927
2928 /* the 'A' command -- remove multiple worn items */
2929 int
2930 doddoremarm()
2931 {
2932     int result = 0;
2933
2934     if (context.takeoff.what || context.takeoff.mask) {
2935 /*JP
2936         You("continue %s.", context.takeoff.disrobing);
2937 */
2938         You("\91\95\94õ\82ð\89ð\82­\82Ì\82ð\8dÄ\8aJ\82µ\82½\81D");
2939 /*JP
2940         set_occupation(take_off, context.takeoff.disrobing, 0);
2941 */
2942         set_occupation(take_off, "\91\95\94õ\82ð\89ð\82­", 0);
2943         return 0;
2944     } else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf && !uleft
2945                && !uright && !wearing_armor()) {
2946 /*JP
2947         You("are not wearing anything.");
2948 */
2949         You("\89½\82à\91\95\94õ\82µ\82Ä\82¢\82È\82¢\81D");
2950         return 0;
2951     }
2952
2953     add_valid_menu_class(0); /* reset */
2954     if (flags.menu_style != MENU_TRADITIONAL
2955         || (result = ggetobj("take off", select_off, 0, FALSE,
2956                              (unsigned *) 0)) < -1)
2957         result = menu_remarm(result);
2958
2959     if (context.takeoff.mask) {
2960 #if 0 /*JP*//*\93ú\96{\8cê\82Å\82Í\8eg\82í\82È\82¢*/
2961         /* default activity for armor and/or accessories,
2962            possibly combined with weapons */
2963         (void) strncpy(context.takeoff.disrobing, "disrobing", CONTEXTVERBSZ);
2964         /* specific activity when handling weapons only */
2965         if (!(context.takeoff.mask & ~W_WEAPON))
2966             (void) strncpy(context.takeoff.disrobing, "disarming",
2967                            CONTEXTVERBSZ);
2968 #endif
2969         (void) take_off();
2970     }
2971     /* The time to perform the command is already completely accounted for
2972      * in take_off(); if we return 1, that would add an extra turn to each
2973      * disrobe.
2974      */
2975     return 0;
2976 }
2977
2978 STATIC_OVL int
2979 menu_remarm(retry)
2980 int retry;
2981 {
2982     int n, i = 0;
2983     menu_item *pick_list;
2984     boolean all_worn_categories = TRUE;
2985
2986     if (retry) {
2987         all_worn_categories = (retry == -2);
2988     } else if (flags.menu_style == MENU_FULL) {
2989         all_worn_categories = FALSE;
2990 /*JP
2991         n = query_category("What type of things do you want to take off?",
2992 */
2993         n = query_category("\82Ç\82Ì\83^\83C\83v\82Ì\95¨\82Ì\91\95\94õ\82ð\89ð\82«\82Ü\82·\82©\81H",
2994                            invent, WORN_TYPES | ALL_TYPES, &pick_list,
2995                            PICK_ANY);
2996         if (!n)
2997             return 0;
2998         for (i = 0; i < n; i++) {
2999             if (pick_list[i].item.a_int == ALL_TYPES_SELECTED)
3000                 all_worn_categories = TRUE;
3001             else
3002                 add_valid_menu_class(pick_list[i].item.a_int);
3003         }
3004         free((genericptr_t) pick_list);
3005     } else if (flags.menu_style == MENU_COMBINATION) {
3006         all_worn_categories = FALSE;
3007         if (ggetobj("take off", select_off, 0, TRUE, (unsigned *) 0) == -2)
3008             all_worn_categories = TRUE;
3009     }
3010
3011 /*JP
3012     n = query_objlist("What do you want to take off?", invent,
3013 */
3014     n = query_objlist("\82Ç\82Ì\91\95\94õ\82ð\89ð\82«\82Ü\82·\82©\81H", invent,
3015                       SIGNAL_NOMENU | USE_INVLET | INVORDER_SORT, &pick_list,
3016                       PICK_ANY,
3017                       all_worn_categories ? is_worn : is_worn_by_type);
3018     if (n > 0) {
3019         for (i = 0; i < n; i++)
3020             (void) select_off(pick_list[i].item.a_obj);
3021         free((genericptr_t) pick_list);
3022     } else if (n < 0 && flags.menu_style != MENU_COMBINATION) {
3023 /*JP
3024         There("is nothing else you can remove or unwield.");
3025 */
3026         pline("\91\95\94õ\82ð\89ð\82¯\82é\82à\82Ì\82Í\89½\82à\82È\82¢\81D");
3027     }
3028     return 0;
3029 }
3030
3031 /* hit by destroy armor scroll/black dragon breath/monster spell */
3032 int
3033 destroy_arm(atmp)
3034 register struct obj *atmp;
3035 {
3036     register struct obj *otmp;
3037 #define DESTROY_ARM(o)                            \
3038     ((otmp = (o)) != 0 && (!atmp || atmp == otmp) \
3039              && (!obj_resists(otmp, 0, 90))       \
3040          ? (otmp->in_use = TRUE)                  \
3041          : FALSE)
3042
3043     if (DESTROY_ARM(uarmc)) {
3044         if (donning(otmp))
3045             cancel_don();
3046 /*JP
3047         Your("%s crumbles and turns to dust!", cloak_simple_name(uarmc));
3048 */
3049         Your("%s\82Í\95²\81X\82É\82È\82Á\82½\81I", cloak_simple_name(uarmc));
3050         (void) Cloak_off();
3051         useup(otmp);
3052     } else if (DESTROY_ARM(uarm)) {
3053         if (donning(otmp))
3054             cancel_don();
3055 /*JP
3056         Your("armor turns to dust and falls to the %s!", surface(u.ux, u.uy));
3057 */
3058         Your("\8aZ\82Í\90o\82Æ\82È\82è%s\82É\97\8e\82¿\82½\81I", surface(u.ux,u.uy));
3059         (void) Armor_gone();
3060         useup(otmp);
3061     } else if (DESTROY_ARM(uarmu)) {
3062         if (donning(otmp))
3063             cancel_don();
3064 /*JP
3065         Your("shirt crumbles into tiny threads and falls apart!");
3066 */
3067         Your("\83V\83\83\83c\82Í\83Y\83^\83Y\83^\82É\97ô\82¯\81C\8f¬\82³\82È\8e\85\8bû\82Æ\82È\82è\97\8e\82¿\82½\81I");
3068         (void) Shirt_off();
3069         useup(otmp);
3070     } else if (DESTROY_ARM(uarmh)) {
3071         if (donning(otmp))
3072             cancel_don();
3073 /*JP
3074         Your("%s turns to dust and is blown away!", helm_simple_name(uarmh));
3075 */
3076         Your("%s\82Í\90o\82Æ\82È\82è\90\81\82«\82Æ\82ñ\82¾\81I", helm_simple_name(uarmh));
3077         (void) Helmet_off();
3078         useup(otmp);
3079     } else if (DESTROY_ARM(uarmg)) {
3080         if (donning(otmp))
3081             cancel_don();
3082 /*JP
3083         Your("gloves vanish!");
3084 */
3085                 Your("\8f¬\8eè\82Í\8fÁ\82¦\82½\81I");
3086         (void) Gloves_off();
3087         useup(otmp);
3088 /*JP
3089         selftouch("You");
3090 */
3091         selftouch("\82»\82Ì\82Æ\82«\82 \82È\82½\82Í");
3092     } else if (DESTROY_ARM(uarmf)) {
3093         if (donning(otmp))
3094             cancel_don();
3095 /*JP
3096         Your("boots disintegrate!");
3097 */
3098         Your("\8cC\82Í\95²\81X\82É\8dÓ\82¯\82½\81I");
3099         (void) Boots_off();
3100         useup(otmp);
3101     } else if (DESTROY_ARM(uarms)) {
3102         if (donning(otmp))
3103             cancel_don();
3104 /*JP
3105         Your("shield crumbles away!");
3106 */
3107         Your("\8f\82\82Í\8dÓ\82¯\8eU\82Á\82½\81I");
3108         (void) Shield_off();
3109         useup(otmp);
3110     } else {
3111         return 0; /* could not destroy anything */
3112     }
3113
3114 #undef DESTROY_ARM
3115     stop_occupation();
3116     return 1;
3117 }
3118
3119 void
3120 adj_abon(otmp, delta)
3121 register struct obj *otmp;
3122 register schar delta;
3123 {
3124     if (uarmg && uarmg == otmp && otmp->otyp == GAUNTLETS_OF_DEXTERITY) {
3125         if (delta) {
3126             makeknown(uarmg->otyp);
3127             ABON(A_DEX) += (delta);
3128         }
3129         context.botl = 1;
3130     }
3131     if (uarmh && uarmh == otmp && otmp->otyp == HELM_OF_BRILLIANCE) {
3132         if (delta) {
3133             makeknown(uarmh->otyp);
3134             ABON(A_INT) += (delta);
3135             ABON(A_WIS) += (delta);
3136         }
3137         context.botl = 1;
3138     }
3139 }
3140
3141 /* decide whether a worn item is covered up by some other worn item,
3142    used for dipping into liquid and applying grease;
3143    some criteria are different than select_off()'s */
3144 boolean
3145 inaccessible_equipment(obj, verb, only_if_known_cursed)
3146 struct obj *obj;
3147 const char *verb; /* "dip" or "grease", or null to avoid messages */
3148 /*JP:\93ú\96{\8cê\82Å\82Í "\82ð\90Z\82·", "\82É\8e\89\82ð\93h\82é", null \82Ì\82¢\82¸\82ê\82©*/
3149 boolean only_if_known_cursed; /* ignore covering unless known to be cursed */
3150 {
3151 #if 0 /*JP*/
3152     static NEARDATA const char need_to_take_off_outer_armor[] =
3153         "need to take off %s to %s %s.";
3154 #else /*JP:\88ø\90\94\82ª\8c´\95\82Æ\95Ï\82í\82Á\82Ä\82¢\82é\82±\82Æ\82É\92\8d\88Ó*/
3155     static NEARDATA const char need_to_take_off_outer_armor[] =
3156         "%s%s\82É\82Í%s\82ð%s\95K\97v\82ª\82 \82é\81D";
3157 #endif
3158     char buf[BUFSZ];
3159     boolean anycovering = !only_if_known_cursed; /* more comprehensible... */
3160 #define BLOCKSACCESS(x) (anycovering || ((x)->cursed && (x)->bknown))
3161
3162     if (!obj || !obj->owornmask)
3163         return FALSE; /* not inaccessible */
3164
3165     /* check for suit covered by cloak */
3166     if (obj == uarm && uarmc && BLOCKSACCESS(uarmc)) {
3167         if (verb) {
3168             Strcpy(buf, yname(uarmc));
3169 #if 0 /*JP*/
3170             You(need_to_take_off_outer_armor, buf, verb, yname(obj));
3171 #else /*JP:\91Î\8fÛ\82Í\83N\83\8d\81[\83N\82È\82Ì\82Åjoffmsg\82ð\8eg\82í\82¸\8c\88\82ß\8c\82\82¿*/
3172             You(need_to_take_off_outer_armor, xname(obj), verb, buf, "\92E\82®");
3173 #endif
3174         }
3175         return TRUE;
3176     }
3177     /* check for shirt covered by suit and/or cloak */
3178     if (obj == uarmu
3179         && ((uarm && BLOCKSACCESS(uarm)) || (uarmc && BLOCKSACCESS(uarmc)))) {
3180         if (verb) {
3181             char cloaktmp[QBUFSZ], suittmp[QBUFSZ];
3182             /* if sameprefix, use yname and xname to get "your cloak and suit"
3183                or "Manlobbi's cloak and suit"; otherwise, use yname and yname
3184                to get "your cloak and Manlobbi's suit" or vice versa */
3185             boolean sameprefix = (uarm && uarmc
3186                                   && !strcmp(shk_your(cloaktmp, uarmc),
3187                                              shk_your(suittmp, uarm)));
3188
3189             *buf = '\0';
3190             if (uarmc)
3191                 Strcat(buf, yname(uarmc));
3192             if (uarm && uarmc)
3193 /*JP
3194                 Strcat(buf, " and ");
3195 */
3196                 Strcat(buf, "\82Æ");
3197             if (uarm)
3198                 Strcat(buf, sameprefix ? xname(uarm) : yname(uarm));
3199 #if 0 /*JP*/
3200             You(need_to_take_off_outer_armor, buf, verb, yname(obj));
3201 #else /*JP:\91Î\8fÛ\82Í\83N\83\8d\81[\83N\82©\8aZ\82È\82Ì\82Åjoffmsg\82ð\8eg\82í\82¸\8c\88\82ß\8c\82\82¿*/
3202             You(need_to_take_off_outer_armor, xname(obj), verb, buf, "\92E\82®");
3203 #endif
3204         }
3205         return TRUE;
3206     }
3207     /* check for ring covered by gloves */
3208     if ((obj == uleft || obj == uright) && uarmg && BLOCKSACCESS(uarmg)) {
3209         if (verb) {
3210             Strcpy(buf, yname(uarmg));
3211 #if 0 /*JP*/
3212             You(need_to_take_off_outer_armor, buf, verb, yname(obj));
3213 #else /*JP:\91Î\8fÛ\82Í\8f¬\8eè\82È\82Ì\82Åjoffmsg\82ð\8eg\82í\82¸\8c\88\82ß\8c\82\82¿*/
3214             You(need_to_take_off_outer_armor, xname(obj), verb, buf, "\82Í\82¸\82·");
3215 #endif
3216         }
3217         return TRUE;
3218     }
3219     /* item is not inaccessible */
3220     return FALSE;
3221 }
3222
3223 /*do_wear.c*/