OSDN Git Service

upgrade to 3.6.1
[jnethack/source.git] / src / do_wear.c
1 /* NetHack 3.6  do_wear.c       $NHDT-Date: 1514072526 2017/12/23 23:42:06 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.100 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2012. */
4 /* NetHack may be freely redistributed.  See license for details. */
5
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016            */
9 /* JNetHack may be freely redistributed.  See license for details. */
10
11 #include "hack.h"
12
13 static NEARDATA const char see_yourself[] = "see yourself";
14 static NEARDATA const char unknown_type[] = "Unknown type of %s (%d)";
15 #if 0 /*JP*/
16 static NEARDATA const char c_armor[] = "armor", c_suit[] = "suit",
17                            c_shirt[] = "shirt", c_cloak[] = "cloak",
18                            c_gloves[] = "gloves", c_boots[] = "boots",
19                            c_helmet[] = "helmet", c_shield[] = "shield",
20                            c_weapon[] = "weapon", c_sword[] = "sword",
21                            c_axe[] = "axe", c_that_[] = "that";
22 #else
23 static NEARDATA const char c_armor[]  = "\8aZ", c_suit[]   = "\95\9e",
24                            c_shirt[]  = "\83V\83\83\83c", c_cloak[]  = "\83N\83\8d\81[\83N",
25                            c_gloves[] = "\8f¬\8eè", c_boots[]  = "\8cC",
26                            c_helmet[] = "\8a\95", c_shield[] = "\8f\82",
27                            c_weapon[] = "\95\90\8aí", c_sword[]  = "\8c\95",
28                            c_axe[]    = "\95\80", c_that_[]  = "\82»\82ê";
29 #endif
30
31 static NEARDATA const long takeoff_order[] = {
32     WORN_BLINDF, W_WEP,      WORN_SHIELD, WORN_GLOVES, LEFT_RING,
33     RIGHT_RING,  WORN_CLOAK, WORN_HELMET, WORN_AMUL,   WORN_ARMOR,
34     WORN_SHIRT,  WORN_BOOTS, W_SWAPWEP,   W_QUIVER,    0L
35 };
36
37 STATIC_DCL void FDECL(on_msg, (struct obj *));
38 STATIC_DCL void FDECL(toggle_stealth, (struct obj *, long, BOOLEAN_P));
39 STATIC_DCL void FDECL(toggle_displacement, (struct obj *, long, BOOLEAN_P));
40 STATIC_PTR int NDECL(Armor_on);
41 /* int NDECL(Boots_on); -- moved to extern.h */
42 STATIC_PTR int NDECL(Cloak_on);
43 STATIC_PTR int NDECL(Helmet_on);
44 STATIC_PTR int NDECL(Gloves_on);
45 STATIC_DCL void FDECL(wielding_corpse, (struct obj *, BOOLEAN_P));
46 STATIC_PTR int NDECL(Shield_on);
47 STATIC_PTR int NDECL(Shirt_on);
48 STATIC_DCL void NDECL(Amulet_on);
49 STATIC_DCL void FDECL(learnring, (struct obj *, BOOLEAN_P));
50 STATIC_DCL void FDECL(Ring_off_or_gone, (struct obj *, BOOLEAN_P));
51 STATIC_PTR int FDECL(select_off, (struct obj *));
52 STATIC_DCL struct obj *NDECL(do_takeoff);
53 STATIC_PTR int NDECL(take_off);
54 STATIC_DCL int FDECL(menu_remarm, (int));
55 STATIC_DCL void FDECL(count_worn_stuff, (struct obj **, BOOLEAN_P));
56 STATIC_PTR int FDECL(armor_or_accessory_off, (struct obj *));
57 STATIC_PTR int FDECL(accessory_or_armor_on, (struct obj *));
58 #if 0 /*JP*/
59 STATIC_DCL void FDECL(already_wearing, (const char *));
60 #else
61 STATIC_DCL void FDECL(already_wearing, (const char*, struct obj *));
62 #endif
63 STATIC_DCL void FDECL(already_wearing2, (const char *, const char *));
64
65 void
66 off_msg(otmp)
67 struct obj *otmp;
68 {
69 #if 0 /*JP*/
70     if (flags.verbose)
71         You("were wearing %s.", doname(otmp));
72 #else
73     const char *j;
74     const char *m;
75     m = joffmsg(otmp, &j);
76     if(flags.verbose)
77         You("%s%s%s\81D", doname(otmp), j, jpast(m));
78 #endif
79 }
80
81 /* for items that involve no delay */
82 STATIC_OVL void
83 on_msg(otmp)
84 struct obj *otmp;
85 {
86     if (flags.verbose) {
87 #if 0 /*JP*/
88         char how[BUFSZ];
89         /* call xname() before obj_is_pname(); formatting obj's name
90            might set obj->dknown and that affects the pname test */
91         const char *otmp_name = xname(otmp);
92
93         how[0] = '\0';
94         if (otmp->otyp == TOWEL)
95             Sprintf(how, " around your %s", body_part(HEAD));
96         You("are now wearing %s%s.",
97             obj_is_pname(otmp) ? the(otmp_name) : an(otmp_name), how);
98 #else
99         const char *j;
100         const char *m;
101         m = jonmsg(otmp, &j);
102         You("%s%s%s\81D", xname(otmp), j, jpast(m));
103 #endif
104     }
105 }
106
107 /* starting equipment gets auto-worn at beginning of new game,
108    and we don't want stealth or displacement feedback then */
109 static boolean initial_don = FALSE; /* manipulated in set_wear() */
110
111 /* putting on or taking off an item which confers stealth;
112    give feedback and discover it iff stealth state is changing */
113 STATIC_OVL
114 void
115 toggle_stealth(obj, oldprop, on)
116 struct obj *obj;
117 long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */
118 boolean on;
119 {
120     if (on ? initial_don : context.takeoff.cancelled_don)
121         return;
122
123     if (!oldprop /* extrinsic stealth from something else */
124         && !HStealth /* intrinsic stealth */
125         && !BStealth) { /* stealth blocked by something */
126         if (obj->otyp == RIN_STEALTH)
127             learnring(obj, TRUE);
128         else
129             makeknown(obj->otyp);
130
131         if (on) {
132             if (!is_boots(obj))
133 /*JP
134                 You("move very quietly.");
135 */
136                 Your("\90Ã\82©\82É\93®\82¯\82é\82æ\82¤\82É\82È\82Á\82½\81D");
137             else if (Levitation || Flying)
138 /*JP
139                 You("float imperceptibly.");
140 */
141                 You("\82¢\82Â\82Ì\82Ü\82É\82©\95\82\82¢\82Ä\82¢\82½\81D");
142             else
143 /*JP
144                 You("walk very quietly.");
145 */
146                 Your("\91«\89¹\82Í\8f¬\82³\82­\82È\82Á\82½\81D");
147         } else {
148 /*JP
149             You("sure are noisy.");
150 */
151             Your("\91«\89¹\82Í\91å\82«\82­\82È\82Á\82½\81D");
152         }
153     }
154 }
155
156 /* putting on or taking off an item which confers displacement;
157    give feedback and discover it iff displacement state is changing *and*
158    hero is able to see self (or sense monsters) */
159 STATIC_OVL
160 void
161 toggle_displacement(obj, oldprop, on)
162 struct obj *obj;
163 long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */
164 boolean on;
165 {
166     if (on ? initial_don : context.takeoff.cancelled_don)
167         return;
168
169     if (!oldprop /* extrinsic displacement from something else */
170         && !(u.uprops[DISPLACED].intrinsic) /* (theoretical) */
171         && !(u.uprops[DISPLACED].blocked) /* (also theoretical) */
172         /* we don't use canseeself() here because it augments vision
173            with touch, which isn't appropriate for deciding whether
174            we'll notice that monsters have trouble spotting the hero */
175         && ((!Blind         /* see anything */
176              && !u.uswallow /* see surroundings */
177              && !Invisible) /* see self */
178             /* actively sensing nearby monsters via telepathy or extended
179                monster detection overrides vision considerations because
180                hero also senses self in this situation */
181             || (Unblind_telepat
182                 || (Blind_telepat && Blind)
183                 || Detect_monsters))) {
184         makeknown(obj->otyp);
185
186 #if 0 /*JP*/
187         You_feel("that monsters%s have difficulty pinpointing your location.",
188                  on ? "" : " no longer");
189 #else
190         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",
191                  on ? "\82ç\82È\82­" : "\82é\82æ\82¤\82É");
192 #endif
193     }
194 }
195
196 /*
197  * The Type_on() functions should be called *after* setworn().
198  * The Type_off() functions call setworn() themselves.
199  * [Blindf_on() is an exception and calls setworn() itself.]
200  */
201
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             Strangled = 6L;
859             context.botl = TRUE;
860 /*JP
861             pline("It constricts your throat!");
862 */
863             pline("\96\82\8f\9c\82¯\82Í\82 \82È\82½\82Ì\8dA\82ð\8di\82ß\82Â\82¯\82½\81I");
864         }
865         break;
866     case AMULET_OF_RESTFUL_SLEEP: {
867         long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT);
868
869         /* avoid clobbering FROMOUTSIDE bit, which might have
870            gotten set by previously eating one of these amulets */
871         if (newnap < oldnap || oldnap == 0L)
872             HSleepy = (HSleepy & ~TIMEOUT) | newnap;
873     } break;
874     case AMULET_OF_YENDOR:
875         break;
876     }
877 }
878
879 void
880 Amulet_off()
881 {
882     context.takeoff.mask &= ~W_AMUL;
883
884     switch (uamul->otyp) {
885     case AMULET_OF_ESP:
886         /* need to update ability before calling see_monsters() */
887         setworn((struct obj *) 0, W_AMUL);
888         see_monsters();
889         return;
890     case AMULET_OF_LIFE_SAVING:
891     case AMULET_VERSUS_POISON:
892     case AMULET_OF_REFLECTION:
893     case AMULET_OF_CHANGE:
894     case AMULET_OF_UNCHANGING:
895     case FAKE_AMULET_OF_YENDOR:
896         break;
897     case AMULET_OF_MAGICAL_BREATHING:
898         if (Underwater) {
899             /* HMagical_breathing must be set off
900                 before calling drown() */
901             setworn((struct obj *) 0, W_AMUL);
902             if (!breathless(youmonst.data) && !amphibious(youmonst.data)
903                 && !Swimming) {
904 #if 0 /*JP*/
905                 You("suddenly inhale an unhealthy amount of %s!",
906                     hliquid("water"));
907 #else
908                 You("\93Ë\91R\81C\91å\97Ê\82Ì%s\82ð\88ù\82Ý\8d\9e\82ñ\82¾\81I",
909                     hliquid("\90\85"));
910 #endif
911                 (void) drown();
912             }
913             return;
914         }
915         break;
916     case AMULET_OF_STRANGULATION:
917         if (Strangled) {
918             Strangled = 0L;
919             context.botl = TRUE;
920             if (Breathless)
921 /*JP
922                 Your("%s is no longer constricted!", body_part(NECK));
923 */
924                 pline("%s\82ª\8ay\82É\82È\82Á\82½\81I", body_part(NECK));
925             else
926 /*JP
927                 You("can breathe more easily!");
928 */
929                 You("\8ay\82É\8cÄ\8bz\82Å\82«\82é\82æ\82¤\82É\82È\82Á\82½\81I");
930         }
931         break;
932     case AMULET_OF_RESTFUL_SLEEP:
933         setworn((struct obj *) 0, W_AMUL);
934         /* HSleepy = 0L; -- avoid clobbering FROMOUTSIDE bit */
935         if (!ESleepy && !(HSleepy & ~TIMEOUT))
936             HSleepy &= ~TIMEOUT; /* clear timeout bits */
937         return;
938     case AMULET_OF_YENDOR:
939         break;
940     }
941     setworn((struct obj *) 0, W_AMUL);
942     return;
943 }
944
945 /* handle ring discovery; comparable to learnwand() */
946 STATIC_OVL void
947 learnring(ring, observed)
948 struct obj *ring;
949 boolean observed;
950 {
951     int ringtype = ring->otyp;
952
953     /* if effect was observeable then we usually discover the type */
954     if (observed) {
955         /* if we already know the ring type which accomplishes this
956            effect (assumes there is at most one type for each effect),
957            mark this ring as having been seen (no need for makeknown);
958            otherwise if we have seen this ring, discover its type */
959         if (objects[ringtype].oc_name_known)
960             ring->dknown = 1;
961         else if (ring->dknown)
962             makeknown(ringtype);
963 #if 0 /* see learnwand() */
964         else
965             ring->eknown = 1;
966 #endif
967     }
968
969     /* make enchantment of charged ring known (might be +0) and update
970        perm invent window if we've seen this ring and know its type */
971     if (ring->dknown && objects[ringtype].oc_name_known) {
972         if (objects[ringtype].oc_charged)
973             ring->known = 1;
974         update_inventory();
975     }
976 }
977
978 void
979 Ring_on(obj)
980 register struct obj *obj;
981 {
982     long oldprop = u.uprops[objects[obj->otyp].oc_oprop].extrinsic;
983     int old_attrib, which;
984     boolean observable;
985
986     /* make sure ring isn't wielded; can't use remove_worn_item()
987        here because it has already been set worn in a ring slot */
988     if (obj == uwep)
989         setuwep((struct obj *) 0);
990     else if (obj == uswapwep)
991         setuswapwep((struct obj *) 0);
992     else if (obj == uquiver)
993         setuqwep((struct obj *) 0);
994
995     /* only mask out W_RING when we don't have both
996        left and right rings of the same type */
997     if ((oldprop & W_RING) != W_RING)
998         oldprop &= ~W_RING;
999
1000     switch (obj->otyp) {
1001     case RIN_TELEPORTATION:
1002     case RIN_REGENERATION:
1003     case RIN_SEARCHING:
1004     case RIN_HUNGER:
1005     case RIN_AGGRAVATE_MONSTER:
1006     case RIN_POISON_RESISTANCE:
1007     case RIN_FIRE_RESISTANCE:
1008     case RIN_COLD_RESISTANCE:
1009     case RIN_SHOCK_RESISTANCE:
1010     case RIN_CONFLICT:
1011     case RIN_TELEPORT_CONTROL:
1012     case RIN_POLYMORPH:
1013     case RIN_POLYMORPH_CONTROL:
1014     case RIN_FREE_ACTION:
1015     case RIN_SLOW_DIGESTION:
1016     case RIN_SUSTAIN_ABILITY:
1017     case MEAT_RING:
1018         break;
1019     case RIN_STEALTH:
1020         toggle_stealth(obj, oldprop, TRUE);
1021         break;
1022     case RIN_WARNING:
1023         see_monsters();
1024         break;
1025     case RIN_SEE_INVISIBLE:
1026         /* can now see invisible monsters */
1027         set_mimic_blocking(); /* do special mimic handling */
1028         see_monsters();
1029
1030         if (Invis && !oldprop && !HSee_invisible && !Blind) {
1031             newsym(u.ux, u.uy);
1032 /*JP
1033             pline("Suddenly you are transparent, but there!");
1034 */
1035             pline("\93Ë\91R\93§\96¾\82É\82È\82Á\82½\81D\82µ\82©\82µ\91\8dÝ\82Í\82µ\82Ä\82¢\82é\81I");
1036             learnring(obj, TRUE);
1037         }
1038         break;
1039     case RIN_INVISIBILITY:
1040         if (!oldprop && !HInvis && !BInvis && !Blind) {
1041             learnring(obj, TRUE);
1042             newsym(u.ux, u.uy);
1043             self_invis_message();
1044         }
1045         break;
1046     case RIN_LEVITATION:
1047         if (!oldprop && !HLevitation && !BLevitation) {
1048             float_up();
1049             learnring(obj, TRUE);
1050             spoteffects(FALSE); /* for sinks */
1051         } else {
1052             float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
1053         }
1054         break;
1055     case RIN_GAIN_STRENGTH:
1056         which = A_STR;
1057         goto adjust_attrib;
1058     case RIN_GAIN_CONSTITUTION:
1059         which = A_CON;
1060         goto adjust_attrib;
1061     case RIN_ADORNMENT:
1062         which = A_CHA;
1063     adjust_attrib:
1064         old_attrib = ACURR(which);
1065         ABON(which) += obj->spe;
1066         observable = (old_attrib != ACURR(which));
1067         /* if didn't change, usually means ring is +0 but might
1068            be because nonzero couldn't go below min or above max;
1069            learn +0 enchantment if attribute value is not stuck
1070            at a limit [and ring has been seen and its type is
1071            already discovered, both handled by learnring()] */
1072         if (observable || !extremeattr(which))
1073             learnring(obj, observable);
1074         context.botl = 1;
1075         break;
1076     case RIN_INCREASE_ACCURACY: /* KMH */
1077         u.uhitinc += obj->spe;
1078         break;
1079     case RIN_INCREASE_DAMAGE:
1080         u.udaminc += obj->spe;
1081         break;
1082     case RIN_PROTECTION_FROM_SHAPE_CHAN:
1083         rescham();
1084         break;
1085     case RIN_PROTECTION:
1086         /* usually learn enchantment and discover type;
1087            won't happen if ring is unseen or if it's +0
1088            and the type hasn't been discovered yet */
1089         observable = (obj->spe != 0);
1090         learnring(obj, observable);
1091         if (obj->spe)
1092             find_ac(); /* updates botl */
1093         break;
1094     }
1095 }
1096
1097 STATIC_OVL void
1098 Ring_off_or_gone(obj, gone)
1099 register struct obj *obj;
1100 boolean gone;
1101 {
1102     long mask = (obj->owornmask & W_RING);
1103     int old_attrib, which;
1104     boolean observable;
1105
1106     context.takeoff.mask &= ~mask;
1107     if (!(u.uprops[objects[obj->otyp].oc_oprop].extrinsic & mask))
1108         impossible("Strange... I didn't know you had that ring.");
1109     if (gone)
1110         setnotworn(obj);
1111     else
1112         setworn((struct obj *) 0, obj->owornmask);
1113
1114     switch (obj->otyp) {
1115     case RIN_TELEPORTATION:
1116     case RIN_REGENERATION:
1117     case RIN_SEARCHING:
1118     case RIN_HUNGER:
1119     case RIN_AGGRAVATE_MONSTER:
1120     case RIN_POISON_RESISTANCE:
1121     case RIN_FIRE_RESISTANCE:
1122     case RIN_COLD_RESISTANCE:
1123     case RIN_SHOCK_RESISTANCE:
1124     case RIN_CONFLICT:
1125     case RIN_TELEPORT_CONTROL:
1126     case RIN_POLYMORPH:
1127     case RIN_POLYMORPH_CONTROL:
1128     case RIN_FREE_ACTION:
1129     case RIN_SLOW_DIGESTION:
1130     case RIN_SUSTAIN_ABILITY:
1131     case MEAT_RING:
1132         break;
1133     case RIN_STEALTH:
1134         toggle_stealth(obj, (EStealth & ~mask), FALSE);
1135         break;
1136     case RIN_WARNING:
1137         see_monsters();
1138         break;
1139     case RIN_SEE_INVISIBLE:
1140         /* Make invisible monsters go away */
1141         if (!See_invisible) {
1142             set_mimic_blocking(); /* do special mimic handling */
1143             see_monsters();
1144         }
1145
1146         if (Invisible && !Blind) {
1147             newsym(u.ux, u.uy);
1148 /*JP
1149             pline("Suddenly you cannot see yourself.");
1150 */
1151             pline("\93Ë\91R\81C\8e©\95ª\8e©\90g\82ª\8c©\82¦\82È\82­\82È\82Á\82½\81D");
1152             learnring(obj, TRUE);
1153         }
1154         break;
1155     case RIN_INVISIBILITY:
1156         if (!Invis && !BInvis && !Blind) {
1157             newsym(u.ux, u.uy);
1158 #if 0 /*JP*/
1159             Your("body seems to unfade%s.",
1160                  See_invisible ? " completely" : "..");
1161 #else
1162             Your("\91Ì\82ª%s\81D",
1163                  See_invisible ? "\8a®\91S\82É\8c»\82í\82ê\82½" : "\8e\9f\91æ\82É\8c»\82í\82ê\82Ä\82«\82½\81D\81D");
1164 #endif
1165             learnring(obj, TRUE);
1166         }
1167         break;
1168     case RIN_LEVITATION:
1169         if (!BLevitation) {
1170             (void) float_down(0L, 0L);
1171             if (!Levitation)
1172                 learnring(obj, TRUE);
1173         } else {
1174             float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
1175         }
1176         break;
1177     case RIN_GAIN_STRENGTH:
1178         which = A_STR;
1179         goto adjust_attrib;
1180     case RIN_GAIN_CONSTITUTION:
1181         which = A_CON;
1182         goto adjust_attrib;
1183     case RIN_ADORNMENT:
1184         which = A_CHA;
1185     adjust_attrib:
1186         old_attrib = ACURR(which);
1187         ABON(which) -= obj->spe;
1188         observable = (old_attrib != ACURR(which));
1189         /* same criteria as Ring_on() */
1190         if (observable || !extremeattr(which))
1191             learnring(obj, observable);
1192         context.botl = 1;
1193         break;
1194     case RIN_INCREASE_ACCURACY: /* KMH */
1195         u.uhitinc -= obj->spe;
1196         break;
1197     case RIN_INCREASE_DAMAGE:
1198         u.udaminc -= obj->spe;
1199         break;
1200     case RIN_PROTECTION:
1201         /* might have been put on while blind and we can now see
1202            or perhaps been forgotten due to amnesia */
1203         observable = (obj->spe != 0);
1204         learnring(obj, observable);
1205         if (obj->spe)
1206             find_ac(); /* updates botl */
1207         break;
1208     case RIN_PROTECTION_FROM_SHAPE_CHAN:
1209         /* If you're no longer protected, let the chameleons
1210          * change shape again -dgk
1211          */
1212         restartcham();
1213         break;
1214     }
1215 }
1216
1217 void
1218 Ring_off(obj)
1219 struct obj *obj;
1220 {
1221     Ring_off_or_gone(obj, FALSE);
1222 }
1223
1224 void
1225 Ring_gone(obj)
1226 struct obj *obj;
1227 {
1228     Ring_off_or_gone(obj, TRUE);
1229 }
1230
1231 void
1232 Blindf_on(otmp)
1233 register struct obj *otmp;
1234 {
1235     boolean already_blind = Blind, changed = FALSE;
1236
1237     /* blindfold might be wielded; release it for wearing */
1238     if (otmp->owornmask & W_WEAPON)
1239         remove_worn_item(otmp, FALSE);
1240     setworn(otmp, W_TOOL);
1241     on_msg(otmp);
1242
1243     if (Blind && !already_blind) {
1244         changed = TRUE;
1245         if (flags.verbose)
1246 /*JP
1247             You_cant("see any more.");
1248 */
1249             You("\89½\82à\8c©\82¦\82È\82­\82È\82Á\82½\81D");
1250         /* set ball&chain variables before the hero goes blind */
1251         if (Punished)
1252             set_bc(0);
1253     } else if (already_blind && !Blind) {
1254         changed = TRUE;
1255         /* "You are now wearing the Eyes of the Overworld." */
1256         if (u.uroleplay.blind) {
1257             /* this can only happen by putting on the Eyes of the Overworld;
1258                that shouldn't actually produce a permanent cure, but we
1259                can't let the "blind from birth" conduct remain intact */
1260 /*JP
1261             pline("For the first time in your life, you can see!");
1262 */
1263             pline("\90l\90\82Å\8f\89\82ß\82Ä\81C\96Ú\82ª\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81I");
1264             u.uroleplay.blind = FALSE;
1265         } else
1266 /*JP
1267             You("can see!");
1268 */
1269             You("\96Ú\82ª\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81I");
1270     }
1271     if (changed) {
1272         /* blindness has just been toggled */
1273         if (Blind_telepat || Infravision)
1274             see_monsters();
1275         vision_full_recalc = 1; /* recalc vision limits */
1276         if (!Blind)
1277             learn_unseen_invent();
1278         context.botl = 1;
1279     }
1280 }
1281
1282 void
1283 Blindf_off(otmp)
1284 register struct obj *otmp;
1285 {
1286     boolean was_blind = Blind, changed = FALSE;
1287
1288     if (!otmp) {
1289         impossible("Blindf_off without otmp");
1290         return;
1291     }
1292     context.takeoff.mask &= ~W_TOOL;
1293     setworn((struct obj *) 0, otmp->owornmask);
1294     off_msg(otmp);
1295
1296     if (Blind) {
1297         if (was_blind) {
1298             /* "still cannot see" makes no sense when removing lenses
1299                since they can't have been the cause of your blindness */
1300             if (otmp->otyp != LENSES)
1301 /*JP
1302                 You("still cannot see.");
1303 */
1304                 You("\82Ü\82¾\96Ú\82ª\8c©\82¦\82È\82¢\81D");
1305         } else {
1306             changed = TRUE; /* !was_blind */
1307             /* "You were wearing the Eyes of the Overworld." */
1308 /*JP
1309             You_cant("see anything now!");
1310 */
1311             You("\8d¡\82Í\89½\82à\8c©\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81I");
1312             /* set ball&chain variables before the hero goes blind */
1313             if (Punished)
1314                 set_bc(0);
1315         }
1316     } else if (was_blind) {
1317         if (!gulp_blnd_check()) {
1318             changed = TRUE; /* !Blind */
1319 /*JP
1320             You("can see again.");
1321 */
1322             You("\82Ó\82½\82½\82Ñ\96Ú\82ª\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81D");
1323         }
1324     }
1325     if (changed) {
1326         /* blindness has just been toggled */
1327         if (Blind_telepat || Infravision)
1328             see_monsters();
1329         vision_full_recalc = 1; /* recalc vision limits */
1330         if (!Blind)
1331             learn_unseen_invent();
1332         context.botl = 1;
1333     }
1334 }
1335
1336 /* called in moveloop()'s prologue to set side-effects of worn start-up items;
1337    also used by poly_obj() when a worn item gets transformed */
1338 void
1339 set_wear(obj)
1340 struct obj *obj; /* if null, do all worn items; otherwise just obj itself */
1341 {
1342     initial_don = !obj;
1343
1344     if (!obj ? ublindf != 0 : (obj == ublindf))
1345         (void) Blindf_on(ublindf);
1346     if (!obj ? uright != 0 : (obj == uright))
1347         (void) Ring_on(uright);
1348     if (!obj ? uleft != 0 : (obj == uleft))
1349         (void) Ring_on(uleft);
1350     if (!obj ? uamul != 0 : (obj == uamul))
1351         (void) Amulet_on();
1352
1353     if (!obj ? uarmu != 0 : (obj == uarmu))
1354         (void) Shirt_on();
1355     if (!obj ? uarm != 0 : (obj == uarm))
1356         (void) Armor_on();
1357     if (!obj ? uarmc != 0 : (obj == uarmc))
1358         (void) Cloak_on();
1359     if (!obj ? uarmf != 0 : (obj == uarmf))
1360         (void) Boots_on();
1361     if (!obj ? uarmg != 0 : (obj == uarmg))
1362         (void) Gloves_on();
1363     if (!obj ? uarmh != 0 : (obj == uarmh))
1364         (void) Helmet_on();
1365     if (!obj ? uarms != 0 : (obj == uarms))
1366         (void) Shield_on();
1367
1368     initial_don = FALSE;
1369 }
1370
1371 /* check whether the target object is currently being put on (or taken off--
1372    also checks for doffing--[why?]) */
1373 boolean
1374 donning(otmp)
1375 struct obj *otmp;
1376 {
1377     boolean result = FALSE;
1378
1379     /* 'W' (or 'P' used for armor) sets afternmv */
1380     if (doffing(otmp))
1381         result = TRUE;
1382     else if (otmp == uarm)
1383         result = (afternmv == Armor_on);
1384     else if (otmp == uarmu)
1385         result = (afternmv == Shirt_on);
1386     else if (otmp == uarmc)
1387         result = (afternmv == Cloak_on);
1388     else if (otmp == uarmf)
1389         result = (afternmv == Boots_on);
1390     else if (otmp == uarmh)
1391         result = (afternmv == Helmet_on);
1392     else if (otmp == uarmg)
1393         result = (afternmv == Gloves_on);
1394     else if (otmp == uarms)
1395         result = (afternmv == Shield_on);
1396
1397     return result;
1398 }
1399
1400 /* check whether the target object is currently being taken off,
1401    so that stop_donning() and steal() can vary messages */
1402 boolean
1403 doffing(otmp)
1404 struct obj *otmp;
1405 {
1406     long what = context.takeoff.what;
1407     boolean result = FALSE;
1408
1409     /* 'T' (or 'R' used for armor) sets afternmv, 'A' sets takeoff.what */
1410     if (otmp == uarm)
1411         result = (afternmv == Armor_off || what == WORN_ARMOR);
1412     else if (otmp == uarmu)
1413         result = (afternmv == Shirt_off || what == WORN_SHIRT);
1414     else if (otmp == uarmc)
1415         result = (afternmv == Cloak_off || what == WORN_CLOAK);
1416     else if (otmp == uarmf)
1417         result = (afternmv == Boots_off || what == WORN_BOOTS);
1418     else if (otmp == uarmh)
1419         result = (afternmv == Helmet_off || what == WORN_HELMET);
1420     else if (otmp == uarmg)
1421         result = (afternmv == Gloves_off || what == WORN_GLOVES);
1422     else if (otmp == uarms)
1423         result = (afternmv == Shield_off || what == WORN_SHIELD);
1424     /* these 1-turn items don't need 'afternmv' checks */
1425     else if (otmp == uamul)
1426         result = (what == WORN_AMUL);
1427     else if (otmp == uleft)
1428         result = (what == LEFT_RING);
1429     else if (otmp == uright)
1430         result = (what == RIGHT_RING);
1431     else if (otmp == ublindf)
1432         result = (what == WORN_BLINDF);
1433     else if (otmp == uwep)
1434         result = (what == W_WEP);
1435     else if (otmp == uswapwep)
1436         result = (what == W_SWAPWEP);
1437     else if (otmp == uquiver)
1438         result = (what == W_QUIVER);
1439
1440     return result;
1441 }
1442
1443 /* despite their names, cancel_don() and cancel_doff() both apply to both
1444    donning and doffing... */
1445 void
1446 cancel_doff(obj, slotmask)
1447 struct obj *obj;
1448 long slotmask;
1449 {
1450     /* Called by setworn() for old item in specified slot or by setnotworn()
1451      * for specified item.  We don't want to call cancel_don() if we got
1452      * here via <X>_off() -> setworn((struct obj *)0) -> cancel_doff()
1453      * because that would stop the 'A' command from continuing with next
1454      * selected item.  So do_takeoff() sets a flag in takeoff.mask for us.
1455      * [For taking off an individual item with 'T'/'R'/'w-', it doesn't
1456      * matter whether cancel_don() gets called here--the item has already
1457      * been removed by now.]
1458      */
1459     if (!(context.takeoff.mask & I_SPECIAL) && donning(obj))
1460         cancel_don(); /* applies to doffing too */
1461     context.takeoff.mask &= ~slotmask;
1462 }
1463
1464 /* despite their names, cancel_don() and cancel_doff() both apply to both
1465    donning and doffing... */
1466 void
1467 cancel_don()
1468 {
1469     /* the piece of armor we were donning/doffing has vanished, so stop
1470      * wasting time on it (and don't dereference it when donning would
1471      * otherwise finish)
1472      */
1473     context.takeoff.cancelled_don =
1474         (afternmv == Boots_on || afternmv == Helmet_on
1475          || afternmv == Gloves_on || afternmv == Armor_on);
1476     afternmv = (int NDECL((*))) 0;
1477     nomovemsg = (char *) 0;
1478     multi = 0;
1479     context.takeoff.delay = 0;
1480     context.takeoff.what = 0L;
1481 }
1482
1483 /* called by steal() during theft from hero; interrupt donning/doffing */
1484 int
1485 stop_donning(stolenobj)
1486 struct obj *stolenobj; /* no message if stolenobj is already being doffing */
1487 {
1488     char buf[BUFSZ];
1489     struct obj *otmp;
1490     boolean putting_on;
1491     int result = 0;
1492
1493     for (otmp = invent; otmp; otmp = otmp->nobj)
1494         if ((otmp->owornmask & W_ARMOR) && donning(otmp))
1495             break;
1496     /* at most one item will pass donning() test at any given time */
1497     if (!otmp)
1498         return 0;
1499
1500     /* donning() returns True when doffing too; doffing() is more specific */
1501     putting_on = !doffing(otmp);
1502     /* cancel_don() looks at afternmv; it can also cancel doffing */
1503     cancel_don();
1504     /* don't want <armor>_on() or <armor>_off() being called
1505        by unmul() since the on or off action isn't completing */
1506     afternmv = (int NDECL((*))) 0;
1507     if (putting_on || otmp != stolenobj) {
1508 #if 0 /*JP*/
1509         Sprintf(buf, "You stop %s %s.",
1510                 putting_on ? "putting on" : "taking off",
1511                 thesimpleoname(otmp));
1512 #else
1513         Sprintf(buf, "\82 \82È\82½\82Í%s\82ð%s\82Ì\82ð\8e~\82ß\82½\81D",
1514                 thesimpleoname(otmp),
1515                 putting_on ? "\90g\82É\82Â\82¯\82é" : "\8aO\82·");
1516 #endif
1517     } else {
1518         buf[0] = '\0';   /* silently stop doffing stolenobj */
1519         result = -multi; /* remember this before calling unmul() */
1520     }
1521     unmul(buf);
1522     /* while putting on, item becomes worn immediately but side-effects are
1523        deferred until the delay expires; when interrupted, make it unworn
1524        (while taking off, item stays worn until the delay expires; when
1525        interrupted, leave it worn) */
1526     if (putting_on)
1527         remove_worn_item(otmp, FALSE);
1528
1529     return result;
1530 }
1531
1532 /* both 'clothes' and 'accessories' now include both armor and accessories;
1533    TOOL_CLASS is for eyewear, FOOD_CLASS is for MEAT_RING */
1534 static NEARDATA const char clothes[] = {
1535     ARMOR_CLASS, RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, 0
1536 };
1537 static NEARDATA const char accessories[] = {
1538     RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, ARMOR_CLASS, 0
1539 };
1540 STATIC_VAR NEARDATA int Narmorpieces, Naccessories;
1541
1542 /* assign values to Narmorpieces and Naccessories */
1543 STATIC_OVL void
1544 count_worn_stuff(which, accessorizing)
1545 struct obj **which; /* caller wants this when count is 1 */
1546 boolean accessorizing;
1547 {
1548     struct obj *otmp;
1549
1550     Narmorpieces = Naccessories = 0;
1551
1552 #define MOREWORN(x,wtyp) do { if (x) { wtyp++; otmp = x; } } while (0)
1553     otmp = 0;
1554     MOREWORN(uarmh, Narmorpieces);
1555     MOREWORN(uarms, Narmorpieces);
1556     MOREWORN(uarmg, Narmorpieces);
1557     MOREWORN(uarmf, Narmorpieces);
1558     /* for cloak/suit/shirt, we only count the outermost item so that it
1559        can be taken off without confirmation if final count ends up as 1 */
1560     if (uarmc)
1561         MOREWORN(uarmc, Narmorpieces);
1562     else if (uarm)
1563         MOREWORN(uarm, Narmorpieces);
1564     else if (uarmu)
1565         MOREWORN(uarmu, Narmorpieces);
1566     if (!accessorizing)
1567         *which = otmp; /* default item iff Narmorpieces is 1 */
1568
1569     otmp = 0;
1570     MOREWORN(uleft, Naccessories);
1571     MOREWORN(uright, Naccessories);
1572     MOREWORN(uamul, Naccessories);
1573     MOREWORN(ublindf, Naccessories);
1574     if (accessorizing)
1575         *which = otmp; /* default item iff Naccessories is 1 */
1576 #undef MOREWORN
1577 }
1578
1579 /* take off one piece or armor or one accessory;
1580    shared by dotakeoff('T') and doremring('R') */
1581 STATIC_OVL int
1582 armor_or_accessory_off(obj)
1583 struct obj *obj;
1584 {
1585 #if 1 /*JP*/
1586     const char *j;
1587     const char *m;
1588 #endif
1589     if (!(obj->owornmask & (W_ARMOR | W_ACCESSORY))) {
1590 /*JP
1591         You("are not wearing that.");
1592 */
1593         You("\82»\82ê\82ð\90g\82É\82Â\82¯\82Ä\82¢\82È\82¢\81D");
1594         return 0;
1595     }
1596     if (obj == uskin
1597         || ((obj == uarm) && uarmc)
1598         || ((obj == uarmu) && (uarmc || uarm))) {
1599         char why[QBUFSZ], what[QBUFSZ];
1600
1601         why[0] = what[0] = '\0';
1602         if (obj != uskin) {
1603             if (uarmc)
1604                 Strcat(what, cloak_simple_name(uarmc));
1605             if ((obj == uarmu) && uarm) {
1606                 if (uarmc)
1607                     Strcat(what, " and ");
1608                 Strcat(what, suit_simple_name(uarm));
1609             }
1610             Sprintf(why, " without taking off your %s first", what);
1611         } else {
1612             Strcpy(why, "; it's embedded");
1613         }
1614 #if 0 /*JP*/
1615         You_cant("take that off%s.", why);
1616 #else
1617         m = joffmsg(obj, &j);
1618         You("\82»\82ê%s%s\82±\82Æ\82Í\82Å\82«\82È\82¢\81D", j, m);
1619 #endif
1620         return 0;
1621     }
1622
1623     reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */
1624     (void) select_off(obj);
1625     if (!context.takeoff.mask)
1626         return 0;
1627     /* none of armoroff()/Ring_/Amulet/Blindf_off() use context.takeoff.mask */
1628     reset_remarm();
1629
1630     if (obj->owornmask & W_ARMOR) {
1631         (void) armoroff(obj);
1632     } else if (obj == uright || obj == uleft) {
1633         /* Sometimes we want to give the off_msg before removing and
1634          * sometimes after; for instance, "you were wearing a moonstone
1635          * ring (on right hand)" is desired but "you were wearing a
1636          * square amulet (being worn)" is not because of the redundant
1637          * "being worn".
1638          */
1639         off_msg(obj);
1640         Ring_off(obj);
1641     } else if (obj == uamul) {
1642         Amulet_off();
1643         off_msg(obj);
1644     } else if (obj == ublindf) {
1645         Blindf_off(obj); /* does its own off_msg */
1646     } else {
1647         impossible("removing strange accessory?");
1648         if (obj->owornmask)
1649             remove_worn_item(obj, FALSE);
1650     }
1651     return 1;
1652 }
1653
1654 /* the 'T' command */
1655 int
1656 dotakeoff()
1657 {
1658     struct obj *otmp = (struct obj *) 0;
1659 #if 1 /*JP*/
1660     const char *j;
1661     const char *m;
1662 #endif
1663
1664     count_worn_stuff(&otmp, FALSE);
1665     if (!Narmorpieces && !Naccessories) {
1666         /* assert( GRAY_DRAGON_SCALES > YELLOW_DRAGON_SCALE_MAIL ); */
1667         if (uskin)
1668 #if 0 /*JP*/
1669             pline_The("%s merged with your skin!",
1670                       uskin->otyp >= GRAY_DRAGON_SCALES
1671                           ? "dragon scales are"
1672                           : "dragon scale mail is");
1673 #else
1674             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",
1675                       uskin->otyp >= GRAY_DRAGON_SCALES
1676                           ? "" : "\8aZ");
1677 #endif
1678         else
1679 /*JP
1680             pline("Not wearing any armor or accessories.");
1681 */
1682             pline("\8aZ\82â\91\95\8fü\95i\82ð\90g\82É\82Â\82¯\82Ä\82¢\82È\82¢\81D");
1683         return 0;
1684     }
1685     if (Narmorpieces != 1 || ParanoidRemove)
1686         otmp = getobj(clothes, "take off");
1687     if (!otmp)
1688         return 0;
1689
1690     return armor_or_accessory_off(otmp);
1691 }
1692
1693 /* the 'R' command */
1694 int
1695 doremring()
1696 {
1697     struct obj *otmp = 0;
1698
1699     count_worn_stuff(&otmp, TRUE);
1700     if (!Naccessories && !Narmorpieces) {
1701 /*JP
1702         pline("Not wearing any accessories or armor.");
1703 */
1704         pline("\91\95\8fü\95i\82â\8aZ\82ð\90g\82É\82Â\82¯\82Ä\82¢\82È\82¢\81D");
1705         return 0;
1706     }
1707     if (Naccessories != 1 || ParanoidRemove)
1708         otmp = getobj(accessories, "remove");
1709     if (!otmp)
1710         return 0;
1711
1712     return armor_or_accessory_off(otmp);
1713 }
1714
1715 /* Check if something worn is cursed _and_ unremovable. */
1716 int
1717 cursed(otmp)
1718 register struct obj *otmp;
1719 {
1720     if (!otmp) {
1721         impossible("cursed without otmp");
1722         return 0;
1723     }
1724     /* Curses, like chickens, come home to roost. */
1725     if ((otmp == uwep) ? welded(otmp) : (int) otmp->cursed) {
1726 #if 0 /*JP*/
1727         boolean use_plural = (is_boots(otmp) || is_gloves(otmp)
1728                               || otmp->otyp == LENSES || otmp->quan > 1L);
1729
1730         You("can't.  %s cursed.", use_plural ? "They are" : "It is");
1731 #else
1732         pline("\96³\97\9d\82¾\81D\82»\82ê\82Í\8eô\82í\82ê\82Ä\82¢\82é\81D");
1733 #endif
1734         otmp->bknown = TRUE;
1735         return 1;
1736     }
1737     return 0;
1738 }
1739
1740 int
1741 armoroff(otmp)
1742 register struct obj *otmp;
1743 {
1744     register int delay = -objects[otmp->otyp].oc_delay;
1745
1746     if (cursed(otmp))
1747         return 0;
1748     if (delay) {
1749         nomul(delay);
1750 /*JP
1751         multi_reason = "disrobing";
1752 */
1753         multi_reason = "\92E\82¢\82Å\82¢\82é\8e\9e\82É";
1754         if (is_helmet(otmp)) {
1755             /* ick... */
1756 /*JP
1757             nomovemsg = !strcmp(helm_simple_name(otmp), "hat")
1758 */
1759             nomovemsg = !strcmp(helm_simple_name(otmp), "\96X\8eq")
1760 /*JP
1761                             ? "You finish taking off your hat."
1762 */
1763                             ? "\82 \82È\82½\82Í\8a\95\82ð\92E\82¬\82¨\82¦\82½\81D"
1764 /*JP
1765                             : "You finish taking off your helmet.";
1766 */
1767                             : "\82 \82È\82½\82Í\96X\8eq\82ð\92E\82¬\82¨\82¦\82½\81D";
1768             afternmv = Helmet_off;
1769         } else if (is_gloves(otmp)) {
1770 /*JP
1771             nomovemsg = "You finish taking off your gloves.";
1772 */
1773             nomovemsg = "\82 \82È\82½\82Í\8f¬\8eè\82ð\92E\82¬\82¨\82¦\82½\81D";
1774             afternmv = Gloves_off;
1775         } else if (is_boots(otmp)) {
1776 /*JP
1777             nomovemsg = "You finish taking off your boots.";
1778 */
1779             nomovemsg = "\82 \82È\82½\82Í\8cC\82ð\92E\82¬\82¨\82¦\82½\81D";
1780             afternmv = Boots_off;
1781         } else {
1782 /*JP
1783             nomovemsg = "You finish taking off your suit.";
1784 */
1785             nomovemsg = "\82 \82È\82½\82Í\92\85\82Ä\82¢\82é\95¨\82ð\92E\82¬\82¨\82¦\82½\81D";
1786             afternmv = Armor_off;
1787         }
1788     } else {
1789         /* Be warned!  We want off_msg after removing the item to
1790          * avoid "You were wearing ____ (being worn)."  However, an
1791          * item which grants fire resistance might cause some trouble
1792          * if removed in Hell and lifesaving puts it back on; in this
1793          * case the message will be printed at the wrong time (after
1794          * the messages saying you died and were lifesaved).  Luckily,
1795          * no cloak, shield, or fast-removable armor grants fire
1796          * resistance, so we can safely do the off_msg afterwards.
1797          * Rings do grant fire resistance, but for rings we want the
1798          * off_msg before removal anyway so there's no problem.  Take
1799          * care in adding armors granting fire resistance; this code
1800          * might need modification.
1801          * 3.2 (actually 3.1 even): that comment is obsolete since
1802          * fire resistance is not required for Gehennom so setworn()
1803          * doesn't force the resistance granting item to be re-worn
1804          * after being lifesaved anymore.
1805          */
1806         if (is_cloak(otmp))
1807             (void) Cloak_off();
1808         else if (is_shield(otmp))
1809             (void) Shield_off();
1810         else
1811             setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
1812         off_msg(otmp);
1813     }
1814     context.takeoff.mask = context.takeoff.what = 0L;
1815     return 1;
1816 }
1817
1818 /*JP 
1819 ** \95¨\82É\82æ\82Á\82Ä\93®\8e\8c\82ª\95Ï\89»\82·\82é\82Ì\82Å otmp\82ð\92Ç\89Á
1820 */
1821 STATIC_OVL void
1822 #if 0 /*JP*/
1823 already_wearing(cc)
1824 const char *cc;
1825 #else
1826 already_wearing(cc, otmp)
1827 const char *cc;
1828 struct obj *otmp;
1829 #endif
1830 {
1831 #if 1 /*JP*/
1832     const char *j;
1833     const char *m;
1834     m = jconj(jonmsg(otmp, &j), "\82Ä\82¢\82é");
1835 #endif
1836 /*JP
1837     You("are already wearing %s%c", cc, (cc == c_that_) ? '!' : '.');
1838 */
1839     You("\82à\82¤%s%s%s%s", cc, j,  m, (cc == c_that_) ? "\81I" : "\81D");
1840 }
1841
1842 STATIC_OVL void
1843 already_wearing2(cc1, cc2)
1844 const char *cc1, *cc2;
1845 {
1846 /*JP
1847     You_cant("wear %s because you're wearing %s there already.", cc1, cc2);
1848 */
1849     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);
1850 }
1851
1852 /*
1853  * canwearobj checks to see whether the player can wear a piece of armor
1854  *
1855  * inputs: otmp (the piece of armor)
1856  *         noisy (if TRUE give error messages, otherwise be quiet about it)
1857  * output: mask (otmp's armor type)
1858  */
1859 int
1860 canwearobj(otmp, mask, noisy)
1861 struct obj *otmp;
1862 long *mask;
1863 boolean noisy;
1864 {
1865     int err = 0;
1866     const char *which;
1867 #if 1 /*JP*/
1868     const char *m;
1869     const char *j;
1870 #endif
1871
1872     /* this is the same check as for 'W' (dowear), but different message,
1873        in case we get here via 'P' (doputon) */
1874     if (verysmall(youmonst.data) || nohands(youmonst.data)) {
1875         if (noisy)
1876             You("can't wear any armor in your current form.");
1877         return 0;
1878     }
1879
1880     which = is_cloak(otmp)
1881                 ? c_cloak
1882                 : is_shirt(otmp)
1883                     ? c_shirt
1884                     : is_suit(otmp)
1885                         ? c_suit
1886                         : 0;
1887     if (which && cantweararm(youmonst.data)
1888         /* same exception for cloaks as used in m_dowear() */
1889         && (which != c_cloak || youmonst.data->msize != MZ_SMALL)
1890         && (racial_exception(&youmonst, otmp) < 1)) {
1891         if (noisy)
1892 /*JP
1893             pline_The("%s will not fit on your body.", which);
1894 */
1895             pline("%s\82Í\82 \82È\82½\82Ì\91Ì\82É\8d\87\82í\82È\82¢\81D", which);
1896         return 0;
1897     } else if (otmp->owornmask & W_ARMOR) {
1898         if (noisy)
1899 #if 0 /*JP*/
1900             already_wearing(c_that_);
1901 #else
1902             already_wearing(c_that_, otmp);
1903 #endif
1904         return 0;
1905     }
1906
1907     if (welded(uwep) && bimanual(uwep) && (is_suit(otmp) || is_shirt(otmp))) {
1908         if (noisy)
1909 /*JP
1910             You("cannot do that while holding your %s.",
1911 */
1912             pline("%s\82ð\8e\9d\82Á\82½\82Ü\82Ü\82Å\82Í\82»\82ê\82Í\8fo\97\88\82È\82¢\81D",
1913                 is_sword(uwep) ? c_sword : c_weapon);
1914         return 0;
1915     }
1916
1917     if (is_helmet(otmp)) {
1918         if (uarmh) {
1919             if (noisy)
1920 #if 0 /*JP*/
1921                 already_wearing(an(helm_simple_name(uarmh)));
1922 #else
1923                 already_wearing(helm_simple_name(uarmh), uarmh);
1924 #endif
1925             err++;
1926         } else if (Upolyd && has_horns(youmonst.data) && !is_flimsy(otmp)) {
1927             /* (flimsy exception matches polyself handling) */
1928             if (noisy)
1929 #if 0 /*JP*/
1930                 pline_The("%s won't fit over your horn%s.",
1931                           helm_simple_name(otmp),
1932                           plur(num_horns(youmonst.data)));
1933 #else
1934                 pline("\8ap\82ª\82\82á\82Ü\82Å%s\82ð\90g\82É\82Â\82¯\82ç\82ê\82È\82¢\81D",
1935                       helm_simple_name(otmp));
1936 #endif
1937             err++;
1938         } else
1939             *mask = W_ARMH;
1940     } else if (is_shield(otmp)) {
1941         if (uarms) {
1942             if (noisy)
1943 #if 0 /*JP*/
1944                 already_wearing(an(c_shield));
1945 #else
1946                 already_wearing(c_shield, uarms);
1947 #endif
1948             err++;
1949         } else if (uwep && bimanual(uwep)) {
1950             if (noisy)
1951 #if 0 /*JP*/
1952                 You("cannot wear a shield while wielding a two-handed %s.",
1953                     is_sword(uwep) ? c_sword : (uwep->otyp == BATTLE_AXE)
1954                                                    ? c_axe
1955                                                    : c_weapon);
1956 #else
1957                 {
1958                     m = jconj(jonmsg(uwep, &j), "\82Ä\82¢\82é");
1959                     You("\97¼\8eè\8e\9d\82¿\82Ì%s%s%s\82Ì\82Å\8f\82\82Å\90g\82ð\8eç\82ê\82È\82¢\81D",
1960                         is_sword(uwep) ? c_sword :
1961                         uwep->otyp == BATTLE_AXE ? c_axe : c_weapon,
1962                         j, m);
1963                 }
1964 #endif
1965             err++;
1966         } else if (u.twoweap) {
1967             if (noisy)
1968 /*JP
1969                 You("cannot wear a shield while wielding two weapons.");
1970 */
1971                 You("\93ñ\93\81\97¬\82ð\82µ\82Ä\82¢\82é\82Ì\82Å\8f\82\82Å\90g\82ð\8eç\82ê\82È\82¢\81D");
1972             err++;
1973         } else
1974             *mask = W_ARMS;
1975     } else if (is_boots(otmp)) {
1976         if (uarmf) {
1977             if (noisy)
1978 #if 0 /*JP*/
1979                 already_wearing(c_boots);
1980 #else
1981                 already_wearing(c_boots, uarmf);
1982 #endif
1983             err++;
1984         } else if (Upolyd && slithy(youmonst.data)) {
1985             if (noisy)
1986 #if 0 /*JP*/
1987                 You("have no feet..."); /* not body_part(FOOT) */
1988 #else
1989                 You("\91«\82ª\82È\82¢\81D\81D\81D");  /* not body_part(FOOT) */
1990 #endif
1991             err++;
1992         } else if (Upolyd && youmonst.data->mlet == S_CENTAUR) {
1993             /* break_armor() pushes boots off for centaurs,
1994                so don't let dowear() put them back on... */
1995             if (noisy)
1996 #if 0 /*JP*/
1997                 pline("You have too many hooves to wear %s.",
1998                       c_boots); /* makeplural(body_part(FOOT)) yields
1999                                    "rear hooves" which sounds odd */
2000 #else
2001                 pline("%s\82ð\97\9a\82­\82É\82Í\91«\82ª\91½\82·\82¬\82é\81D", c_boots);
2002 #endif
2003             err++;
2004         } else if (u.utrap
2005                    && (u.utraptype == TT_BEARTRAP || u.utraptype == TT_INFLOOR
2006                        || u.utraptype == TT_LAVA
2007                        || u.utraptype == TT_BURIEDBALL)) {
2008             if (u.utraptype == TT_BEARTRAP) {
2009                 if (noisy)
2010 /*JP
2011                     Your("%s is trapped!", body_part(FOOT));
2012 */
2013                     Your("%s\82Íã©\82É\82©\82©\82Á\82Ä\82¢\82é\81I", body_part(FOOT));
2014             } else if (u.utraptype == TT_INFLOOR || u.utraptype == TT_LAVA) {
2015                 if (noisy)
2016 #if 0 /*JP*/
2017                     Your("%s are stuck in the %s!",
2018                          makeplural(body_part(FOOT)), surface(u.ux, u.uy));
2019 #else
2020                     Your("%s\82Í%s\82É\82Í\82Ü\82Á\82Ä\82¢\82é\81I",
2021                          body_part(FOOT), surface(u.ux, u.uy));
2022 #endif
2023             } else { /*TT_BURIEDBALL*/
2024                 if (noisy)
2025 #if 0 /*JP*/
2026                     Your("%s is attached to the buried ball!",
2027                          body_part(LEG));
2028 #else
2029                     Your("%s\82Í\96\84\82Ü\82Á\82Ä\82¢\82é\8b\85\82É\82Â\82È\82ª\82Á\82Ä\82¢\82é\81I",
2030                          body_part(LEG));
2031 #endif
2032             }
2033             err++;
2034         } else
2035             *mask = W_ARMF;
2036     } else if (is_gloves(otmp)) {
2037         if (uarmg) {
2038             if (noisy)
2039 #if 0 /*JP*/
2040                 already_wearing(c_gloves);
2041 #else
2042                 already_wearing(c_gloves, uarmg);
2043 #endif
2044             err++;
2045         } else if (welded(uwep)) {
2046             if (noisy)
2047 /*JP
2048                 You("cannot wear gloves over your %s.",
2049 */
2050                 You("%s\82Ì\8fã\82©\82ç\8f¬\8eè\82ð\91\95\94õ\82Å\82«\82È\82¢\81D",
2051                     is_sword(uwep) ? c_sword : c_weapon);
2052             err++;
2053         } else
2054             *mask = W_ARMG;
2055     } else if (is_shirt(otmp)) {
2056         if (uarm || uarmc || uarmu) {
2057             if (uarmu) {
2058                 if (noisy)
2059 #if 0 /*JP*/
2060                     already_wearing(an(c_shirt));
2061 #else
2062                     already_wearing(c_shirt, uarmu);
2063 #endif
2064             } else {
2065                 if (noisy)
2066 /*JP
2067                     You_cant("wear that over your %s.",
2068 */
2069                     You("%s\82Ì\8fã\82©\82ç\92\85\82é\82±\82Æ\82Í\82Å\82«\82È\82¢\81D",
2070                              (uarm && !uarmc) ? c_armor
2071                                               : cloak_simple_name(uarmc));
2072             }
2073             err++;
2074         } else
2075             *mask = W_ARMU;
2076     } else if (is_cloak(otmp)) {
2077         if (uarmc) {
2078             if (noisy)
2079 /*JP
2080                 already_wearing(an(cloak_simple_name(uarmc)));
2081 */
2082                 already_wearing(cloak_simple_name(uarmc), otmp);
2083             err++;
2084         } else
2085             *mask = W_ARMC;
2086     } else if (is_suit(otmp)) {
2087         if (uarmc) {
2088             if (noisy)
2089 /*JP
2090                 You("cannot wear armor over a %s.", cloak_simple_name(uarmc));
2091 */
2092                 You("%s\82Ì\8fã\82©\82ç\92\85\82é\82±\82Æ\82Í\82Å\82«\82È\82¢\81D", cloak_simple_name(uarmc));
2093             err++;
2094         } else if (uarm) {
2095             if (noisy)
2096 /*JP
2097                 already_wearing("some armor");
2098 */
2099                 already_wearing("\8aZ", uarm);
2100             err++;
2101         } else
2102             *mask = W_ARM;
2103     } else {
2104         /* getobj can't do this after setting its allow_all flag; that
2105            happens if you have armor for slots that are covered up or
2106            extra armor for slots that are filled */
2107         if (noisy)
2108 /*JP
2109             silly_thing("wear", otmp);
2110 */
2111             silly_thing("\90g\82É\82Â\82¯\82é", otmp);
2112         err++;
2113     }
2114     /* Unnecessary since now only weapons and special items like pick-axes get
2115      * welded to your hand, not armor
2116         if (welded(otmp)) {
2117             if (!err++) {
2118                 if (noisy) weldmsg(otmp);
2119             }
2120         }
2121      */
2122     return !err;
2123 }
2124
2125 STATIC_OVL int
2126 accessory_or_armor_on(obj)
2127 struct obj *obj;
2128 {
2129     long mask = 0L;
2130     boolean armor, ring, eyewear;
2131
2132     if (obj->owornmask & (W_ACCESSORY | W_ARMOR)) {
2133 #if 0 /*JP*/
2134         already_wearing(c_that_);
2135 #else
2136         already_wearing(c_that_, obj);
2137 #endif
2138         return 0;
2139     }
2140     armor = (obj->oclass == ARMOR_CLASS);
2141     ring = (obj->oclass == RING_CLASS || obj->otyp == MEAT_RING);
2142     eyewear = (obj->otyp == BLINDFOLD || obj->otyp == TOWEL
2143                || obj->otyp == LENSES);
2144     /* checks which are performed prior to actually touching the item */
2145     if (armor) {
2146         if (!canwearobj(obj, &mask, TRUE))
2147             return 0;
2148
2149         if (obj->otyp == HELM_OF_OPPOSITE_ALIGNMENT
2150             && qstart_level.dnum == u.uz.dnum) { /* in quest */
2151             if (u.ualignbase[A_CURRENT] == u.ualignbase[A_ORIGINAL])
2152 /*JP
2153                 You("narrowly avoid losing all chance at your goal.");
2154 */
2155                 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");
2156             else /* converted */
2157 /*JP
2158                 You("are suddenly overcome with shame and change your mind.");
2159 */
2160                 You("\93Ë\91R\92p\82¸\82©\82µ\82­\82È\82Á\82Ä\8dl\82¦\82ð\95Ï\82¦\82½\81D");
2161             u.ublessed = 0; /* lose your god's protection */
2162             makeknown(obj->otyp);
2163             context.botl = 1; /*for AC after zeroing u.ublessed */
2164             return 1;
2165         }
2166     } else {
2167         /* accessory */
2168         if (ring) {
2169             char answer, qbuf[QBUFSZ];
2170             int res = 0;
2171
2172             if (nolimbs(youmonst.data)) {
2173 /*JP
2174                 You("cannot make the ring stick to your body.");
2175 */
2176                 You("\8ew\97Ö\82ð\82Í\82ß\82ç\82ê\82È\82¢\91Ì\82¾\81D");
2177                 return 0;
2178             }
2179             if (uleft && uright) {
2180 #if 0 /*JP*/
2181                 There("are no more %s%s to fill.",
2182                       humanoid(youmonst.data) ? "ring-" : "",
2183                       makeplural(body_part(FINGER)));
2184 #else
2185                 pline("\82Í\82ß\82é\82±\82Æ\82Ì\82Å\82«\82é%s%s\82ª\82È\82¢\81D",
2186                       humanoid(youmonst.data) ? "\96ò" : "",
2187                       body_part(FINGER));
2188 #endif
2189                 return 0;
2190             }
2191             if (uleft) {
2192                 mask = RIGHT_RING;
2193             } else if (uright) {
2194                 mask = LEFT_RING;
2195             } else {
2196                 do {
2197 #if 0 /*JP*/
2198                     Sprintf(qbuf, "Which %s%s, Right or Left?",
2199                             humanoid(youmonst.data) ? "ring-" : "",
2200                             body_part(FINGER));
2201 #else
2202                     Sprintf(qbuf, "\82Ç\82¿\82ç\82Ì%s%s\81C\89E(r)\82»\82ê\82Æ\82à\8d¶(l)\81H",
2203                             humanoid(youmonst.data) ? "\96ò" : "",
2204                             body_part(FINGER));
2205 #endif
2206                     answer = yn_function(qbuf, "rl", '\0');
2207                     switch (answer) {
2208                     case '\0':
2209                         return 0;
2210                     case 'l':
2211                     case 'L':
2212                         mask = LEFT_RING;
2213                         break;
2214                     case 'r':
2215                     case 'R':
2216                         mask = RIGHT_RING;
2217                         break;
2218                     }
2219                 } while (!mask);
2220             }
2221             if (uarmg && uarmg->cursed) {
2222                 res = !uarmg->bknown;
2223                 uarmg->bknown = 1;
2224 /*JP
2225                 You("cannot remove your gloves to put on the ring.");
2226 */
2227                 You("\8ew\97Ö\82ð\82Í\82ß\82æ\82¤\82Æ\82µ\82½\82ª\8f¬\8eè\82ª\92E\82°\82È\82¢\81D");
2228                 return res; /* uses move iff we learned gloves are cursed */
2229             }
2230             if (uwep) {
2231                 res = !uwep->bknown; /* check this before calling welded() */
2232                 if ((mask == RIGHT_RING || bimanual(uwep)) && welded(uwep)) {
2233                     const char *hand = body_part(HAND);
2234
2235                     /* welded will set bknown */
2236                     if (bimanual(uwep))
2237                         hand = makeplural(hand);
2238 /*JP
2239                     You("cannot free your weapon %s to put on the ring.",
2240 */
2241                     You("\8ew\97Ö\82ð\82Í\82ß\82æ\82¤\82Æ\82µ\82½\82ª\97\98%s\82Ì\8e©\97R\82ª\82«\82©\82È\82¢\81D",
2242                         hand);
2243                     return res; /* uses move iff we learned weapon is cursed */
2244                 }
2245             }
2246         } else if (obj->oclass == AMULET_CLASS) {
2247             if (uamul) {
2248 #if 0 /*JP*/
2249                 already_wearing("an amulet");
2250 #else
2251                 already_wearing("\96\82\8f\9c\82¯", uamul);
2252 #endif
2253                 return 0;
2254             }
2255         } else if (eyewear) {
2256             if (ublindf) {
2257                 if (ublindf->otyp == TOWEL)
2258 #if 0 /*JP:T*/
2259                     Your("%s is already covered by a towel.",
2260                          body_part(FACE));
2261 #else
2262                     You("\8aù\82É\83^\83I\83\8b\82ð\90g\82É\82Â\82¯\82Ä\82¢\82é\81D");
2263 #endif
2264                 else if (ublindf->otyp == BLINDFOLD) {
2265                     if (obj->otyp == LENSES)
2266 /*JP
2267                         already_wearing2("lenses", "a blindfold");
2268 */
2269                         already_wearing2("\83\8c\83\93\83Y", "\96Ú\89B\82µ");
2270                     else
2271 #if 0 /*JP*/
2272                         already_wearing("a blindfold");
2273 #else
2274                         already_wearing("\96Ú\89B\82µ", ublindf);
2275 #endif
2276                 } else if (ublindf->otyp == LENSES) {
2277                     if (obj->otyp == BLINDFOLD)
2278 /*JP
2279                         already_wearing2("a blindfold", "some lenses");
2280 */
2281                         already_wearing2("\96Ú\89B\82µ", "\83\8c\83\93\83Y");
2282                     else
2283 #if 0 /*JP*/
2284                         already_wearing("some lenses");
2285 #else
2286                         already_wearing("\83\8c\83\93\83Y", ublindf);
2287 #endif
2288                 } else {
2289 #if 0 /*JP*/
2290                     already_wearing(something); /* ??? */
2291 #else
2292                     already_wearing("\89½\82©", ublindf); /* ??? */
2293 #endif
2294                 }
2295                 return 0;
2296             }
2297         } else {
2298             /* neither armor nor accessory */
2299 /*JP
2300             You_cant("wear that!");
2301 */
2302             You_cant("\82»\82ê\82ð\90g\82É\82Â\82¯\82ç\82ê\82È\82¢\81I");
2303             return 0;
2304         }
2305     }
2306
2307     if (!retouch_object(&obj, FALSE))
2308         return 1; /* costs a turn even though it didn't get worn */
2309
2310     if (armor) {
2311         int delay;
2312
2313         obj->known = 1; /* since AC is shown on the status line */
2314         /* if the armor is wielded, release it for wearing */
2315         if (obj->owornmask & W_WEAPON)
2316             remove_worn_item(obj, FALSE);
2317         setworn(obj, mask);
2318         delay = -objects[obj->otyp].oc_delay;
2319         if (delay) {
2320             nomul(delay);
2321 /*JP
2322             multi_reason = "dressing up";
2323 */
2324             multi_reason = "\91\95\94õ\82µ\82Ä\82¢\82é\8e\9e\82É";
2325             if (is_boots(obj))
2326                 afternmv = Boots_on;
2327             if (is_helmet(obj))
2328                 afternmv = Helmet_on;
2329             if (is_gloves(obj))
2330                 afternmv = Gloves_on;
2331             if (obj == uarm)
2332                 afternmv = Armor_on;
2333 /*JP
2334             nomovemsg = "You finish your dressing maneuver.";
2335 */
2336             nomovemsg = "\91\95\94õ\82µ\8fI\82¦\82½\81D";
2337         } else {
2338             if (is_cloak(obj))
2339                 (void) Cloak_on();
2340             if (is_shield(obj))
2341                 (void) Shield_on();
2342             if (is_shirt(obj))
2343                 (void) Shirt_on();
2344             on_msg(obj);
2345         }
2346         context.takeoff.mask = context.takeoff.what = 0L;
2347     } else { /* not armor */
2348         boolean give_feedback = FALSE;
2349
2350         /* [releasing wielded accessory handled in Xxx_on()] */
2351         if (ring) {
2352             setworn(obj, mask);
2353             Ring_on(obj);
2354             give_feedback = TRUE;
2355         } else if (obj->oclass == AMULET_CLASS) {
2356             setworn(obj, W_AMUL);
2357             Amulet_on();
2358             /* no feedback here if amulet of change got used up */
2359             give_feedback = (uamul != 0);
2360         } else if (eyewear) {
2361             /* setworn() handled by Blindf_on() */
2362             Blindf_on(obj);
2363             /* message handled by Blindf_on(); leave give_feedback False */
2364         }
2365         /* feedback for ring or for amulet other than 'change' */
2366         if (give_feedback && is_worn(obj))
2367             prinv((char *) 0, obj, 0L);
2368     }
2369     return 1;
2370 }
2371
2372 /* the 'W' command */
2373 int
2374 dowear()
2375 {
2376     struct obj *otmp;
2377
2378     /* cantweararm() checks for suits of armor, not what we want here;
2379        verysmall() or nohands() checks for shields, gloves, etc... */
2380     if (verysmall(youmonst.data) || nohands(youmonst.data)) {
2381 /*JP
2382         pline("Don't even bother.");
2383 */
2384         pline("\82»\82ñ\82È\82Â\82Ü\82ç\82È\82¢\82±\82Æ\82É\82±\82¾\82í\82é\82È\81D");
2385         return 0;
2386     }
2387     if (uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf
2388         && uleft && uright && uamul && ublindf) {
2389         /* 'W' message doesn't mention accessories */
2390 /*JP
2391         You("are already wearing a full complement of armor.");
2392 */
2393         You("\82·\82Å\82É\8a®\91S\91\95\94õ\82µ\82Ä\82¢\82é\81D");
2394         return 0;
2395     }
2396     otmp = getobj(clothes, "wear");
2397     return otmp ? accessory_or_armor_on(otmp) : 0;
2398 }
2399
2400 /* the 'P' command */
2401 int
2402 doputon()
2403 {
2404     struct obj *otmp;
2405
2406     if (uleft && uright && uamul && ublindf
2407         && uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf) {
2408         /* 'P' message doesn't mention armor */
2409 #if 0 /*JP*/
2410         Your("%s%s are full, and you're already wearing an amulet and %s.",
2411              humanoid(youmonst.data) ? "ring-" : "",
2412              makeplural(body_part(FINGER)),
2413              (ublindf->otyp == LENSES) ? "some lenses" : "a blindfold");
2414 #else
2415         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",
2416              humanoid(youmonst.data) ? "\96ò" : "",
2417              body_part(FINGER),
2418              ublindf->otyp==LENSES ? "\83\8c\83\93\83Y" : "\96Ú\89B\82µ");
2419 #endif
2420         return 0;
2421     }
2422     otmp = getobj(accessories, "put on");
2423     return otmp ? accessory_or_armor_on(otmp) : 0;
2424 }
2425
2426 /* calculate current armor class */
2427 void
2428 find_ac()
2429 {
2430     int uac = mons[u.umonnum].ac; /* base armor class for current form */
2431
2432     /* armor class from worn gear */
2433     if (uarm)
2434         uac -= ARM_BONUS(uarm);
2435     if (uarmc)
2436         uac -= ARM_BONUS(uarmc);
2437     if (uarmh)
2438         uac -= ARM_BONUS(uarmh);
2439     if (uarmf)
2440         uac -= ARM_BONUS(uarmf);
2441     if (uarms)
2442         uac -= ARM_BONUS(uarms);
2443     if (uarmg)
2444         uac -= ARM_BONUS(uarmg);
2445     if (uarmu)
2446         uac -= ARM_BONUS(uarmu);
2447     if (uleft && uleft->otyp == RIN_PROTECTION)
2448         uac -= uleft->spe;
2449     if (uright && uright->otyp == RIN_PROTECTION)
2450         uac -= uright->spe;
2451
2452     /* armor class from other sources */
2453     if (HProtection & INTRINSIC)
2454         uac -= u.ublessed;
2455     uac -= u.uspellprot;
2456
2457     /* [The magic binary numbers 127 and -128 should be replaced with the
2458      * mystic decimal numbers 99 and -99 which require no explanation to
2459      * the uninitiated and would cap the width of a status line value at
2460      * one less character.]
2461      */
2462     if (uac < -128)
2463         uac = -128; /* u.uac is an schar */
2464     else if (uac > 127)
2465         uac = 127; /* for completeness */
2466
2467     if (uac != u.uac) {
2468         u.uac = uac;
2469         context.botl = 1;
2470     }
2471 }
2472
2473 void
2474 glibr()
2475 {
2476     register struct obj *otmp;
2477     int xfl = 0;
2478     boolean leftfall, rightfall, wastwoweap = FALSE;
2479     const char *otherwep = 0, *thiswep, *which, *hand;
2480
2481     leftfall = (uleft && !uleft->cursed
2482                 && (!uwep || !welded(uwep) || !bimanual(uwep)));
2483     rightfall = (uright && !uright->cursed && (!welded(uwep)));
2484     if (!uarmg && (leftfall || rightfall) && !nolimbs(youmonst.data)) {
2485         /* changed so cursed rings don't fall off, GAN 10/30/86 */
2486 #if 0 /*JP*/
2487         Your("%s off your %s.",
2488              (leftfall && rightfall) ? "rings slip" : "ring slips",
2489              (leftfall && rightfall) ? makeplural(body_part(FINGER))
2490                                      : body_part(FINGER));
2491 #else
2492         Your("\8ew\97Ö\82Í%s\82©\82ç\8a\8a\82è\97\8e\82¿\82½\81D", body_part(FINGER));
2493 #endif
2494         xfl++;
2495         if (leftfall) {
2496             otmp = uleft;
2497             Ring_off(uleft);
2498             dropx(otmp);
2499         }
2500         if (rightfall) {
2501             otmp = uright;
2502             Ring_off(uright);
2503             dropx(otmp);
2504         }
2505     }
2506
2507     otmp = uswapwep;
2508     if (u.twoweap && otmp) {
2509         /* secondary weapon doesn't need nearly as much handling as
2510            primary; when in two-weapon mode, we know it's one-handed
2511            with something else in the other hand and also that it's
2512            a weapon or weptool rather than something unusual, plus
2513            we don't need to compare its type with the primary */
2514         otherwep = is_sword(otmp) ? c_sword : weapon_descr(otmp);
2515         if (otmp->quan > 1L)
2516             otherwep = makeplural(otherwep);
2517         hand = body_part(HAND);
2518         which = "left ";
2519 #if 0 /*JP*/
2520         Your("%s %s%s from your %s%s.", otherwep, xfl ? "also " : "",
2521              otense(otmp, "slip"), which, hand);
2522 #else
2523         You("%s%s%s\82©\82ç\8a\8a\82è\97\8e\82Æ\82µ\82½\81D", otherwep, xfl ? "\82à\82Ü\82½" : "\82ð",
2524             body_part(HAND));
2525 #endif
2526         xfl++;
2527         wastwoweap = TRUE;
2528         setuswapwep((struct obj *) 0); /* clears u.twoweap */
2529         if (canletgo(otmp, ""))
2530             dropx(otmp);
2531     }
2532     otmp = uwep;
2533     if (otmp && !welded(otmp)) {
2534         long savequan = otmp->quan;
2535
2536         /* nice wording if both weapons are the same type */
2537         thiswep = is_sword(otmp) ? c_sword : weapon_descr(otmp);
2538         if (otherwep && strcmp(thiswep, makesingular(otherwep)))
2539             otherwep = 0;
2540         if (otmp->quan > 1L) {
2541             /* most class names for unconventional wielded items
2542                are ok, but if wielding multiple apples or rations
2543                we don't want "your foods slip", so force non-corpse
2544                food to be singular; skipping makeplural() isn't
2545                enough--we need to fool otense() too */
2546             if (!strcmp(thiswep, "food"))
2547                 otmp->quan = 1L;
2548             else
2549                 thiswep = makeplural(thiswep);
2550         }
2551         hand = body_part(HAND);
2552         which = "";
2553         if (bimanual(otmp))
2554             hand = makeplural(hand);
2555         else if (wastwoweap)
2556             which = "right "; /* preceding msg was about left */
2557 #if 0 /*JP*/
2558         pline("%s %s%s %s%s from your %s%s.",
2559               !strncmp(thiswep, "corpse", 6) ? "The" : "Your",
2560               otherwep ? "other " : "", thiswep, xfl ? "also " : "",
2561               otense(otmp, "slip"), which, hand);
2562 #else
2563         You("%s%s%s%s\82©\82ç\8a\8a\82è\97\8e\82Æ\82µ\82½\81D",
2564             otherwep ? "\82à\82¤\82Ð\82Æ\82Â\82Ì" : "", thiswep,
2565             xfl ? "\82à\82Ü\82½" : "\82ð",
2566             body_part(HAND));
2567 #endif
2568         /* xfl++; */
2569         otmp->quan = savequan;
2570         setuwep((struct obj *) 0);
2571         if (canletgo(otmp, ""))
2572             dropx(otmp);
2573     }
2574 }
2575
2576 struct obj *
2577 some_armor(victim)
2578 struct monst *victim;
2579 {
2580     register struct obj *otmph, *otmp;
2581
2582     otmph = (victim == &youmonst) ? uarmc : which_armor(victim, W_ARMC);
2583     if (!otmph)
2584         otmph = (victim == &youmonst) ? uarm : which_armor(victim, W_ARM);
2585     if (!otmph)
2586         otmph = (victim == &youmonst) ? uarmu : which_armor(victim, W_ARMU);
2587
2588     otmp = (victim == &youmonst) ? uarmh : which_armor(victim, W_ARMH);
2589     if (otmp && (!otmph || !rn2(4)))
2590         otmph = otmp;
2591     otmp = (victim == &youmonst) ? uarmg : which_armor(victim, W_ARMG);
2592     if (otmp && (!otmph || !rn2(4)))
2593         otmph = otmp;
2594     otmp = (victim == &youmonst) ? uarmf : which_armor(victim, W_ARMF);
2595     if (otmp && (!otmph || !rn2(4)))
2596         otmph = otmp;
2597     otmp = (victim == &youmonst) ? uarms : which_armor(victim, W_ARMS);
2598     if (otmp && (!otmph || !rn2(4)))
2599         otmph = otmp;
2600     return otmph;
2601 }
2602
2603 /* used for praying to check and fix levitation trouble */
2604 struct obj *
2605 stuck_ring(ring, otyp)
2606 struct obj *ring;
2607 int otyp;
2608 {
2609     if (ring != uleft && ring != uright) {
2610         impossible("stuck_ring: neither left nor right?");
2611         return (struct obj *) 0;
2612     }
2613
2614     if (ring && ring->otyp == otyp) {
2615         /* reasons ring can't be removed match those checked by select_off();
2616            limbless case has extra checks because ordinarily it's temporary */
2617         if (nolimbs(youmonst.data) && uamul
2618             && uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed)
2619             return uamul;
2620         if (welded(uwep) && (ring == uright || bimanual(uwep)))
2621             return uwep;
2622         if (uarmg && uarmg->cursed)
2623             return uarmg;
2624         if (ring->cursed)
2625             return ring;
2626     }
2627     /* either no ring or not right type or nothing prevents its removal */
2628     return (struct obj *) 0;
2629 }
2630
2631 /* also for praying; find worn item that confers "Unchanging" attribute */
2632 struct obj *
2633 unchanger()
2634 {
2635     if (uamul && uamul->otyp == AMULET_OF_UNCHANGING)
2636         return uamul;
2637     return 0;
2638 }
2639
2640 STATIC_PTR
2641 int
2642 select_off(otmp)
2643 register struct obj *otmp;
2644 {
2645     struct obj *why;
2646     char buf[BUFSZ];
2647
2648     if (!otmp)
2649         return 0;
2650     *buf = '\0'; /* lint suppression */
2651
2652     /* special ring checks */
2653     if (otmp == uright || otmp == uleft) {
2654         if (nolimbs(youmonst.data)) {
2655 #if 0 /*JP*/
2656             pline_The("ring is stuck.");
2657 #else
2658             pline("\8ew\97Ö\82Í\91Ì\82É\96\84\82Ü\82Á\82Ä\82µ\82Ü\82Á\82Ä\82¢\82é\81D");
2659 #endif
2660             return 0;
2661         }
2662         why = 0; /* the item which prevents ring removal */
2663         if (welded(uwep) && (otmp == uright || bimanual(uwep))) {
2664 /*JP
2665             Sprintf(buf, "free a weapon %s", body_part(HAND));
2666 */
2667             Sprintf(buf, "\97\98\98r\82Ì\8e©\97R\82ª\82«\82©\82È\82¢");
2668             why = uwep;
2669         } else if (uarmg && uarmg->cursed) {
2670 /*JP
2671             Sprintf(buf, "take off your %s", c_gloves);
2672 */
2673             Sprintf(buf, "%s\82ª\92E\82°\82È\82¢", c_gloves);
2674             why = uarmg;
2675         }
2676         if (why) {
2677 /*JP
2678             You("cannot %s to remove the ring.", buf);
2679 */
2680             You("\8ew\97Ö\82ð\82Í\82¸\82»\82¤\82Æ\82µ\82½\82ª%s\81D", buf);
2681             why->bknown = TRUE;
2682             return 0;
2683         }
2684     }
2685     /* special glove checks */
2686     if (otmp == uarmg) {
2687         if (welded(uwep)) {
2688 #if 0 /*JP*/
2689             You("are unable to take off your %s while wielding that %s.",
2690                 c_gloves, is_sword(uwep) ? c_sword : c_weapon);
2691 #else
2692             You("%s\82ð\8e\9d\82Á\82½\82Ü\82Ü%s\82ð\82Í\82¸\82·\82±\82Æ\82Í\82Å\82«\82È\82¢\81D",
2693                 is_sword(uwep) ? c_sword : c_weapon, c_gloves);
2694 #endif
2695             uwep->bknown = TRUE;
2696             return 0;
2697         } else if (Glib) {
2698 #if 0 /*JP*/
2699             You_cant("take off the slippery %s with your slippery %s.",
2700                      c_gloves, makeplural(body_part(FINGER)));
2701 #else
2702             You_cant("\8a\8a\82è\82â\82·\82¢%s\82ð\8a\8a\82è\82â\82·\82¢%s\82Å\82Í\82¸\82¹\82È\82¢\81D",
2703                      c_gloves, body_part(FINGER));
2704 #endif
2705             return 0;
2706         }
2707     }
2708     /* special boot checks */
2709     if (otmp == uarmf) {
2710         if (u.utrap && u.utraptype == TT_BEARTRAP) {
2711 /*JP
2712             pline_The("bear trap prevents you from pulling your %s out.",
2713 */
2714             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",
2715                       body_part(FOOT));
2716             return 0;
2717         } else if (u.utrap && u.utraptype == TT_INFLOOR) {
2718 /*JP
2719             You("are stuck in the %s, and cannot pull your %s out.",
2720 */
2721             You("%s\82ª%s\82É\82Í\82Ü\82Á\82Ä\82¢\82é\82Ì\82Å\92E\82®\82±\82Æ\82ª\82Å\82«\82È\82¢\81D",
2722                 surface(u.ux, u.uy), makeplural(body_part(FOOT)));
2723             return 0;
2724         }
2725     }
2726     /* special suit and shirt checks */
2727     if (otmp == uarm || otmp == uarmu) {
2728         why = 0; /* the item which prevents disrobing */
2729         if (uarmc && uarmc->cursed) {
2730 /*JP
2731             Sprintf(buf, "remove your %s", cloak_simple_name(uarmc));
2732 */
2733             Sprintf(buf, "%s\82ª\92E\82°\82È\82¢", cloak_simple_name(uarmc));
2734             why = uarmc;
2735         } else if (otmp == uarmu && uarm && uarm->cursed) {
2736 /*JP
2737             Sprintf(buf, "remove your %s", c_suit);
2738 */
2739             Sprintf(buf, "%s\82ª\92E\82°\82È\82¢", c_suit);
2740             why = uarm;
2741         } else if (welded(uwep) && bimanual(uwep)) {
2742 #if 0 /*JP*/
2743             Sprintf(buf, "release your %s",
2744                     is_sword(uwep) ? c_sword : (uwep->otyp == BATTLE_AXE)
2745                                                    ? c_axe
2746                                                    : c_weapon);
2747 #else
2748             Sprintf(buf, "%s\82ª\8eè\95ú\82¹\82È\82¢",
2749                     is_sword(uwep) ? c_sword : (uwep->otyp == BATTLE_AXE)
2750                                                    ? c_axe
2751                                                    : c_weapon);
2752 #endif
2753             why = uwep;
2754         }
2755         if (why) {
2756 /*JP
2757             You("cannot %s to take off %s.", buf, the(xname(otmp)));
2758 */
2759             You("%s\82ð\82Í\82¸\82»\82¤\82Æ\82µ\82½\82ª%s\81D", xname(otmp), buf);
2760             why->bknown = TRUE;
2761             return 0;
2762         }
2763     }
2764     /* basic curse check */
2765     if (otmp == uquiver || (otmp == uswapwep && !u.twoweap)) {
2766         ; /* some items can be removed even when cursed */
2767     } else {
2768         /* otherwise, this is fundamental */
2769         if (cursed(otmp))
2770             return 0;
2771     }
2772
2773     if (otmp == uarm)
2774         context.takeoff.mask |= WORN_ARMOR;
2775     else if (otmp == uarmc)
2776         context.takeoff.mask |= WORN_CLOAK;
2777     else if (otmp == uarmf)
2778         context.takeoff.mask |= WORN_BOOTS;
2779     else if (otmp == uarmg)
2780         context.takeoff.mask |= WORN_GLOVES;
2781     else if (otmp == uarmh)
2782         context.takeoff.mask |= WORN_HELMET;
2783     else if (otmp == uarms)
2784         context.takeoff.mask |= WORN_SHIELD;
2785     else if (otmp == uarmu)
2786         context.takeoff.mask |= WORN_SHIRT;
2787     else if (otmp == uleft)
2788         context.takeoff.mask |= LEFT_RING;
2789     else if (otmp == uright)
2790         context.takeoff.mask |= RIGHT_RING;
2791     else if (otmp == uamul)
2792         context.takeoff.mask |= WORN_AMUL;
2793     else if (otmp == ublindf)
2794         context.takeoff.mask |= WORN_BLINDF;
2795     else if (otmp == uwep)
2796         context.takeoff.mask |= W_WEP;
2797     else if (otmp == uswapwep)
2798         context.takeoff.mask |= W_SWAPWEP;
2799     else if (otmp == uquiver)
2800         context.takeoff.mask |= W_QUIVER;
2801
2802     else
2803         impossible("select_off: %s???", doname(otmp));
2804
2805     return 0;
2806 }
2807
2808 STATIC_OVL struct obj *
2809 do_takeoff()
2810 {
2811     struct obj *otmp = (struct obj *) 0;
2812     struct takeoff_info *doff = &context.takeoff;
2813
2814     context.takeoff.mask |= I_SPECIAL; /* set flag for cancel_doff() */
2815     if (doff->what == W_WEP) {
2816         if (!cursed(uwep)) {
2817             setuwep((struct obj *) 0);
2818 /*JP
2819             You("are empty %s.", body_part(HANDED));
2820 */
2821             You("\89½\82à%s\82É\82µ\82Ä\82¢\82È\82¢\81D", body_part(HAND));
2822             u.twoweap = FALSE;
2823         }
2824     } else if (doff->what == W_SWAPWEP) {
2825         setuswapwep((struct obj *) 0);
2826 /*JP
2827         You("no longer have a second weapon readied.");
2828 */
2829         You("\97\\94õ\82Ì\95\90\8aí\82ð\82¨\82³\82ß\82½\81D");
2830         u.twoweap = FALSE;
2831     } else if (doff->what == W_QUIVER) {
2832         setuqwep((struct obj *) 0);
2833 /*JP
2834         You("no longer have ammunition readied.");
2835 */
2836         You("\8f\80\94õ\82µ\82½\96î\92e\82ð\82¨\82³\82ß\82½\81D");
2837     } else if (doff->what == WORN_ARMOR) {
2838         otmp = uarm;
2839         if (!cursed(otmp))
2840             (void) Armor_off();
2841     } else if (doff->what == WORN_CLOAK) {
2842         otmp = uarmc;
2843         if (!cursed(otmp))
2844             (void) Cloak_off();
2845     } else if (doff->what == WORN_BOOTS) {
2846         otmp = uarmf;
2847         if (!cursed(otmp))
2848             (void) Boots_off();
2849     } else if (doff->what == WORN_GLOVES) {
2850         otmp = uarmg;
2851         if (!cursed(otmp))
2852             (void) Gloves_off();
2853     } else if (doff->what == WORN_HELMET) {
2854         otmp = uarmh;
2855         if (!cursed(otmp))
2856             (void) Helmet_off();
2857     } else if (doff->what == WORN_SHIELD) {
2858         otmp = uarms;
2859         if (!cursed(otmp))
2860             (void) Shield_off();
2861     } else if (doff->what == WORN_SHIRT) {
2862         otmp = uarmu;
2863         if (!cursed(otmp))
2864             (void) Shirt_off();
2865     } else if (doff->what == WORN_AMUL) {
2866         otmp = uamul;
2867         if (!cursed(otmp))
2868             Amulet_off();
2869     } else if (doff->what == LEFT_RING) {
2870         otmp = uleft;
2871         if (!cursed(otmp))
2872             Ring_off(uleft);
2873     } else if (doff->what == RIGHT_RING) {
2874         otmp = uright;
2875         if (!cursed(otmp))
2876             Ring_off(uright);
2877     } else if (doff->what == WORN_BLINDF) {
2878         if (!cursed(ublindf))
2879             Blindf_off(ublindf);
2880     } else {
2881         impossible("do_takeoff: taking off %lx", doff->what);
2882     }
2883     context.takeoff.mask &= ~I_SPECIAL; /* clear cancel_doff() flag */
2884
2885     return otmp;
2886 }
2887
2888 /* occupation callback for 'A' */
2889 STATIC_PTR
2890 int
2891 take_off(VOID_ARGS)
2892 {
2893     register int i;
2894     register struct obj *otmp;
2895     struct takeoff_info *doff = &context.takeoff;
2896
2897     if (doff->what) {
2898         if (doff->delay > 0) {
2899             doff->delay--;
2900             return 1; /* still busy */
2901         }
2902         if ((otmp = do_takeoff()) != 0)
2903             off_msg(otmp);
2904         doff->mask &= ~doff->what;
2905         doff->what = 0L;
2906     }
2907
2908     for (i = 0; takeoff_order[i]; i++)
2909         if (doff->mask & takeoff_order[i]) {
2910             doff->what = takeoff_order[i];
2911             break;
2912         }
2913
2914     otmp = (struct obj *) 0;
2915     doff->delay = 0;
2916
2917     if (doff->what == 0L) {
2918 /*JP
2919         You("finish %s.", doff->disrobing);
2920 */
2921         You("\91\95\94õ\82ð\89ð\82«\82¨\82¦\82½\81D");
2922         return 0;
2923     } else if (doff->what == W_WEP) {
2924         doff->delay = 1;
2925     } else if (doff->what == W_SWAPWEP) {
2926         doff->delay = 1;
2927     } else if (doff->what == W_QUIVER) {
2928         doff->delay = 1;
2929     } else if (doff->what == WORN_ARMOR) {
2930         otmp = uarm;
2931         /* If a cloak is being worn, add the time to take it off and put
2932          * it back on again.  Kludge alert! since that time is 0 for all
2933          * known cloaks, add 1 so that it actually matters...
2934          */
2935         if (uarmc)
2936             doff->delay += 2 * objects[uarmc->otyp].oc_delay + 1;
2937     } else if (doff->what == WORN_CLOAK) {
2938         otmp = uarmc;
2939     } else if (doff->what == WORN_BOOTS) {
2940         otmp = uarmf;
2941     } else if (doff->what == WORN_GLOVES) {
2942         otmp = uarmg;
2943     } else if (doff->what == WORN_HELMET) {
2944         otmp = uarmh;
2945     } else if (doff->what == WORN_SHIELD) {
2946         otmp = uarms;
2947     } else if (doff->what == WORN_SHIRT) {
2948         otmp = uarmu;
2949         /* add the time to take off and put back on armor and/or cloak */
2950         if (uarm)
2951             doff->delay += 2 * objects[uarm->otyp].oc_delay;
2952         if (uarmc)
2953             doff->delay += 2 * objects[uarmc->otyp].oc_delay + 1;
2954     } else if (doff->what == WORN_AMUL) {
2955         doff->delay = 1;
2956     } else if (doff->what == LEFT_RING) {
2957         doff->delay = 1;
2958     } else if (doff->what == RIGHT_RING) {
2959         doff->delay = 1;
2960     } else if (doff->what == WORN_BLINDF) {
2961         /* [this used to be 2, but 'R' (and 'T') only require 1 turn to
2962            remove a blindfold, so 'A' shouldn't have been requiring 2] */
2963         doff->delay = 1;
2964     } else {
2965         impossible("take_off: taking off %lx", doff->what);
2966         return 0; /* force done */
2967     }
2968
2969     if (otmp)
2970         doff->delay += objects[otmp->otyp].oc_delay;
2971
2972     /* Since setting the occupation now starts the counter next move, that
2973      * would always produce a delay 1 too big per item unless we subtract
2974      * 1 here to account for it.
2975      */
2976     if (doff->delay > 0)
2977         doff->delay--;
2978
2979     set_occupation(take_off, doff->disrobing, 0);
2980     return 1; /* get busy */
2981 }
2982
2983 /* clear saved context to avoid inappropriate resumption of interrupted 'A' */
2984 void
2985 reset_remarm()
2986 {
2987     context.takeoff.what = context.takeoff.mask = 0L;
2988     context.takeoff.disrobing[0] = '\0';
2989 }
2990
2991 /* the 'A' command -- remove multiple worn items */
2992 int
2993 doddoremarm()
2994 {
2995     int result = 0;
2996
2997     if (context.takeoff.what || context.takeoff.mask) {
2998 /*JP
2999         You("continue %s.", context.takeoff.disrobing);
3000 */
3001         You("\91\95\94õ\82ð\89ð\82­\82Ì\82ð\8dÄ\8aJ\82µ\82½\81D");
3002 /*JP
3003         set_occupation(take_off, context.takeoff.disrobing, 0);
3004 */
3005         set_occupation(take_off, "\91\95\94õ\82ð\89ð\82­", 0);
3006         return 0;
3007     } else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf && !uleft
3008                && !uright && !wearing_armor()) {
3009 /*JP
3010         You("are not wearing anything.");
3011 */
3012         You("\89½\82à\91\95\94õ\82µ\82Ä\82¢\82È\82¢\81D");
3013         return 0;
3014     }
3015
3016     add_valid_menu_class(0); /* reset */
3017     if (flags.menu_style != MENU_TRADITIONAL
3018         || (result = ggetobj("take off", select_off, 0, FALSE,
3019                              (unsigned *) 0)) < -1)
3020         result = menu_remarm(result);
3021
3022     if (context.takeoff.mask) {
3023 #if 0 /*JP*//*\93ú\96{\8cê\82Å\82Í\8eg\82í\82È\82¢*/
3024         /* default activity for armor and/or accessories,
3025            possibly combined with weapons */
3026         (void) strncpy(context.takeoff.disrobing, "disrobing", CONTEXTVERBSZ);
3027         /* specific activity when handling weapons only */
3028         if (!(context.takeoff.mask & ~W_WEAPON))
3029             (void) strncpy(context.takeoff.disrobing, "disarming",
3030                            CONTEXTVERBSZ);
3031 #endif
3032         (void) take_off();
3033     }
3034     /* The time to perform the command is already completely accounted for
3035      * in take_off(); if we return 1, that would add an extra turn to each
3036      * disrobe.
3037      */
3038     return 0;
3039 }
3040
3041 STATIC_OVL int
3042 menu_remarm(retry)
3043 int retry;
3044 {
3045     int n, i = 0;
3046     menu_item *pick_list;
3047     boolean all_worn_categories = TRUE;
3048
3049     if (retry) {
3050         all_worn_categories = (retry == -2);
3051     } else if (flags.menu_style == MENU_FULL) {
3052         all_worn_categories = FALSE;
3053 /*JP
3054         n = query_category("What type of things do you want to take off?",
3055 */
3056         n = query_category("\82Ç\82Ì\83^\83C\83v\82Ì\95¨\82Ì\91\95\94õ\82ð\89ð\82«\82Ü\82·\82©\81H",
3057                            invent, (WORN_TYPES | ALL_TYPES
3058                                     | UNPAID_TYPES | BUCX_TYPES),
3059                            &pick_list, PICK_ANY);
3060         if (!n)
3061             return 0;
3062         for (i = 0; i < n; i++) {
3063             if (pick_list[i].item.a_int == ALL_TYPES_SELECTED)
3064                 all_worn_categories = TRUE;
3065             else
3066                 add_valid_menu_class(pick_list[i].item.a_int);
3067         }
3068         free((genericptr_t) pick_list);
3069     } else if (flags.menu_style == MENU_COMBINATION) {
3070         unsigned ggofeedback = 0;
3071
3072         i = ggetobj("take off", select_off, 0, TRUE, &ggofeedback);
3073         if (ggofeedback & ALL_FINISHED)
3074             return 0;
3075         all_worn_categories = (i == -2);
3076     }
3077     if (menu_class_present('u')
3078         || menu_class_present('B') || menu_class_present('U')
3079         || menu_class_present('C') || menu_class_present('X'))
3080         all_worn_categories = FALSE;
3081
3082 #if 0 /*JP:T*/
3083     n = query_objlist("What do you want to take off?", &invent,
3084                       (SIGNAL_NOMENU | USE_INVLET | INVORDER_SORT),
3085                       &pick_list, PICK_ANY,
3086                       all_worn_categories ? is_worn : is_worn_by_type);
3087 #else
3088     n = query_objlist("\82Ç\82Ì\91\95\94õ\82ð\89ð\82«\82Ü\82·\82©\81H", &invent,
3089                       (SIGNAL_NOMENU | USE_INVLET | INVORDER_SORT),
3090                       &pick_list, PICK_ANY,
3091                       all_worn_categories ? is_worn : is_worn_by_type);
3092 #endif
3093     if (n > 0) {
3094         for (i = 0; i < n; i++)
3095             (void) select_off(pick_list[i].item.a_obj);
3096         free((genericptr_t) pick_list);
3097     } else if (n < 0 && flags.menu_style != MENU_COMBINATION) {
3098 /*JP
3099         There("is nothing else you can remove or unwield.");
3100 */
3101         pline("\91\95\94õ\82ð\89ð\82¯\82é\82à\82Ì\82Í\89½\82à\82È\82¢\81D");
3102     }
3103     return 0;
3104 }
3105
3106 /* hit by destroy armor scroll/black dragon breath/monster spell */
3107 int
3108 destroy_arm(atmp)
3109 register struct obj *atmp;
3110 {
3111     register struct obj *otmp;
3112 #define DESTROY_ARM(o)                            \
3113     ((otmp = (o)) != 0 && (!atmp || atmp == otmp) \
3114              && (!obj_resists(otmp, 0, 90))       \
3115          ? (otmp->in_use = TRUE)                  \
3116          : FALSE)
3117
3118     if (DESTROY_ARM(uarmc)) {
3119         if (donning(otmp))
3120             cancel_don();
3121 /*JP
3122         Your("%s crumbles and turns to dust!", cloak_simple_name(uarmc));
3123 */
3124         Your("%s\82Í\95²\81X\82É\82È\82Á\82½\81I", cloak_simple_name(uarmc));
3125         (void) Cloak_off();
3126         useup(otmp);
3127     } else if (DESTROY_ARM(uarm)) {
3128         if (donning(otmp))
3129             cancel_don();
3130 /*JP
3131         Your("armor turns to dust and falls to the %s!", surface(u.ux, u.uy));
3132 */
3133         Your("\8aZ\82Í\90o\82Æ\82È\82è%s\82É\97\8e\82¿\82½\81I", surface(u.ux,u.uy));
3134         (void) Armor_gone();
3135         useup(otmp);
3136     } else if (DESTROY_ARM(uarmu)) {
3137         if (donning(otmp))
3138             cancel_don();
3139 /*JP
3140         Your("shirt crumbles into tiny threads and falls apart!");
3141 */
3142         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");
3143         (void) Shirt_off();
3144         useup(otmp);
3145     } else if (DESTROY_ARM(uarmh)) {
3146         if (donning(otmp))
3147             cancel_don();
3148 /*JP
3149         Your("%s turns to dust and is blown away!", helm_simple_name(uarmh));
3150 */
3151         Your("%s\82Í\90o\82Æ\82È\82è\90\81\82«\82Æ\82ñ\82¾\81I", helm_simple_name(uarmh));
3152         (void) Helmet_off();
3153         useup(otmp);
3154     } else if (DESTROY_ARM(uarmg)) {
3155         if (donning(otmp))
3156             cancel_don();
3157 /*JP
3158         Your("gloves vanish!");
3159 */
3160                 Your("\8f¬\8eè\82Í\8fÁ\82¦\82½\81I");
3161         (void) Gloves_off();
3162         useup(otmp);
3163 /*JP
3164         selftouch("You");
3165 */
3166         selftouch("\82»\82Ì\82Æ\82«\82 \82È\82½\82Í");
3167     } else if (DESTROY_ARM(uarmf)) {
3168         if (donning(otmp))
3169             cancel_don();
3170 /*JP
3171         Your("boots disintegrate!");
3172 */
3173         Your("\8cC\82Í\95²\81X\82É\8dÓ\82¯\82½\81I");
3174         (void) Boots_off();
3175         useup(otmp);
3176     } else if (DESTROY_ARM(uarms)) {
3177         if (donning(otmp))
3178             cancel_don();
3179 /*JP
3180         Your("shield crumbles away!");
3181 */
3182         Your("\8f\82\82Í\8dÓ\82¯\8eU\82Á\82½\81I");
3183         (void) Shield_off();
3184         useup(otmp);
3185     } else {
3186         return 0; /* could not destroy anything */
3187     }
3188
3189 #undef DESTROY_ARM
3190     stop_occupation();
3191     return 1;
3192 }
3193
3194 void
3195 adj_abon(otmp, delta)
3196 register struct obj *otmp;
3197 register schar delta;
3198 {
3199     if (uarmg && uarmg == otmp && otmp->otyp == GAUNTLETS_OF_DEXTERITY) {
3200         if (delta) {
3201             makeknown(uarmg->otyp);
3202             ABON(A_DEX) += (delta);
3203         }
3204         context.botl = 1;
3205     }
3206     if (uarmh && uarmh == otmp && otmp->otyp == HELM_OF_BRILLIANCE) {
3207         if (delta) {
3208             makeknown(uarmh->otyp);
3209             ABON(A_INT) += (delta);
3210             ABON(A_WIS) += (delta);
3211         }
3212         context.botl = 1;
3213     }
3214 }
3215
3216 /* decide whether a worn item is covered up by some other worn item,
3217    used for dipping into liquid and applying grease;
3218    some criteria are different than select_off()'s */
3219 boolean
3220 inaccessible_equipment(obj, verb, only_if_known_cursed)
3221 struct obj *obj;
3222 const char *verb; /* "dip" or "grease", or null to avoid messages */
3223 /*JP:\93ú\96{\8cê\82Å\82Í "\82ð\90Z\82·", "\82É\8e\89\82ð\93h\82é", null \82Ì\82¢\82¸\82ê\82©*/
3224 boolean only_if_known_cursed; /* ignore covering unless known to be cursed */
3225 {
3226 #if 0 /*JP*/
3227     static NEARDATA const char need_to_take_off_outer_armor[] =
3228         "need to take off %s to %s %s.";
3229 #else /*JP:\88ø\90\94\82ª\8c´\95\82Æ\95Ï\82í\82Á\82Ä\82¢\82é\82±\82Æ\82É\92\8d\88Ó*/
3230     static NEARDATA const char need_to_take_off_outer_armor[] =
3231         "%s%s\82É\82Í%s\82ð%s\95K\97v\82ª\82 \82é\81D";
3232 #endif
3233     char buf[BUFSZ];
3234     boolean anycovering = !only_if_known_cursed; /* more comprehensible... */
3235 #define BLOCKSACCESS(x) (anycovering || ((x)->cursed && (x)->bknown))
3236
3237     if (!obj || !obj->owornmask)
3238         return FALSE; /* not inaccessible */
3239
3240     /* check for suit covered by cloak */
3241     if (obj == uarm && uarmc && BLOCKSACCESS(uarmc)) {
3242         if (verb) {
3243             Strcpy(buf, yname(uarmc));
3244 #if 0 /*JP*/
3245             You(need_to_take_off_outer_armor, buf, verb, yname(obj));
3246 #else /*JP:\91Î\8fÛ\82Í\83N\83\8d\81[\83N\82È\82Ì\82Åjoffmsg\82ð\8eg\82í\82¸\8c\88\82ß\8c\82\82¿*/
3247             You(need_to_take_off_outer_armor, xname(obj), verb, buf, "\92E\82®");
3248 #endif
3249         }
3250         return TRUE;
3251     }
3252     /* check for shirt covered by suit and/or cloak */
3253     if (obj == uarmu
3254         && ((uarm && BLOCKSACCESS(uarm)) || (uarmc && BLOCKSACCESS(uarmc)))) {
3255         if (verb) {
3256             char cloaktmp[QBUFSZ], suittmp[QBUFSZ];
3257             /* if sameprefix, use yname and xname to get "your cloak and suit"
3258                or "Manlobbi's cloak and suit"; otherwise, use yname and yname
3259                to get "your cloak and Manlobbi's suit" or vice versa */
3260             boolean sameprefix = (uarm && uarmc
3261                                   && !strcmp(shk_your(cloaktmp, uarmc),
3262                                              shk_your(suittmp, uarm)));
3263
3264             *buf = '\0';
3265             if (uarmc)
3266                 Strcat(buf, yname(uarmc));
3267             if (uarm && uarmc)
3268 /*JP
3269                 Strcat(buf, " and ");
3270 */
3271                 Strcat(buf, "\82Æ");
3272             if (uarm)
3273                 Strcat(buf, sameprefix ? xname(uarm) : yname(uarm));
3274 #if 0 /*JP*/
3275             You(need_to_take_off_outer_armor, buf, verb, yname(obj));
3276 #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¿*/
3277             You(need_to_take_off_outer_armor, xname(obj), verb, buf, "\92E\82®");
3278 #endif
3279         }
3280         return TRUE;
3281     }
3282     /* check for ring covered by gloves */
3283     if ((obj == uleft || obj == uright) && uarmg && BLOCKSACCESS(uarmg)) {
3284         if (verb) {
3285             Strcpy(buf, yname(uarmg));
3286 #if 0 /*JP*/
3287             You(need_to_take_off_outer_armor, buf, verb, yname(obj));
3288 #else /*JP:\91Î\8fÛ\82Í\8f¬\8eè\82È\82Ì\82Åjoffmsg\82ð\8eg\82í\82¸\8c\88\82ß\8c\82\82¿*/
3289             You(need_to_take_off_outer_armor, xname(obj), verb, buf, "\82Í\82¸\82·");
3290 #endif
3291         }
3292         return TRUE;
3293     }
3294     /* item is not inaccessible */
3295     return FALSE;
3296 }
3297
3298 /*do_wear.c*/