1 /* NetHack 3.6 do_wear.c $NHDT-Date: 1575214670 2019/12/01 15:37:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */
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. */
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2020 */
9 /* JNetHack may be freely redistributed. See license for details. */
13 #if 0 /*JP*//*
\96¢
\8eg
\97p*/
14 static NEARDATA const char see_yourself[] = "see yourself";
16 static NEARDATA const char unknown_type[] = "Unknown type of %s (%d)";
18 static NEARDATA const char c_armor[] = "armor", c_suit[] = "suit",
19 c_shirt[] = "shirt", c_cloak[] = "cloak",
20 c_gloves[] = "gloves", c_boots[] = "boots",
21 c_helmet[] = "helmet", c_shield[] = "shield",
22 c_weapon[] = "weapon", c_sword[] = "sword",
23 c_axe[] = "axe", c_that_[] = "that";
25 static NEARDATA const char c_armor[] = "
\8aZ", c_suit[] = "
\95\9e",
26 c_shirt[] = "
\83V
\83\83\83c", c_cloak[] = "
\83N
\83\8d\81[
\83N",
27 c_gloves[] = "
\8f¬
\8eè", c_boots[] = "
\8cC",
28 c_helmet[] = "
\8a\95", c_shield[] = "
\8f\82",
29 c_weapon[] = "
\95\90\8aí", c_sword[] = "
\8c\95",
30 c_axe[] = "
\95\80", c_that_[] = "
\82»
\82ê";
33 static NEARDATA const long takeoff_order[] = {
34 WORN_BLINDF, W_WEP, WORN_SHIELD, WORN_GLOVES, LEFT_RING,
35 RIGHT_RING, WORN_CLOAK, WORN_HELMET, WORN_AMUL, WORN_ARMOR,
36 WORN_SHIRT, WORN_BOOTS, W_SWAPWEP, W_QUIVER, 0L
39 STATIC_DCL void FDECL(on_msg, (struct obj *));
40 STATIC_DCL void FDECL(toggle_stealth, (struct obj *, long, BOOLEAN_P));
41 STATIC_DCL void FDECL(toggle_displacement, (struct obj *, long, BOOLEAN_P));
42 STATIC_PTR int NDECL(Armor_on);
43 /* int NDECL(Boots_on); -- moved to extern.h */
44 STATIC_PTR int NDECL(Cloak_on);
45 STATIC_PTR int NDECL(Helmet_on);
46 STATIC_PTR int NDECL(Gloves_on);
47 STATIC_DCL void FDECL(wielding_corpse, (struct obj *, BOOLEAN_P));
48 STATIC_PTR int NDECL(Shield_on);
49 STATIC_PTR int NDECL(Shirt_on);
50 STATIC_DCL void NDECL(Amulet_on);
51 STATIC_DCL void FDECL(learnring, (struct obj *, BOOLEAN_P));
52 STATIC_DCL void FDECL(Ring_off_or_gone, (struct obj *, BOOLEAN_P));
53 STATIC_PTR int FDECL(select_off, (struct obj *));
54 STATIC_DCL struct obj *NDECL(do_takeoff);
55 STATIC_PTR int NDECL(take_off);
56 STATIC_DCL int FDECL(menu_remarm, (int));
57 STATIC_DCL void FDECL(count_worn_stuff, (struct obj **, BOOLEAN_P));
58 STATIC_PTR int FDECL(armor_or_accessory_off, (struct obj *));
59 STATIC_PTR int FDECL(accessory_or_armor_on, (struct obj *));
61 STATIC_DCL void FDECL(already_wearing, (const char *));
63 STATIC_DCL void FDECL(already_wearing, (const char*, struct obj *));
65 STATIC_DCL void FDECL(already_wearing2, (const char *, const char *));
67 /* plural "fingers" or optionally "gloves" */
69 fingers_or_gloves(check_gloves)
72 return ((check_gloves && uarmg)
73 ? gloves_simple_name(uarmg) /* "gloves" or "gauntlets" */
74 : makeplural(body_part(FINGER))); /* "fingers" */
83 You("were wearing %s.", doname(otmp));
87 m = joffmsg(otmp, &j);
89 You("%s%s%s
\81D", doname(otmp), j, jpast(m));
93 /* for items that involve no delay */
101 /* call xname() before obj_is_pname(); formatting obj's name
102 might set obj->dknown and that affects the pname test */
103 const char *otmp_name = xname(otmp);
106 if (otmp->otyp == TOWEL)
107 Sprintf(how, " around your %s", body_part(HEAD));
108 You("are now wearing %s%s.",
109 obj_is_pname(otmp) ? the(otmp_name) : an(otmp_name), how);
113 m = jonmsg(otmp, &j);
114 You("%s%s%s
\81D", xname(otmp), j, jpast(m));
119 /* starting equipment gets auto-worn at beginning of new game,
120 and we don't want stealth or displacement feedback then */
121 static boolean initial_don = FALSE; /* manipulated in set_wear() */
123 /* putting on or taking off an item which confers stealth;
124 give feedback and discover it iff stealth state is changing */
127 toggle_stealth(obj, oldprop, on)
129 long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */
132 if (on ? initial_don : context.takeoff.cancelled_don)
135 if (!oldprop /* extrinsic stealth from something else */
136 && !HStealth /* intrinsic stealth */
137 && !BStealth) { /* stealth blocked by something */
138 if (obj->otyp == RIN_STEALTH)
139 learnring(obj, TRUE);
141 makeknown(obj->otyp);
146 You("move very quietly.");
148 Your("
\90Ã
\82©
\82É
\93®
\82¯
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
\81D");
149 else if (Levitation || Flying)
151 You("float imperceptibly.");
153 You("
\82¢
\82Â
\82Ì
\82Ü
\82É
\82©
\95\82\82¢
\82Ä
\82¢
\82½
\81D");
156 You("walk very quietly.");
158 Your("
\91«
\89¹
\82Í
\8f¬
\82³
\82
\82È
\82Á
\82½
\81D");
161 You("sure are noisy.");
163 Your("
\91«
\89¹
\82Í
\91å
\82«
\82
\82È
\82Á
\82½
\81D");
168 /* putting on or taking off an item which confers displacement;
169 give feedback and discover it iff displacement state is changing *and*
170 hero is able to see self (or sense monsters) */
173 toggle_displacement(obj, oldprop, on)
175 long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */
178 if (on ? initial_don : context.takeoff.cancelled_don)
181 if (!oldprop /* extrinsic displacement from something else */
182 && !(u.uprops[DISPLACED].intrinsic) /* (theoretical) */
183 && !(u.uprops[DISPLACED].blocked) /* (also theoretical) */
184 /* we don't use canseeself() here because it augments vision
185 with touch, which isn't appropriate for deciding whether
186 we'll notice that monsters have trouble spotting the hero */
187 && ((!Blind /* see anything */
188 && !u.uswallow /* see surroundings */
189 && !Invisible) /* see self */
190 /* actively sensing nearby monsters via telepathy or extended
191 monster detection overrides vision considerations because
192 hero also senses self in this situation */
194 || (Blind_telepat && Blind)
195 || Detect_monsters))) {
196 makeknown(obj->otyp);
199 You_feel("that monsters%s have difficulty pinpointing your location.",
200 on ? "" : " no longer");
202 pline("
\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",
203 on ? "
\82ç
\82È
\82" : "
\82é
\82æ
\82¤
\82É");
209 * The Type_on() functions should be called *after* setworn().
210 * The Type_off() functions call setworn() themselves.
211 * [Blindf_on() is an exception and calls setworn() itself.]
218 u.uprops[objects[uarmf->otyp].oc_oprop].extrinsic & ~WORN_BOOTS;
220 switch (uarmf->otyp) {
227 case WATER_WALKING_BOOTS:
230 /* (we don't need a lava check here since boots can't be
231 put on while feet are stuck) */
234 /* Speed boots are still better than intrinsic speed, */
235 /* though not better than potion speed */
236 if (!oldprop && !(HFast & TIMEOUT)) {
237 makeknown(uarmf->otyp);
239 You_feel("yourself speed up%s.",
240 (oldprop || HFast) ? " a bit more" : "");
242 You("%s
\91f
\91\81\82
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D",
243 (oldprop || HFast) ? "
\82³
\82ç
\82É" : "");
248 toggle_stealth(uarmf, oldprop, TRUE);
251 if (!oldprop && !(HFumbling & ~TIMEOUT))
252 incr_itimeout(&HFumbling, rnd(20));
254 case LEVITATION_BOOTS:
255 if (!oldprop && !HLevitation && !(BLevitation & FROMOUTSIDE)) {
256 uarmf->known = 1; /* might come off if putting on over a sink,
257 * so uarmf could be Null below; status line
258 * gets updated during brief interval they're
259 * worn so hero and player learn enchantment */
260 context.botl = 1; /* status hilites might mark AC changed */
261 makeknown(uarmf->otyp);
264 spoteffects(FALSE); /* for sink effect */
266 float_vs_flight(); /* maybe toggle BFlying's I_SPECIAL */
270 impossible(unknown_type, c_boots, uarmf->otyp);
272 if (uarmf) /* could be Null here (levitation boots put on over a sink) */
273 uarmf->known = 1; /* boots' +/- evident because of status line AC */
280 struct obj *otmp = uarmf;
281 int otyp = otmp->otyp;
282 long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_BOOTS;
284 context.takeoff.mask &= ~W_ARMF;
285 /* For levitation, float_down() returns if Levitation, so we
286 * must do a setworn() _before_ the levitation case.
288 setworn((struct obj *) 0, W_ARMF);
291 if (!Very_fast && !context.takeoff.cancelled_don) {
294 You_feel("yourself slow down%s.", Fast ? " a bit" : "");
296 You("%s
\82Ì
\82ë
\82
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D", Fast ? "
\82¿
\82å
\82Á
\82Æ" : "");
299 case WATER_WALKING_BOOTS:
300 /* check for lava since fireproofed boots make it viable */
301 if ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy))
302 && !Levitation && !Flying && !is_clinger(youmonst.data)
303 && !context.takeoff.cancelled_don
304 /* avoid recursive call to lava_effects() */
305 && !iflags.in_lava_effects) {
306 /* make boots known in case you survive the drowning */
312 toggle_stealth(otmp, oldprop, FALSE);
315 if (!oldprop && !(HFumbling & ~TIMEOUT))
316 HFumbling = EFumbling = 0;
318 case LEVITATION_BOOTS:
319 if (!oldprop && !HLevitation && !(BLevitation & FROMOUTSIDE)
320 && !context.takeoff.cancelled_don) {
321 (void) float_down(0L, 0L);
324 float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
334 impossible(unknown_type, c_boots, otyp);
336 context.takeoff.cancelled_don = FALSE;
344 u.uprops[objects[uarmc->otyp].oc_oprop].extrinsic & ~WORN_CLOAK;
346 switch (uarmc->otyp) {
349 case CLOAK_OF_MAGIC_RESISTANCE:
353 case CLOAK_OF_PROTECTION:
354 makeknown(uarmc->otyp);
357 toggle_stealth(uarmc, oldprop, TRUE);
359 case CLOAK_OF_DISPLACEMENT:
360 toggle_displacement(uarmc, oldprop, TRUE);
363 /* Note: it's already being worn, so we have to cheat here. */
364 if ((HInvis || EInvis) && !Blind) {
367 You("can %s!", See_invisible ? "no longer see through yourself"
371 See_invisible ? "
\82 \82È
\82½
\82Í
\93§
\96¾
\82Å
\82È
\82
\82È
\82Á
\82½" :
372 "
\8e©
\95ª
\8e©
\90g
\82ª
\8c©
\82¦
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½");
376 case CLOAK_OF_INVISIBILITY:
377 /* since cloak of invisibility was worn, we know mummy wrapping
378 wasn't, so no need to check `oldprop' against blocked */
379 if (!oldprop && !HInvis && !Blind) {
380 makeknown(uarmc->otyp);
383 pline("Suddenly you can%s yourself.",
384 See_invisible ? " see through" : "not see");
386 pline("
\93Ë
\91R
\81C%s
\82È
\82Á
\82½
\81D",
387 See_invisible ? "
\82 \82È
\82½
\82Í
\93§
\96¾
\82É" : "
\8e©
\95ª
\8e©
\90g
\82ª
\8c©
\82¦
\82È
\82");
393 pline("%s very tightly.", Tobjnam(uarmc, "fit"));
395 pline("%s
\82Í
\82Æ
\82Ä
\82à
\82Ò
\82Á
\82¿
\82è
\8d\87\82¤
\81D",xname(uarmc));
397 /* Alchemy smock gives poison _and_ acid resistance */
399 EAcid_resistance |= WORN_CLOAK;
402 impossible(unknown_type, c_cloak, uarmc->otyp);
404 if (uarmc) /* no known instance of !uarmc here but play it safe */
405 uarmc->known = 1; /* cloak's +/- evident because of status line AC */
412 struct obj *otmp = uarmc;
413 int otyp = otmp->otyp;
414 long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_CLOAK;
416 context.takeoff.mask &= ~W_ARMC;
417 /* For mummy wrapping, taking it off first resets `Invisible'. */
418 setworn((struct obj *) 0, W_ARMC);
422 case CLOAK_OF_PROTECTION:
423 case CLOAK_OF_MAGIC_RESISTANCE:
429 toggle_stealth(otmp, oldprop, FALSE);
431 case CLOAK_OF_DISPLACEMENT:
432 toggle_displacement(otmp, oldprop, FALSE);
435 if (Invis && !Blind) {
438 You("can %s.", See_invisible ? "see through yourself"
439 : "no longer see yourself");
441 pline("%s
\81D", See_invisible ? "
\82 \82È
\82½
\82Í
\93§
\96¾
\82É
\82È
\82Á
\82½"
442 : "
\8e©
\95ª
\8e©
\90g
\82ª
\8c©
\82¦
\82È
\82
\82È
\82Á
\82½");
446 case CLOAK_OF_INVISIBILITY:
447 if (!oldprop && !HInvis && !Blind) {
448 makeknown(CLOAK_OF_INVISIBILITY);
451 pline("Suddenly you can %s.",
452 See_invisible ? "no longer see through yourself"
455 pline("
\93Ë
\91R
\81C%s
\81D",
456 See_invisible ? "
\82 \82È
\82½
\82Í
\93§
\96¾
\82Å
\82È
\82
\82È
\82Á
\82½"
457 : "
\8e©
\95ª
\8e©
\90g
\82ª
\8c©
\82¦
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½");
461 /* Alchemy smock gives poison _and_ acid resistance */
463 EAcid_resistance &= ~WORN_CLOAK;
466 impossible(unknown_type, c_cloak, otyp);
475 switch (uarmh->otyp) {
479 case ELVEN_LEATHER_HELM:
480 case DWARVISH_IRON_HELM:
482 case HELM_OF_TELEPATHY:
484 case HELM_OF_BRILLIANCE:
485 adj_abon(uarmh, uarmh->spe);
488 /* people think marked wizards know what they're talking about,
489 but it takes trained arrogance to pull it off, and the actual
490 enchantment of the hat is irrelevant */
491 ABON(A_CHA) += (Role_if(PM_WIZARD) ? 1 : -1);
493 makeknown(uarmh->otyp);
495 case HELM_OF_OPPOSITE_ALIGNMENT:
496 uarmh->known = 1; /* do this here because uarmh could get cleared */
497 /* changing alignment can toggle off active artifact properties,
498 including levitation; uarmh could get dropped or destroyed here
499 by hero falling onto a polymorph trap or into water (emergency
500 disrobe) or maybe lava (probably not, helm isn't 'organic') */
501 uchangealign((u.ualign.type != A_NEUTRAL)
503 : (uarmh->o_id % 2) ? A_CHAOTIC : A_LAWFUL,
505 /* makeknown(HELM_OF_OPPOSITE_ALIGNMENT); -- below, after Tobjnam() */
508 if (uarmh && !uarmh->cursed) {
511 pline("%s for a moment.", Tobjnam(uarmh, "vibrate"));
513 pline("%s
\82Í
\88ê
\8fu
\90k
\82¦
\82½
\81D", xname(uarmh));
516 pline("%s %s for a moment.", Tobjnam(uarmh, "glow"),
519 pline("%s
\82Í
\88ê
\8fu%s
\8bP
\82¢
\82½
\81D",
520 xname(uarmh), jconj_adj(hcolor(NH_BLACK)));
524 context.botl = 1; /* reveal new alignment or INT & WIS */
527 pline("My brain hurts!"); /* Monty Python's Flying Circus */
529 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Ç*/
531 } else if (uarmh && uarmh->otyp == DUNCE_CAP) {
533 You_feel("%s.", /* track INT change; ignore WIS */
535 <= (ABASE(A_INT) + ABON(A_INT) + ATEMP(A_INT))
536 ? "like sitting in a corner"
539 You("%s
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D",
541 <= (ABASE(A_INT) + ABON(A_INT) + ATEMP(A_INT))
542 ? "
\8b÷
\82Á
\82±
\82É
\8dÀ
\82Á
\82Ä
\82¢
\82é"
543 : "
\96Ú
\82ª
\82Ü
\82í
\82Á
\82½");
546 /* [message formerly given here moved to uchangealign()] */
547 makeknown(HELM_OF_OPPOSITE_ALIGNMENT);
551 impossible(unknown_type, c_helmet, uarmh->otyp);
553 /* uarmh could be Null due to uchangealign() */
555 uarmh->known = 1; /* helmet's +/- evident because of status line AC */
560 Helmet_off(VOID_ARGS)
562 context.takeoff.mask &= ~W_ARMH;
564 switch (uarmh->otyp) {
568 case ELVEN_LEATHER_HELM:
569 case DWARVISH_IRON_HELM:
576 if (!context.takeoff.cancelled_don) {
577 ABON(A_CHA) += (Role_if(PM_WIZARD) ? -1 : 1);
581 case HELM_OF_TELEPATHY:
582 /* need to update ability before calling see_monsters() */
583 setworn((struct obj *) 0, W_ARMH);
586 case HELM_OF_BRILLIANCE:
587 if (!context.takeoff.cancelled_don)
588 adj_abon(uarmh, -uarmh->spe);
590 case HELM_OF_OPPOSITE_ALIGNMENT:
591 /* changing alignment can toggle off active artifact
592 properties, including levitation; uarmh could get
593 dropped or destroyed here */
594 uchangealign(u.ualignbase[A_CURRENT], 2);
597 impossible(unknown_type, c_helmet, uarmh->otyp);
599 setworn((struct obj *) 0, W_ARMH);
600 context.takeoff.cancelled_don = FALSE;
609 u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES;
611 switch (uarmg->otyp) {
614 case GAUNTLETS_OF_FUMBLING:
615 if (!oldprop && !(HFumbling & ~TIMEOUT))
616 incr_itimeout(&HFumbling, rnd(20));
618 case GAUNTLETS_OF_POWER:
619 makeknown(uarmg->otyp);
620 context.botl = 1; /* taken care of in attrib.c */
622 case GAUNTLETS_OF_DEXTERITY:
623 adj_abon(uarmg, uarmg->spe);
626 impossible(unknown_type, c_gloves, uarmg->otyp);
628 if (uarmg) /* no known instance of !uarmg here but play it safe */
629 uarmg->known = 1; /* gloves' +/- evident because of status line AC */
634 wielding_corpse(obj, voluntary)
636 boolean voluntary; /* taking gloves off on purpose? */
640 if (!obj || obj->otyp != CORPSE)
642 if (obj != uwep && (obj != uswapwep || !u.twoweap))
645 if (touch_petrifies(&mons[obj->corpsenm]) && !Stone_resistance) {
647 You("now wield %s in your bare %s.",
648 corpse_xname(obj, (const char *) 0, CXN_ARTICLE),
649 makeplural(body_part(HAND)));
651 You("%s
\82ð
\91f%s
\82Å
\8e\9d\82Á
\82½
\81D",
652 corpse_xname(obj, (const char *) 0, CXN_ARTICLE),
656 Sprintf(kbuf, "%s gloves while wielding %s",
657 voluntary ? "removing" : "losing", killer_xname(obj));
659 Sprintf(kbuf, "%s
\82ð
\8e\9d\82Á
\82Ä
\82¢
\82é
\82Æ
\82«
\82É
\8eè
\91Ü
\82ð%s",
660 killer_xname(obj), voluntary ? "
\8aO
\82µ
\82Ä" : "
\8e¸
\82Á
\82Ä");
663 /* life-saved; can't continue wielding cockatrice corpse though */
664 remove_worn_item(obj, FALSE);
669 Gloves_off(VOID_ARGS)
672 u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES;
673 boolean on_purpose = !context.mon_moving && !uarmg->in_use;
675 context.takeoff.mask &= ~W_ARMG;
677 switch (uarmg->otyp) {
680 case GAUNTLETS_OF_FUMBLING:
681 if (!oldprop && !(HFumbling & ~TIMEOUT))
682 HFumbling = EFumbling = 0;
684 case GAUNTLETS_OF_POWER:
685 makeknown(uarmg->otyp);
686 context.botl = 1; /* taken care of in attrib.c */
688 case GAUNTLETS_OF_DEXTERITY:
689 if (!context.takeoff.cancelled_don)
690 adj_abon(uarmg, -uarmg->spe);
693 impossible(unknown_type, c_gloves, uarmg->otyp);
695 setworn((struct obj *) 0, W_ARMG);
696 context.takeoff.cancelled_don = FALSE;
697 (void) encumber_msg(); /* immediate feedback for GoP */
699 /* usually can't remove gloves when they're slippery but it can
700 be done by having them fall off (polymorph), stolen, or
701 destroyed (scroll, overenchantment, monster spell); if that
702 happens, 'cure' slippery fingers so that it doesn't transfer
703 from gloves to bare hands */
705 make_glib(0); /* for update_inventory() */
707 /* prevent wielding cockatrice when not wearing gloves */
708 if (uwep && uwep->otyp == CORPSE)
709 wielding_corpse(uwep, on_purpose);
711 /* KMH -- ...or your secondary weapon when you're wielding it
712 [This case can't actually happen; twoweapon mode won't
713 engage if a corpse has been set up as the alternate weapon.] */
714 if (u.twoweap && uswapwep && uswapwep->otyp == CORPSE)
715 wielding_corpse(uswapwep, on_purpose);
723 /* no shield currently requires special handling when put on, but we
724 keep this uncommented in case somebody adds a new one which does
725 [reflection is handled by setting u.uprops[REFLECTION].extrinsic
726 in setworn() called by armor_or_accessory_on() before Shield_on()] */
727 switch (uarms->otyp) {
730 case URUK_HAI_SHIELD:
732 case DWARVISH_ROUNDSHIELD:
734 case SHIELD_OF_REFLECTION:
737 impossible(unknown_type, c_shield, uarms->otyp);
739 if (uarms) /* no known instance of !uarmgs here but play it safe */
740 uarms->known = 1; /* shield's +/- evident because of status line AC */
745 Shield_off(VOID_ARGS)
747 context.takeoff.mask &= ~W_ARMS;
749 /* no shield currently requires special handling when taken off, but we
750 keep this uncommented in case somebody adds a new one which does */
751 switch (uarms->otyp) {
754 case URUK_HAI_SHIELD:
756 case DWARVISH_ROUNDSHIELD:
758 case SHIELD_OF_REFLECTION:
761 impossible(unknown_type, c_shield, uarms->otyp);
764 setworn((struct obj *) 0, W_ARMS);
771 /* no shirt currently requires special handling when put on, but we
772 keep this uncommented in case somebody adds a new one which does */
773 switch (uarmu->otyp) {
778 impossible(unknown_type, c_shirt, uarmu->otyp);
780 if (uarmu) /* no known instances of !uarmu here but play it safe */
781 uarmu->known = 1; /* shirt's +/- evident because of status line AC */
788 context.takeoff.mask &= ~W_ARMU;
790 /* no shirt currently requires special handling when taken off, but we
791 keep this uncommented in case somebody adds a new one which does */
792 switch (uarmu->otyp) {
797 impossible(unknown_type, c_shirt, uarmu->otyp);
800 setworn((struct obj *) 0, W_ARMU);
809 * No suits require special handling. Special properties conferred by
810 * suits are set up as intrinsics (actually 'extrinsics') by setworn()
811 * which is called by armor_or_accessory_on() before Armor_on().
813 if (uarm) /* no known instances of !uarm here but play it safe */
814 uarm->known = 1; /* suit's +/- evident because of status line AC */
821 context.takeoff.mask &= ~W_ARM;
822 setworn((struct obj *) 0, W_ARM);
823 context.takeoff.cancelled_don = FALSE;
827 /* The gone functions differ from the off functions in that if you die from
828 * taking it off and have life saving, you still die. [Obsolete reference
829 * to lack of fire resistance being fatal in hell (nethack 3.0) and life
830 * saving putting a removed item back on to prevent that from immediately
836 context.takeoff.mask &= ~W_ARM;
838 context.takeoff.cancelled_don = FALSE;
845 /* make sure amulet isn't wielded; can't use remove_worn_item()
846 here because it has already been set worn in amulet slot */
848 setuwep((struct obj *) 0);
849 else if (uamul == uswapwep)
850 setuswapwep((struct obj *) 0);
851 else if (uamul == uquiver)
852 setuqwep((struct obj *) 0);
854 switch (uamul->otyp) {
856 case AMULET_OF_LIFE_SAVING:
857 case AMULET_VERSUS_POISON:
858 case AMULET_OF_REFLECTION:
859 case AMULET_OF_MAGICAL_BREATHING:
860 case FAKE_AMULET_OF_YENDOR:
862 case AMULET_OF_UNCHANGING:
864 make_slimed(0L, (char *) 0);
866 case AMULET_OF_CHANGE: {
867 int orig_sex = poly_gender();
872 /* Don't use same message as polymorph */
873 if (orig_sex != poly_gender()) {
874 makeknown(AMULET_OF_CHANGE);
876 You("are suddenly very %s!",
877 flags.female ? "feminine" : "masculine");
879 You("
\93Ë
\91R%s
\82Á
\82Û
\82
\82È
\82Á
\82½
\81I",
880 flags.female ? "
\8f\97" : "
\92j");
884 /* already polymorphed into single-gender monster; only
885 changed the character's base sex */
887 You("don't feel like yourself.");
889 You("
\8e©
\95ª
\8e©
\90g
\82¶
\82á
\82È
\82
\82È
\82Á
\82½
\8bC
\82ª
\82µ
\82½
\81D");
891 pline_The("amulet disintegrates!");
893 pline("
\96\82\8f\9c\82¯
\82Í
\82±
\82È
\82²
\82È
\82É
\82È
\82Á
\82½
\81I");
894 if (orig_sex == poly_gender() && uamul->dknown
895 && !objects[AMULET_OF_CHANGE].oc_name_known
896 && !objects[AMULET_OF_CHANGE].oc_uname)
901 case AMULET_OF_STRANGULATION:
902 if (can_be_strangled(&youmonst)) {
903 makeknown(AMULET_OF_STRANGULATION);
907 pline("It constricts your throat!");
909 pline("
\96\82\8f\9c\82¯
\82Í
\82 \82È
\82½
\82Ì
\8dA
\82ð
\8di
\82ß
\82Â
\82¯
\82½
\81I");
912 case AMULET_OF_RESTFUL_SLEEP: {
913 long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT);
915 /* avoid clobbering FROMOUTSIDE bit, which might have
916 gotten set by previously eating one of these amulets */
917 if (newnap < oldnap || oldnap == 0L)
918 HSleepy = (HSleepy & ~TIMEOUT) | newnap;
920 case AMULET_OF_YENDOR:
928 context.takeoff.mask &= ~W_AMUL;
930 switch (uamul->otyp) {
932 /* need to update ability before calling see_monsters() */
933 setworn((struct obj *) 0, W_AMUL);
936 case AMULET_OF_LIFE_SAVING:
937 case AMULET_VERSUS_POISON:
938 case AMULET_OF_REFLECTION:
939 case AMULET_OF_CHANGE:
940 case AMULET_OF_UNCHANGING:
941 case FAKE_AMULET_OF_YENDOR:
943 case AMULET_OF_MAGICAL_BREATHING:
945 /* HMagical_breathing must be set off
946 before calling drown() */
947 setworn((struct obj *) 0, W_AMUL);
948 if (!breathless(youmonst.data) && !amphibious(youmonst.data)
951 You("suddenly inhale an unhealthy amount of %s!",
954 You("
\93Ë
\91R
\81C
\91å
\97Ê
\82Ì%s
\82ð
\88ù
\82Ý
\8d\9e\82ñ
\82¾
\81I",
962 case AMULET_OF_STRANGULATION:
968 Your("%s is no longer constricted!", body_part(NECK));
970 pline("%s
\82ª
\8ay
\82É
\82È
\82Á
\82½
\81I", body_part(NECK));
973 You("can breathe more easily!");
975 You("
\8ay
\82É
\8cÄ
\8bz
\82Å
\82«
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
\81I");
978 case AMULET_OF_RESTFUL_SLEEP:
979 setworn((struct obj *) 0, W_AMUL);
980 /* HSleepy = 0L; -- avoid clobbering FROMOUTSIDE bit */
981 if (!ESleepy && !(HSleepy & ~TIMEOUT))
982 HSleepy &= ~TIMEOUT; /* clear timeout bits */
984 case AMULET_OF_YENDOR:
987 setworn((struct obj *) 0, W_AMUL);
991 /* handle ring discovery; comparable to learnwand() */
993 learnring(ring, observed)
997 int ringtype = ring->otyp;
999 /* if effect was observeable then we usually discover the type */
1001 /* if we already know the ring type which accomplishes this
1002 effect (assumes there is at most one type for each effect),
1003 mark this ring as having been seen (no need for makeknown);
1004 otherwise if we have seen this ring, discover its type */
1005 if (objects[ringtype].oc_name_known)
1007 else if (ring->dknown)
1008 makeknown(ringtype);
1009 #if 0 /* see learnwand() */
1015 /* make enchantment of charged ring known (might be +0) and update
1016 perm invent window if we've seen this ring and know its type */
1017 if (ring->dknown && objects[ringtype].oc_name_known) {
1018 if (objects[ringtype].oc_charged)
1026 register struct obj *obj;
1028 long oldprop = u.uprops[objects[obj->otyp].oc_oprop].extrinsic;
1029 int old_attrib, which;
1032 /* make sure ring isn't wielded; can't use remove_worn_item()
1033 here because it has already been set worn in a ring slot */
1035 setuwep((struct obj *) 0);
1036 else if (obj == uswapwep)
1037 setuswapwep((struct obj *) 0);
1038 else if (obj == uquiver)
1039 setuqwep((struct obj *) 0);
1041 /* only mask out W_RING when we don't have both
1042 left and right rings of the same type */
1043 if ((oldprop & W_RING) != W_RING)
1046 switch (obj->otyp) {
1047 case RIN_TELEPORTATION:
1048 case RIN_REGENERATION:
1051 case RIN_AGGRAVATE_MONSTER:
1052 case RIN_POISON_RESISTANCE:
1053 case RIN_FIRE_RESISTANCE:
1054 case RIN_COLD_RESISTANCE:
1055 case RIN_SHOCK_RESISTANCE:
1057 case RIN_TELEPORT_CONTROL:
1059 case RIN_POLYMORPH_CONTROL:
1060 case RIN_FREE_ACTION:
1061 case RIN_SLOW_DIGESTION:
1062 case RIN_SUSTAIN_ABILITY:
1066 toggle_stealth(obj, oldprop, TRUE);
1071 case RIN_SEE_INVISIBLE:
1072 /* can now see invisible monsters */
1073 set_mimic_blocking(); /* do special mimic handling */
1076 if (Invis && !oldprop && !HSee_invisible && !Blind) {
1079 pline("Suddenly you are transparent, but there!");
1081 pline("
\93Ë
\91R
\93§
\96¾
\82É
\82È
\82Á
\82½
\81D
\82µ
\82©
\82µ
\91¶
\8dÝ
\82Í
\82µ
\82Ä
\82¢
\82é
\81I");
1082 learnring(obj, TRUE);
1085 case RIN_INVISIBILITY:
1086 if (!oldprop && !HInvis && !BInvis && !Blind) {
1087 learnring(obj, TRUE);
1089 self_invis_message();
1092 case RIN_LEVITATION:
1093 if (!oldprop && !HLevitation && !(BLevitation & FROMOUTSIDE)) {
1095 learnring(obj, TRUE);
1097 spoteffects(FALSE); /* for sinks */
1099 float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
1102 case RIN_GAIN_STRENGTH:
1105 case RIN_GAIN_CONSTITUTION:
1111 old_attrib = ACURR(which);
1112 ABON(which) += obj->spe;
1113 observable = (old_attrib != ACURR(which));
1114 /* if didn't change, usually means ring is +0 but might
1115 be because nonzero couldn't go below min or above max;
1116 learn +0 enchantment if attribute value is not stuck
1117 at a limit [and ring has been seen and its type is
1118 already discovered, both handled by learnring()] */
1119 if (observable || !extremeattr(which))
1120 learnring(obj, observable);
1123 case RIN_INCREASE_ACCURACY: /* KMH */
1124 u.uhitinc += obj->spe;
1126 case RIN_INCREASE_DAMAGE:
1127 u.udaminc += obj->spe;
1129 case RIN_PROTECTION_FROM_SHAPE_CHAN:
1132 case RIN_PROTECTION:
1133 /* usually learn enchantment and discover type;
1134 won't happen if ring is unseen or if it's +0
1135 and the type hasn't been discovered yet */
1136 observable = (obj->spe != 0);
1137 learnring(obj, observable);
1139 find_ac(); /* updates botl */
1145 Ring_off_or_gone(obj, gone)
1146 register struct obj *obj;
1149 long mask = (obj->owornmask & W_RING);
1150 int old_attrib, which;
1153 context.takeoff.mask &= ~mask;
1154 if (!(u.uprops[objects[obj->otyp].oc_oprop].extrinsic & mask))
1155 impossible("Strange... I didn't know you had that ring.");
1159 setworn((struct obj *) 0, obj->owornmask);
1161 switch (obj->otyp) {
1162 case RIN_TELEPORTATION:
1163 case RIN_REGENERATION:
1166 case RIN_AGGRAVATE_MONSTER:
1167 case RIN_POISON_RESISTANCE:
1168 case RIN_FIRE_RESISTANCE:
1169 case RIN_COLD_RESISTANCE:
1170 case RIN_SHOCK_RESISTANCE:
1172 case RIN_TELEPORT_CONTROL:
1174 case RIN_POLYMORPH_CONTROL:
1175 case RIN_FREE_ACTION:
1176 case RIN_SLOW_DIGESTION:
1177 case RIN_SUSTAIN_ABILITY:
1181 toggle_stealth(obj, (EStealth & ~mask), FALSE);
1186 case RIN_SEE_INVISIBLE:
1187 /* Make invisible monsters go away */
1188 if (!See_invisible) {
1189 set_mimic_blocking(); /* do special mimic handling */
1193 if (Invisible && !Blind) {
1196 pline("Suddenly you cannot see yourself.");
1198 pline("
\93Ë
\91R
\81C
\8e©
\95ª
\8e©
\90g
\82ª
\8c©
\82¦
\82È
\82
\82È
\82Á
\82½
\81D");
1199 learnring(obj, TRUE);
1202 case RIN_INVISIBILITY:
1203 if (!Invis && !BInvis && !Blind) {
1206 Your("body seems to unfade%s.",
1207 See_invisible ? " completely" : "..");
1209 Your("
\91Ì
\82ª%s
\81D",
1210 See_invisible ? "
\8a®
\91S
\82É
\8c»
\82í
\82ê
\82½" : "
\8e\9f\91æ
\82É
\8c»
\82í
\82ê
\82Ä
\82«
\82½
\81D
\81D");
1212 learnring(obj, TRUE);
1215 case RIN_LEVITATION:
1216 if (!(BLevitation & FROMOUTSIDE)) {
1217 (void) float_down(0L, 0L);
1219 learnring(obj, TRUE);
1221 float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
1224 case RIN_GAIN_STRENGTH:
1227 case RIN_GAIN_CONSTITUTION:
1233 old_attrib = ACURR(which);
1234 ABON(which) -= obj->spe;
1235 observable = (old_attrib != ACURR(which));
1236 /* same criteria as Ring_on() */
1237 if (observable || !extremeattr(which))
1238 learnring(obj, observable);
1241 case RIN_INCREASE_ACCURACY: /* KMH */
1242 u.uhitinc -= obj->spe;
1244 case RIN_INCREASE_DAMAGE:
1245 u.udaminc -= obj->spe;
1247 case RIN_PROTECTION:
1248 /* might have been put on while blind and we can now see
1249 or perhaps been forgotten due to amnesia */
1250 observable = (obj->spe != 0);
1251 learnring(obj, observable);
1253 find_ac(); /* updates botl */
1255 case RIN_PROTECTION_FROM_SHAPE_CHAN:
1256 /* If you're no longer protected, let the chameleons
1257 * change shape again -dgk
1268 Ring_off_or_gone(obj, FALSE);
1275 Ring_off_or_gone(obj, TRUE);
1282 boolean already_blind = Blind, changed = FALSE;
1284 /* blindfold might be wielded; release it for wearing */
1285 if (otmp->owornmask & W_WEAPONS)
1286 remove_worn_item(otmp, FALSE);
1287 setworn(otmp, W_TOOL);
1290 if (Blind && !already_blind) {
1294 You_cant("see any more.");
1296 You("
\89½
\82à
\8c©
\82¦
\82È
\82
\82È
\82Á
\82½
\81D");
1297 /* set ball&chain variables before the hero goes blind */
1300 } else if (already_blind && !Blind) {
1302 /* "You are now wearing the Eyes of the Overworld." */
1303 if (u.uroleplay.blind) {
1304 /* this can only happen by putting on the Eyes of the Overworld;
1305 that shouldn't actually produce a permanent cure, but we
1306 can't let the "blind from birth" conduct remain intact */
1308 pline("For the first time in your life, you can see!");
1310 pline("
\90l
\90¶
\82Å
\8f\89\82ß
\82Ä
\81C
\96Ú
\82ª
\8c©
\82¦
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
\81I");
1311 u.uroleplay.blind = FALSE;
1316 You("
\96Ú
\82ª
\8c©
\82¦
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
\81I");
1319 toggle_blindness(); /* potion.c */
1327 boolean was_blind = Blind, changed = FALSE;
1330 impossible("Blindf_off without otmp");
1333 context.takeoff.mask &= ~W_TOOL;
1334 setworn((struct obj *) 0, otmp->owornmask);
1339 /* "still cannot see" makes no sense when removing lenses
1340 since they can't have been the cause of your blindness */
1341 if (otmp->otyp != LENSES)
1343 You("still cannot see.");
1345 You("
\82Ü
\82¾
\96Ú
\82ª
\8c©
\82¦
\82È
\82¢
\81D");
1347 changed = TRUE; /* !was_blind */
1348 /* "You were wearing the Eyes of the Overworld." */
1350 You_cant("see anything now!");
1352 You("
\8d¡
\82Í
\89½
\82à
\8c©
\82é
\82±
\82Æ
\82ª
\82Å
\82«
\82È
\82¢
\81I");
1353 /* set ball&chain variables before the hero goes blind */
1357 } else if (was_blind) {
1358 if (!gulp_blnd_check()) {
1359 changed = TRUE; /* !Blind */
1361 You("can see again.");
1363 You("
\82Ó
\82½
\82½
\82Ñ
\96Ú
\82ª
\8c©
\82¦
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
\81D");
1367 toggle_blindness(); /* potion.c */
1371 /* called in moveloop()'s prologue to set side-effects of worn start-up items;
1372 also used by poly_obj() when a worn item gets transformed */
1375 struct obj *obj; /* if null, do all worn items; otherwise just obj itself */
1379 if (!obj ? ublindf != 0 : (obj == ublindf))
1380 (void) Blindf_on(ublindf);
1381 if (!obj ? uright != 0 : (obj == uright))
1382 (void) Ring_on(uright);
1383 if (!obj ? uleft != 0 : (obj == uleft))
1384 (void) Ring_on(uleft);
1385 if (!obj ? uamul != 0 : (obj == uamul))
1388 if (!obj ? uarmu != 0 : (obj == uarmu))
1390 if (!obj ? uarm != 0 : (obj == uarm))
1392 if (!obj ? uarmc != 0 : (obj == uarmc))
1394 if (!obj ? uarmf != 0 : (obj == uarmf))
1396 if (!obj ? uarmg != 0 : (obj == uarmg))
1398 if (!obj ? uarmh != 0 : (obj == uarmh))
1400 if (!obj ? uarms != 0 : (obj == uarms))
1403 initial_don = FALSE;
1406 /* check whether the target object is currently being put on (or taken off--
1407 also checks for doffing--[why?]) */
1412 boolean result = FALSE;
1414 /* 'W' (or 'P' used for armor) sets afternmv */
1417 else if (otmp == uarm)
1418 result = (afternmv == Armor_on);
1419 else if (otmp == uarmu)
1420 result = (afternmv == Shirt_on);
1421 else if (otmp == uarmc)
1422 result = (afternmv == Cloak_on);
1423 else if (otmp == uarmf)
1424 result = (afternmv == Boots_on);
1425 else if (otmp == uarmh)
1426 result = (afternmv == Helmet_on);
1427 else if (otmp == uarmg)
1428 result = (afternmv == Gloves_on);
1429 else if (otmp == uarms)
1430 result = (afternmv == Shield_on);
1435 /* check whether the target object is currently being taken off,
1436 so that stop_donning() and steal() can vary messages and doname()
1437 can vary "(being worn)" suffix */
1442 long what = context.takeoff.what;
1443 boolean result = FALSE;
1445 /* 'T' (or 'R' used for armor) sets afternmv, 'A' sets takeoff.what */
1447 result = (afternmv == Armor_off || what == WORN_ARMOR);
1448 else if (otmp == uarmu)
1449 result = (afternmv == Shirt_off || what == WORN_SHIRT);
1450 else if (otmp == uarmc)
1451 result = (afternmv == Cloak_off || what == WORN_CLOAK);
1452 else if (otmp == uarmf)
1453 result = (afternmv == Boots_off || what == WORN_BOOTS);
1454 else if (otmp == uarmh)
1455 result = (afternmv == Helmet_off || what == WORN_HELMET);
1456 else if (otmp == uarmg)
1457 result = (afternmv == Gloves_off || what == WORN_GLOVES);
1458 else if (otmp == uarms)
1459 result = (afternmv == Shield_off || what == WORN_SHIELD);
1460 /* these 1-turn items don't need 'afternmv' checks */
1461 else if (otmp == uamul)
1462 result = (what == WORN_AMUL);
1463 else if (otmp == uleft)
1464 result = (what == LEFT_RING);
1465 else if (otmp == uright)
1466 result = (what == RIGHT_RING);
1467 else if (otmp == ublindf)
1468 result = (what == WORN_BLINDF);
1469 else if (otmp == uwep)
1470 result = (what == W_WEP);
1471 else if (otmp == uswapwep)
1472 result = (what == W_SWAPWEP);
1473 else if (otmp == uquiver)
1474 result = (what == W_QUIVER);
1479 /* despite their names, cancel_don() and cancel_doff() both apply to both
1480 donning and doffing... */
1482 cancel_doff(obj, slotmask)
1486 /* Called by setworn() for old item in specified slot or by setnotworn()
1487 * for specified item. We don't want to call cancel_don() if we got
1488 * here via <X>_off() -> setworn((struct obj *)0) -> cancel_doff()
1489 * because that would stop the 'A' command from continuing with next
1490 * selected item. So do_takeoff() sets a flag in takeoff.mask for us.
1491 * [For taking off an individual item with 'T'/'R'/'w-', it doesn't
1492 * matter whether cancel_don() gets called here--the item has already
1493 * been removed by now.]
1495 if (!(context.takeoff.mask & I_SPECIAL) && donning(obj))
1496 cancel_don(); /* applies to doffing too */
1497 context.takeoff.mask &= ~slotmask;
1500 /* despite their names, cancel_don() and cancel_doff() both apply to both
1501 donning and doffing... */
1505 /* the piece of armor we were donning/doffing has vanished, so stop
1506 * wasting time on it (and don't dereference it when donning would
1509 context.takeoff.cancelled_don =
1510 (afternmv == Boots_on || afternmv == Helmet_on
1511 || afternmv == Gloves_on || afternmv == Armor_on);
1512 afternmv = (int NDECL((*))) 0;
1513 nomovemsg = (char *) 0;
1515 context.takeoff.delay = 0;
1516 context.takeoff.what = 0L;
1519 /* called by steal() during theft from hero; interrupt donning/doffing */
1521 stop_donning(stolenobj)
1522 struct obj *stolenobj; /* no message if stolenobj is already being doffing */
1529 for (otmp = invent; otmp; otmp = otmp->nobj)
1530 if ((otmp->owornmask & W_ARMOR) && donning(otmp))
1532 /* at most one item will pass donning() test at any given time */
1536 /* donning() returns True when doffing too; doffing() is more specific */
1537 putting_on = !doffing(otmp);
1538 /* cancel_don() looks at afternmv; it can also cancel doffing */
1540 /* don't want <armor>_on() or <armor>_off() being called
1541 by unmul() since the on or off action isn't completing */
1542 afternmv = (int NDECL((*))) 0;
1543 if (putting_on || otmp != stolenobj) {
1545 Sprintf(buf, "You stop %s %s.",
1546 putting_on ? "putting on" : "taking off",
1547 thesimpleoname(otmp));
1549 Sprintf(buf, "
\82 \82È
\82½
\82Í%s
\82ð%s
\82Ì
\82ð
\8e~
\82ß
\82½
\81D",
1550 thesimpleoname(otmp),
1551 putting_on ? "
\90g
\82É
\82Â
\82¯
\82é" : "
\8aO
\82·");
1554 buf[0] = '\0'; /* silently stop doffing stolenobj */
1555 result = -multi; /* remember this before calling unmul() */
1558 /* while putting on, item becomes worn immediately but side-effects are
1559 deferred until the delay expires; when interrupted, make it unworn
1560 (while taking off, item stays worn until the delay expires; when
1561 interrupted, leave it worn) */
1563 remove_worn_item(otmp, FALSE);
1568 /* both 'clothes' and 'accessories' now include both armor and accessories;
1569 TOOL_CLASS is for eyewear, FOOD_CLASS is for MEAT_RING */
1570 static NEARDATA const char clothes[] = {
1571 ARMOR_CLASS, RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, 0
1573 static NEARDATA const char accessories[] = {
1574 RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, ARMOR_CLASS, 0
1576 STATIC_VAR NEARDATA int Narmorpieces, Naccessories;
1578 /* assign values to Narmorpieces and Naccessories */
1580 count_worn_stuff(which, accessorizing)
1581 struct obj **which; /* caller wants this when count is 1 */
1582 boolean accessorizing;
1586 Narmorpieces = Naccessories = 0;
1588 #define MOREWORN(x,wtyp) do { if (x) { wtyp++; otmp = x; } } while (0)
1590 MOREWORN(uarmh, Narmorpieces);
1591 MOREWORN(uarms, Narmorpieces);
1592 MOREWORN(uarmg, Narmorpieces);
1593 MOREWORN(uarmf, Narmorpieces);
1594 /* for cloak/suit/shirt, we only count the outermost item so that it
1595 can be taken off without confirmation if final count ends up as 1 */
1597 MOREWORN(uarmc, Narmorpieces);
1599 MOREWORN(uarm, Narmorpieces);
1601 MOREWORN(uarmu, Narmorpieces);
1603 *which = otmp; /* default item iff Narmorpieces is 1 */
1606 MOREWORN(uleft, Naccessories);
1607 MOREWORN(uright, Naccessories);
1608 MOREWORN(uamul, Naccessories);
1609 MOREWORN(ublindf, Naccessories);
1611 *which = otmp; /* default item iff Naccessories is 1 */
1615 /* take off one piece or armor or one accessory;
1616 shared by dotakeoff('T') and doremring('R') */
1618 armor_or_accessory_off(obj)
1625 if (!(obj->owornmask & (W_ARMOR | W_ACCESSORY))) {
1627 You("are not wearing that.");
1629 You("
\82»
\82ê
\82ð
\90g
\82É
\82Â
\82¯
\82Ä
\82¢
\82È
\82¢
\81D");
1633 || ((obj == uarm) && uarmc)
1634 || ((obj == uarmu) && (uarmc || uarm))) {
1635 char why[QBUFSZ], what[QBUFSZ];
1637 why[0] = what[0] = '\0';
1640 Strcat(what, cloak_simple_name(uarmc));
1641 if ((obj == uarmu) && uarm) {
1644 Strcat(what, " and ");
1646 Strcat(what, "
\82Æ");
1648 Strcat(what, suit_simple_name(uarm));
1651 Sprintf(why, " without taking off your %s first", what);
1653 Sprintf(why, "
\90æ
\82É%s
\82ð
\82Í
\82¸
\82³
\82È
\82¢
\82Æ", what);
1657 Strcpy(why, "; it's embedded");
1659 Strcpy(why, "
\82
\82Á
\82Â
\82¢
\82Ä
\82¢
\82é
\82Ì
\82Å");
1663 You_cant("take that off%s.", why);
1665 m = joffmsg(obj, &j);
1666 pline("%s
\82»
\82ê%s%s
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81D", why, j, m);
1671 reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */
1672 (void) select_off(obj);
1673 if (!context.takeoff.mask)
1675 /* none of armoroff()/Ring_/Amulet/Blindf_off() use context.takeoff.mask */
1678 if (obj->owornmask & W_ARMOR) {
1679 (void) armoroff(obj);
1680 } else if (obj == uright || obj == uleft) {
1681 /* Sometimes we want to give the off_msg before removing and
1682 * sometimes after; for instance, "you were wearing a moonstone
1683 * ring (on right hand)" is desired but "you were wearing a
1684 * square amulet (being worn)" is not because of the redundant
1689 } else if (obj == uamul) {
1692 } else if (obj == ublindf) {
1693 Blindf_off(obj); /* does its own off_msg */
1695 impossible("removing strange accessory?");
1697 remove_worn_item(obj, FALSE);
1702 /* the 'T' command */
1706 struct obj *otmp = (struct obj *) 0;
1708 count_worn_stuff(&otmp, FALSE);
1709 if (!Narmorpieces && !Naccessories) {
1710 /* assert( GRAY_DRAGON_SCALES > YELLOW_DRAGON_SCALE_MAIL ); */
1713 pline_The("%s merged with your skin!",
1714 uskin->otyp >= GRAY_DRAGON_SCALES
1715 ? "dragon scales are"
1716 : "dragon scale mail is");
1718 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",
1719 uskin->otyp >= GRAY_DRAGON_SCALES
1724 pline("Not wearing any armor or accessories.");
1726 pline("
\8aZ
\82â
\91\95\8fü
\95i
\82ð
\90g
\82É
\82Â
\82¯
\82Ä
\82¢
\82È
\82¢
\81D");
1729 if (Narmorpieces != 1 || ParanoidRemove)
1730 otmp = getobj(clothes, "take off");
1734 return armor_or_accessory_off(otmp);
1737 /* the 'R' command */
1741 struct obj *otmp = 0;
1743 count_worn_stuff(&otmp, TRUE);
1744 if (!Naccessories && !Narmorpieces) {
1746 pline("Not wearing any accessories or armor.");
1748 pline("
\91\95\8fü
\95i
\82â
\8aZ
\82ð
\90g
\82É
\82Â
\82¯
\82Ä
\82¢
\82È
\82¢
\81D");
1751 if (Naccessories != 1 || ParanoidRemove)
1752 otmp = getobj(accessories, "remove");
1756 return armor_or_accessory_off(otmp);
1759 /* Check if something worn is cursed _and_ unremovable. */
1765 impossible("cursed without otmp");
1768 /* Curses, like chickens, come home to roost. */
1769 if ((otmp == uwep) ? welded(otmp) : (int) otmp->cursed) {
1770 #if 0 /*JP*//*unused*/
1771 boolean use_plural = (is_boots(otmp) || is_gloves(otmp)
1772 || otmp->otyp == LENSES || otmp->quan > 1L);
1775 /* might be trying again after applying grease to hands */
1776 if (Glib && otmp->bknown
1777 /* for weapon, we'll only get here via 'A )' */
1778 && (uarmg ? (otmp == uwep)
1779 : ((otmp->owornmask & (W_WEP | W_RING)) != 0)))
1781 pline("Despite your slippery %s, you can't.",
1782 fingers_or_gloves(TRUE));
1784 pline("%s
\82Í
\82·
\82×
\82è
\82â
\82·
\82¢
\82¯
\82ê
\82Ç
\82à
\81C
\82»
\82ê
\82Í
\82Å
\82«
\82È
\82¢
\81D",
1785 fingers_or_gloves(TRUE));
1789 You("can't. %s cursed.", use_plural ? "They are" : "It is");
1791 pline("
\96³
\97\9d\82¾
\81D
\82»
\82ê
\82Í
\8eô
\82í
\82ê
\82Ä
\82¢
\82é
\81D");
1792 set_bknown(otmp, 1);
1802 static char offdelaybuf[60];
1803 int delay = -objects[otmp->otyp].oc_delay;
1804 const char *what = 0;
1808 /* this used to make assumptions about which types of armor had
1809 delays and which didn't; now both are handled for all types */
1813 multi_reason = "disrobing";
1815 multi_reason = "
\92E
\82¢
\82Å
\82¢
\82é
\8e\9e\82É";
1816 if (is_helmet(otmp)) {
1817 what = helm_simple_name(otmp);
1818 afternmv = Helmet_off;
1819 } else if (is_gloves(otmp)) {
1820 what = gloves_simple_name(otmp);
1821 afternmv = Gloves_off;
1822 } else if (is_boots(otmp)) {
1824 afternmv = Boots_off;
1825 } else if (is_suit(otmp)) {
1826 what = suit_simple_name(otmp);
1827 afternmv = Armor_off;
1828 } else if (is_cloak(otmp)) {
1829 what = cloak_simple_name(otmp);
1830 afternmv = Cloak_off;
1831 } else if (is_shield(otmp)) {
1833 afternmv = Shield_off;
1834 } else if (is_shirt(otmp)) {
1836 afternmv = Shirt_off;
1838 impossible("Taking off unknown armor (%d: %d), delay %d",
1839 otmp->otyp, objects[otmp->otyp].oc_armcat, delay);
1843 Sprintf(offdelaybuf, "You finish taking off your %s.", what);
1845 Sprintf(offdelaybuf, "
\82 \82È
\82½
\82Í%s
\82ð
\92E
\82¬
\82¨
\82¦
\82½
\81D", what);
1846 nomovemsg = offdelaybuf;
1849 /* Be warned! We want off_msg after removing the item to
1850 * avoid "You were wearing ____ (being worn)." However, an
1851 * item which grants fire resistance might cause some trouble
1852 * if removed in Hell and lifesaving puts it back on; in this
1853 * case the message will be printed at the wrong time (after
1854 * the messages saying you died and were lifesaved). Luckily,
1855 * no cloak, shield, or fast-removable armor grants fire
1856 * resistance, so we can safely do the off_msg afterwards.
1857 * Rings do grant fire resistance, but for rings we want the
1858 * off_msg before removal anyway so there's no problem. Take
1859 * care in adding armors granting fire resistance; this code
1860 * might need modification.
1861 * 3.2 (actually 3.1 even): that comment is obsolete since
1862 * fire resistance is not required for Gehennom so setworn()
1863 * doesn't force the resistance granting item to be re-worn
1864 * after being lifesaved anymore.
1868 else if (is_shield(otmp))
1869 (void) Shield_off();
1870 else if (is_helmet(otmp))
1871 (void) Helmet_off();
1872 else if (is_gloves(otmp))
1873 (void) Gloves_off();
1874 else if (is_boots(otmp))
1876 else if (is_shirt(otmp))
1878 else if (is_suit(otmp))
1881 impossible("Taking off unknown armor (%d: %d), no delay",
1882 otmp->otyp, objects[otmp->otyp].oc_armcat);
1885 context.takeoff.mask = context.takeoff.what = 0L;
1890 **
\95¨
\82É
\82æ
\82Á
\82Ä
\93®
\8e\8c\82ª
\95Ï
\89»
\82·
\82é
\82Ì
\82Å otmp
\82ð
\92Ç
\89Á
1897 already_wearing(cc, otmp)
1905 m = jconj(jonmsg(otmp, &j), "
\82Ä
\82¢
\82é");
1908 You("are already wearing %s%c", cc, (cc == c_that_) ? '!' : '.');
1910 You("
\82à
\82¤%s%s%s%s", cc, j, m, (cc == c_that_) ? "
\81I" : "
\81D");
1914 already_wearing2(cc1, cc2)
1915 const char *cc1, *cc2;
1918 You_cant("wear %s because you're wearing %s there already.", cc1, cc2);
1920 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);
1924 * canwearobj checks to see whether the player can wear a piece of armor
1926 * inputs: otmp (the piece of armor)
1927 * noisy (if TRUE give error messages, otherwise be quiet about it)
1928 * output: mask (otmp's armor type)
1931 canwearobj(otmp, mask, noisy)
1943 /* this is the same check as for 'W' (dowear), but different message,
1944 in case we get here via 'P' (doputon) */
1945 if (verysmall(youmonst.data) || nohands(youmonst.data)) {
1948 You("can't wear any armor in your current form.");
1950 You("
\8c»
\8dÝ
\82Ì
\8ep
\82Å
\82Í
\96h
\8bï
\82ð
\90g
\82É
\82Â
\82¯
\82é
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81D");
1954 which = is_cloak(otmp)
1961 if (which && cantweararm(youmonst.data)
1962 /* same exception for cloaks as used in m_dowear() */
1963 && (which != c_cloak || youmonst.data->msize != MZ_SMALL)
1964 && (racial_exception(&youmonst, otmp) < 1)) {
1967 pline_The("%s will not fit on your body.", which);
1969 pline("%s
\82Í
\82 \82È
\82½
\82Ì
\91Ì
\82É
\8d\87\82í
\82È
\82¢
\81D", which);
1971 } else if (otmp->owornmask & W_ARMOR) {
1974 already_wearing(c_that_);
1976 already_wearing(c_that_, otmp);
1981 if (welded(uwep) && bimanual(uwep) && (is_suit(otmp) || is_shirt(otmp))) {
1984 You("cannot do that while holding your %s.",
1986 pline("%s
\82ð
\8e\9d\82Á
\82½
\82Ü
\82Ü
\82Å
\82Í
\82»
\82ê
\82Í
\8fo
\97\88\82È
\82¢
\81D",
1987 is_sword(uwep) ? c_sword : c_weapon);
1991 if (is_helmet(otmp)) {
1995 already_wearing(an(helm_simple_name(uarmh)));
1997 already_wearing(helm_simple_name(uarmh), uarmh);
2000 } else if (Upolyd && has_horns(youmonst.data) && !is_flimsy(otmp)) {
2001 /* (flimsy exception matches polyself handling) */
2004 pline_The("%s won't fit over your horn%s.",
2005 helm_simple_name(otmp),
2006 plur(num_horns(youmonst.data)));
2008 pline("
\8ap
\82ª
\82¶
\82á
\82Ü
\82Å%s
\82ð
\90g
\82É
\82Â
\82¯
\82ç
\82ê
\82È
\82¢
\81D",
2009 helm_simple_name(otmp));
2014 } else if (is_shield(otmp)) {
2018 already_wearing(an(c_shield));
2020 already_wearing(c_shield, uarms);
2023 } else if (uwep && bimanual(uwep)) {
2026 You("cannot wear a shield while wielding a two-handed %s.",
2027 is_sword(uwep) ? c_sword : (uwep->otyp == BATTLE_AXE)
2032 m = jconj(jonmsg(uwep, &j), "
\82Ä
\82¢
\82é");
2033 You("
\97¼
\8eè
\8e\9d\82¿
\82Ì%s%s%s
\82Ì
\82Å
\8f\82\82Å
\90g
\82ð
\8eç
\82ê
\82È
\82¢
\81D",
2034 is_sword(uwep) ? c_sword :
2035 uwep->otyp == BATTLE_AXE ? c_axe : c_weapon,
2040 } else if (u.twoweap) {
2043 You("cannot wear a shield while wielding two weapons.");
2045 You("
\93ñ
\93\81\97¬
\82ð
\82µ
\82Ä
\82¢
\82é
\82Ì
\82Å
\8f\82\82Å
\90g
\82ð
\8eç
\82ê
\82È
\82¢
\81D");
2049 } else if (is_boots(otmp)) {
2053 already_wearing(c_boots);
2055 already_wearing(c_boots, uarmf);
2058 } else if (Upolyd && slithy(youmonst.data)) {
2061 You("have no feet..."); /* not body_part(FOOT) */
2063 You("
\91«
\82ª
\82È
\82¢
\81D
\81D
\81D"); /* not body_part(FOOT) */
2066 } else if (Upolyd && youmonst.data->mlet == S_CENTAUR) {
2067 /* break_armor() pushes boots off for centaurs,
2068 so don't let dowear() put them back on... */
2071 pline("You have too many hooves to wear %s.",
2072 c_boots); /* makeplural(body_part(FOOT)) yields
2073 "rear hooves" which sounds odd */
2075 pline("%s
\82ð
\97\9a\82
\82É
\82Í
\91«
\82ª
\91½
\82·
\82¬
\82é
\81D", c_boots);
2079 && (u.utraptype == TT_BEARTRAP || u.utraptype == TT_INFLOOR
2080 || u.utraptype == TT_LAVA
2081 || u.utraptype == TT_BURIEDBALL)) {
2082 if (u.utraptype == TT_BEARTRAP) {
2085 Your("%s is trapped!", body_part(FOOT));
2087 Your("%s
\82Íã©
\82É
\82©
\82©
\82Á
\82Ä
\82¢
\82é
\81I", body_part(FOOT));
2088 } else if (u.utraptype == TT_INFLOOR || u.utraptype == TT_LAVA) {
2091 Your("%s are stuck in the %s!",
2092 makeplural(body_part(FOOT)), surface(u.ux, u.uy));
2094 Your("%s
\82Í%s
\82É
\82Í
\82Ü
\82Á
\82Ä
\82¢
\82é
\81I",
2095 body_part(FOOT), surface(u.ux, u.uy));
2097 } else { /*TT_BURIEDBALL*/
2100 Your("%s is attached to the buried ball!",
2103 Your("%s
\82Í
\96\84\82Ü
\82Á
\82Ä
\82¢
\82é
\8b\85\82É
\82Â
\82È
\82ª
\82Á
\82Ä
\82¢
\82é
\81I",
2110 } else if (is_gloves(otmp)) {
2114 already_wearing(c_gloves);
2116 already_wearing(c_gloves, uarmg);
2119 } else if (welded(uwep)) {
2122 You("cannot wear gloves over your %s.",
2124 You("%s
\82Ì
\8fã
\82©
\82ç
\8f¬
\8eè
\82ð
\91\95\94õ
\82Å
\82«
\82È
\82¢
\81D",
2125 is_sword(uwep) ? c_sword : c_weapon);
2128 /* prevent slippery bare fingers from transferring to
2132 Your("%s are too slippery to pull on %s.",
2133 fingers_or_gloves(FALSE), gloves_simple_name(otmp));
2135 Your("%s
\82ª
\82·
\82×
\82é
\82Ì
\82Å%s
\82ð
\82Ð
\82Á
\82Ï
\82ê
\82È
\82¢
\81D",
2136 fingers_or_gloves(FALSE), gloves_simple_name(otmp));
2141 } else if (is_shirt(otmp)) {
2142 if (uarm || uarmc || uarmu) {
2146 already_wearing(an(c_shirt));
2148 already_wearing(c_shirt, uarmu);
2153 You_cant("wear that over your %s.",
2155 You("%s
\82Ì
\8fã
\82©
\82ç
\92\85\82é
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81D",
2156 (uarm && !uarmc) ? c_armor
2157 : cloak_simple_name(uarmc));
2162 } else if (is_cloak(otmp)) {
2166 already_wearing(an(cloak_simple_name(uarmc)));
2168 already_wearing(cloak_simple_name(uarmc), otmp);
2172 } else if (is_suit(otmp)) {
2176 You("cannot wear armor over a %s.", cloak_simple_name(uarmc));
2178 You("%s
\82Ì
\8fã
\82©
\82ç
\92\85\82é
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81D", cloak_simple_name(uarmc));
2183 already_wearing("some armor");
2185 already_wearing("
\8aZ", uarm);
2190 /* getobj can't do this after setting its allow_all flag; that
2191 happens if you have armor for slots that are covered up or
2192 extra armor for slots that are filled */
2195 silly_thing("wear", otmp);
2197 silly_thing("
\90g
\82É
\82Â
\82¯
\82é", otmp);
2200 /* Unnecessary since now only weapons and special items like pick-axes get
2201 * welded to your hand, not armor
2204 if (noisy) weldmsg(otmp);
2212 accessory_or_armor_on(obj)
2216 boolean armor, ring, eyewear;
2218 if (obj->owornmask & (W_ACCESSORY | W_ARMOR)) {
2220 already_wearing(c_that_);
2222 already_wearing(c_that_, obj);
2226 armor = (obj->oclass == ARMOR_CLASS);
2227 ring = (obj->oclass == RING_CLASS || obj->otyp == MEAT_RING);
2228 eyewear = (obj->otyp == BLINDFOLD || obj->otyp == TOWEL
2229 || obj->otyp == LENSES);
2230 /* checks which are performed prior to actually touching the item */
2232 if (!canwearobj(obj, &mask, TRUE))
2235 if (obj->otyp == HELM_OF_OPPOSITE_ALIGNMENT
2236 && qstart_level.dnum == u.uz.dnum) { /* in quest */
2237 if (u.ualignbase[A_CURRENT] == u.ualignbase[A_ORIGINAL])
2239 You("narrowly avoid losing all chance at your goal.");
2241 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");
2242 else /* converted */
2244 You("are suddenly overcome with shame and change your mind.");
2246 You("
\93Ë
\91R
\92p
\82¸
\82©
\82µ
\82
\82È
\82Á
\82Ä
\8dl
\82¦
\82ð
\95Ï
\82¦
\82½
\81D");
2247 u.ublessed = 0; /* lose your god's protection */
2248 makeknown(obj->otyp);
2249 context.botl = 1; /*for AC after zeroing u.ublessed */
2255 char answer, qbuf[QBUFSZ];
2258 if (nolimbs(youmonst.data)) {
2260 You("cannot make the ring stick to your body.");
2262 You("
\8ew
\97Ö
\82ð
\82Í
\82ß
\82ç
\82ê
\82È
\82¢
\91Ì
\82¾
\81D");
2265 if (uleft && uright) {
2267 There("are no more %s%s to fill.",
2268 humanoid(youmonst.data) ? "ring-" : "",
2269 fingers_or_gloves(FALSE));
2271 pline("
\82Í
\82ß
\82é
\82±
\82Æ
\82Ì
\82Å
\82«
\82é%s%s
\82ª
\82È
\82¢
\81D",
2272 humanoid(youmonst.data) ? "
\96ò" : "",
2273 fingers_or_gloves(FALSE));
2279 } else if (uright) {
2284 Sprintf(qbuf, "Which %s%s, Right or Left?",
2285 humanoid(youmonst.data) ? "ring-" : "",
2288 Sprintf(qbuf, "
\82Ç
\82¿
\82ç
\82Ì%s%s
\81C
\89E(r)
\82»
\82ê
\82Æ
\82à
\8d¶(l)
\81H",
2289 humanoid(youmonst.data) ? "
\96ò" : "",
2292 answer = yn_function(qbuf, "rl", '\0');
2307 if (uarmg && Glib) {
2310 "%s are too slippery to remove, so you cannot put on the ring.",
2311 gloves_simple_name(uarmg));
2314 "%s
\82ª
\82·
\82×
\82Á
\82Ä
\92E
\82°
\82È
\82¢
\82Ì
\82Å
\81A
\8ew
\97Ö
\82ð
\82Â
\82¯
\82ç
\82ê
\82È
\82¢
\81D",
2315 gloves_simple_name(uarmg));
2317 return 1; /* always uses move */
2319 if (uarmg && uarmg->cursed) {
2320 res = !uarmg->bknown;
2321 set_bknown(uarmg, 1);
2323 You("cannot remove your %s to put on the ring.", c_gloves);
2325 You("
\8ew
\97Ö
\82ð
\82Í
\82ß
\82æ
\82¤
\82Æ
\82µ
\82½
\82ª%s
\82ª
\92E
\82°
\82È
\82¢
\81D", c_gloves);
2326 return res; /* uses move iff we learned gloves are cursed */
2329 res = !uwep->bknown; /* check this before calling welded() */
2330 if ((mask == RIGHT_RING || bimanual(uwep)) && welded(uwep)) {
2331 const char *hand = body_part(HAND);
2333 /* welded will set bknown */
2335 hand = makeplural(hand);
2337 You("cannot free your weapon %s to put on the ring.",
2339 You("
\8ew
\97Ö
\82ð
\82Í
\82ß
\82æ
\82¤
\82Æ
\82µ
\82½
\82ª
\97\98%s
\82Ì
\8e©
\97R
\82ª
\82«
\82©
\82È
\82¢
\81D",
2341 return res; /* uses move iff we learned weapon is cursed */
2344 } else if (obj->oclass == AMULET_CLASS) {
2347 already_wearing("an amulet");
2349 already_wearing("
\96\82\8f\9c\82¯", uamul);
2353 } else if (eyewear) {
2355 if (ublindf->otyp == TOWEL)
2357 Your("%s is already covered by a towel.",
2360 You("
\8aù
\82É
\83^
\83I
\83\8b\82ð
\90g
\82É
\82Â
\82¯
\82Ä
\82¢
\82é
\81D");
2362 else if (ublindf->otyp == BLINDFOLD) {
2363 if (obj->otyp == LENSES)
2365 already_wearing2("lenses", "a blindfold");
2367 already_wearing2("
\83\8c\83\93\83Y", "
\96Ú
\89B
\82µ");
2370 already_wearing("a blindfold");
2372 already_wearing("
\96Ú
\89B
\82µ", ublindf);
2374 } else if (ublindf->otyp == LENSES) {
2375 if (obj->otyp == BLINDFOLD)
2377 already_wearing2("a blindfold", "some lenses");
2379 already_wearing2("
\96Ú
\89B
\82µ", "
\83\8c\83\93\83Y");
2382 already_wearing("some lenses");
2384 already_wearing("
\83\8c\83\93\83Y", ublindf);
2388 already_wearing(something); /* ??? */
2390 already_wearing("
\89½
\82©", ublindf); /* ??? */
2396 /* neither armor nor accessory */
2398 You_cant("wear that!");
2400 You_cant("
\82»
\82ê
\82ð
\90g
\82É
\82Â
\82¯
\82ç
\82ê
\82È
\82¢
\81I");
2405 if (!retouch_object(&obj, FALSE))
2406 return 1; /* costs a turn even though it didn't get worn */
2411 /* if the armor is wielded, release it for wearing (won't be
2412 welded even if cursed; that only happens for weapons/weptools) */
2413 if (obj->owornmask & W_WEAPONS)
2414 remove_worn_item(obj, FALSE);
2416 * Setting obj->known=1 is done because setworn() causes hero's AC
2417 * to change so armor's +/- value is evident via the status line.
2418 * We used to set it here because of that, but then it would stick
2419 * if a nymph stole the armor before it was fully worn. Delay it
2420 * until the aftermv action. The player may still know this armor's
2421 * +/- amount if donning gets interrupted, but the hero won't.
2426 /* if there's no delay, we'll execute 'aftermv' immediately */
2428 afternmv = Armor_on;
2429 else if (obj == uarmh)
2430 afternmv = Helmet_on;
2431 else if (obj == uarmg)
2432 afternmv = Gloves_on;
2433 else if (obj == uarmf)
2434 afternmv = Boots_on;
2435 else if (obj == uarms)
2436 afternmv = Shield_on;
2437 else if (obj == uarmc)
2438 afternmv = Cloak_on;
2439 else if (obj == uarmu)
2440 afternmv = Shirt_on;
2442 panic("wearing armor not worn as armor? [%08lx]", obj->owornmask);
2444 delay = -objects[obj->otyp].oc_delay;
2448 multi_reason = "dressing up";
2450 multi_reason = "
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\8e\9e\82É";
2452 nomovemsg = "You finish your dressing maneuver.";
2454 nomovemsg = "
\91\95\94õ
\82µ
\8fI
\82¦
\82½
\81D";
2456 unmul(""); /* call (*aftermv)(), clear it+nomovemsg+multi_reason */
2459 context.takeoff.mask = context.takeoff.what = 0L;
2460 } else { /* not armor */
2461 boolean give_feedback = FALSE;
2463 /* [releasing wielded accessory handled in Xxx_on()] */
2467 give_feedback = TRUE;
2468 } else if (obj->oclass == AMULET_CLASS) {
2469 setworn(obj, W_AMUL);
2471 /* no feedback here if amulet of change got used up */
2472 give_feedback = (uamul != 0);
2473 } else if (eyewear) {
2474 /* setworn() handled by Blindf_on() */
2476 /* message handled by Blindf_on(); leave give_feedback False */
2478 /* feedback for ring or for amulet other than 'change' */
2479 if (give_feedback && is_worn(obj))
2480 prinv((char *) 0, obj, 0L);
2485 /* the 'W' command */
2491 /* cantweararm() checks for suits of armor, not what we want here;
2492 verysmall() or nohands() checks for shields, gloves, etc... */
2493 if (verysmall(youmonst.data) || nohands(youmonst.data)) {
2495 pline("Don't even bother.");
2497 pline("
\82»
\82ñ
\82È
\82Â
\82Ü
\82ç
\82È
\82¢
\82±
\82Æ
\82É
\82±
\82¾
\82í
\82é
\82È
\81D");
2500 if (uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf
2501 && uleft && uright && uamul && ublindf) {
2502 /* 'W' message doesn't mention accessories */
2504 You("are already wearing a full complement of armor.");
2506 You("
\82·
\82Å
\82É
\8a®
\91S
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\81D");
2509 otmp = getobj(clothes, "wear");
2510 return otmp ? accessory_or_armor_on(otmp) : 0;
2513 /* the 'P' command */
2519 if (uleft && uright && uamul && ublindf
2520 && uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf) {
2521 /* 'P' message doesn't mention armor */
2523 Your("%s%s are full, and you're already wearing an amulet and %s.",
2524 humanoid(youmonst.data) ? "ring-" : "",
2525 fingers_or_gloves(FALSE),
2526 (ublindf->otyp == LENSES) ? "some lenses" : "a blindfold");
2528 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",
2529 humanoid(youmonst.data) ? "
\96ò" : "",
2530 fingers_or_gloves(FALSE),
2531 ublindf->otyp==LENSES ? "
\83\8c\83\93\83Y" : "
\96Ú
\89B
\82µ");
2535 otmp = getobj(accessories, "put on");
2536 return otmp ? accessory_or_armor_on(otmp) : 0;
2539 /* calculate current armor class */
2543 int uac = mons[u.umonnum].ac; /* base armor class for current form */
2545 /* armor class from worn gear */
2547 uac -= ARM_BONUS(uarm);
2549 uac -= ARM_BONUS(uarmc);
2551 uac -= ARM_BONUS(uarmh);
2553 uac -= ARM_BONUS(uarmf);
2555 uac -= ARM_BONUS(uarms);
2557 uac -= ARM_BONUS(uarmg);
2559 uac -= ARM_BONUS(uarmu);
2560 if (uleft && uleft->otyp == RIN_PROTECTION)
2562 if (uright && uright->otyp == RIN_PROTECTION)
2565 /* armor class from other sources */
2566 if (HProtection & INTRINSIC)
2568 uac -= u.uspellprot;
2570 /* [The magic binary numbers 127 and -128 should be replaced with the
2571 * mystic decimal numbers 99 and -99 which require no explanation to
2572 * the uninitiated and would cap the width of a status line value at
2573 * one less character.]
2576 uac = -128; /* u.uac is an schar */
2578 uac = 127; /* for completeness */
2589 register struct obj *otmp;
2591 boolean leftfall, rightfall, wastwoweap = FALSE;
2592 const char *otherwep = 0, *thiswep, *which, *hand;
2594 leftfall = (uleft && !uleft->cursed
2595 && (!uwep || !welded(uwep) || !bimanual(uwep)));
2596 rightfall = (uright && !uright->cursed && (!welded(uwep)));
2597 if (!uarmg && (leftfall || rightfall) && !nolimbs(youmonst.data)) {
2598 /* changed so cursed rings don't fall off, GAN 10/30/86 */
2600 Your("%s off your %s.",
2601 (leftfall && rightfall) ? "rings slip" : "ring slips",
2602 (leftfall && rightfall) ? fingers_or_gloves(FALSE)
2603 : body_part(FINGER));
2605 Your("
\8ew
\97Ö
\82Í%s
\82©
\82ç
\8a\8a\82è
\97\8e\82¿
\82½
\81D",
2606 (leftfall && rightfall) ? fingers_or_gloves(FALSE)
2607 : body_part(FINGER));
2623 if (u.twoweap && otmp) {
2624 /* secondary weapon doesn't need nearly as much handling as
2625 primary; when in two-weapon mode, we know it's one-handed
2626 with something else in the other hand and also that it's
2627 a weapon or weptool rather than something unusual, plus
2628 we don't need to compare its type with the primary */
2629 otherwep = is_sword(otmp) ? c_sword : weapon_descr(otmp);
2630 if (otmp->quan > 1L)
2631 otherwep = makeplural(otherwep);
2632 hand = body_part(HAND);
2638 Your("%s %s%s from your %s%s.", otherwep, xfl ? "also " : "",
2639 otense(otmp, "slip"), which, hand);
2641 You("%s%s%s%s
\82©
\82ç
\8a\8a\82è
\97\8e\82Æ
\82µ
\82½
\81D", otherwep, xfl ? "
\82à
\82Ü
\82½" : "
\82ð",
2642 which, body_part(HAND));
2646 setuswapwep((struct obj *) 0); /* clears u.twoweap */
2647 if (canletgo(otmp, ""))
2651 if (otmp && !welded(otmp)) {
2652 long savequan = otmp->quan;
2654 /* nice wording if both weapons are the same type */
2655 thiswep = is_sword(otmp) ? c_sword : weapon_descr(otmp);
2656 if (otherwep && strcmp(thiswep, makesingular(otherwep)))
2658 if (otmp->quan > 1L) {
2659 /* most class names for unconventional wielded items
2660 are ok, but if wielding multiple apples or rations
2661 we don't want "your foods slip", so force non-corpse
2662 food to be singular; skipping makeplural() isn't
2663 enough--we need to fool otense() too */
2664 if (!strcmp(thiswep, "food"))
2667 thiswep = makeplural(thiswep);
2669 hand = body_part(HAND);
2672 hand = makeplural(hand);
2673 else if (wastwoweap)
2675 which = "right "; /* preceding msg was about left */
2677 which = "
\89E"; /* preceding msg was about left */
2680 pline("%s %s%s %s%s from your %s%s.",
2681 !strncmp(thiswep, "corpse", 6) ? "The" : "Your",
2682 otherwep ? "other " : "", thiswep, xfl ? "also " : "",
2683 otense(otmp, "slip"), which, hand);
2685 You("%s%s%s%s%s
\82©
\82ç
\8a\8a\82è
\97\8e\82Æ
\82µ
\82½
\81D",
2686 otherwep ? "
\82à
\82¤
\82Ð
\82Æ
\82Â
\82Ì" : "", thiswep,
2687 xfl ? "
\82à
\82Ü
\82½" : "
\82ð",
2688 which, body_part(HAND));
2691 otmp->quan = savequan;
2692 setuwep((struct obj *) 0);
2693 if (canletgo(otmp, ""))
2700 struct monst *victim;
2702 register struct obj *otmph, *otmp;
2704 otmph = (victim == &youmonst) ? uarmc : which_armor(victim, W_ARMC);
2706 otmph = (victim == &youmonst) ? uarm : which_armor(victim, W_ARM);
2708 otmph = (victim == &youmonst) ? uarmu : which_armor(victim, W_ARMU);
2710 otmp = (victim == &youmonst) ? uarmh : which_armor(victim, W_ARMH);
2711 if (otmp && (!otmph || !rn2(4)))
2713 otmp = (victim == &youmonst) ? uarmg : which_armor(victim, W_ARMG);
2714 if (otmp && (!otmph || !rn2(4)))
2716 otmp = (victim == &youmonst) ? uarmf : which_armor(victim, W_ARMF);
2717 if (otmp && (!otmph || !rn2(4)))
2719 otmp = (victim == &youmonst) ? uarms : which_armor(victim, W_ARMS);
2720 if (otmp && (!otmph || !rn2(4)))
2725 /* used for praying to check and fix levitation trouble */
2727 stuck_ring(ring, otyp)
2731 if (ring != uleft && ring != uright) {
2732 impossible("stuck_ring: neither left nor right?");
2733 return (struct obj *) 0;
2736 if (ring && ring->otyp == otyp) {
2737 /* reasons ring can't be removed match those checked by select_off();
2738 limbless case has extra checks because ordinarily it's temporary */
2739 if (nolimbs(youmonst.data) && uamul
2740 && uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed)
2742 if (welded(uwep) && (ring == uright || bimanual(uwep)))
2744 if (uarmg && uarmg->cursed)
2748 /* normally outermost layer is processed first, but slippery gloves
2749 wears off quickly so uncurse ring itself before handling those */
2753 /* either no ring or not right type or nothing prevents its removal */
2754 return (struct obj *) 0;
2757 /* also for praying; find worn item that confers "Unchanging" attribute */
2761 if (uamul && uamul->otyp == AMULET_OF_UNCHANGING)
2769 register struct obj *otmp;
2776 *buf = '\0'; /* lint suppression */
2778 /* special ring checks */
2779 if (otmp == uright || otmp == uleft) {
2780 struct obj glibdummy;
2782 if (nolimbs(youmonst.data)) {
2784 pline_The("ring is stuck.");
2786 pline("
\8ew
\97Ö
\82Í
\91Ì
\82É
\96\84\82Ü
\82Á
\82Ä
\82µ
\82Ü
\82Á
\82Ä
\82¢
\82é
\81D");
2790 glibdummy = zeroobj;
2791 why = 0; /* the item which prevents ring removal */
2792 if (welded(uwep) && (otmp == uright || bimanual(uwep))) {
2794 Sprintf(buf, "free a weapon %s", body_part(HAND));
2796 Sprintf(buf, "
\97\98\98r
\82Ì
\8e©
\97R
\82ª
\82«
\82©
\82È
\82¢");
2798 } else if (uarmg && (uarmg->cursed || Glib)) {
2800 Sprintf(buf, "take off your %s%s",
2801 Glib ? "slippery " : "", gloves_simple_name(uarmg));
2803 Sprintf(buf, "%s%s
\82ª
\92E
\82°
\82È
\82¢",
2804 Glib ? "
\82Ê
\82é
\82Ê
\82é
\82Ì" : "", gloves_simple_name(uarmg));
2806 why = !Glib ? uarmg : &glibdummy;
2810 You("cannot %s to remove the ring.", buf);
2812 You("
\8ew
\97Ö
\82ð
\82Í
\82¸
\82»
\82¤
\82Æ
\82µ
\82½
\82ª%s
\81D", buf);
2817 /* special glove checks */
2818 if (otmp == uarmg) {
2821 You("are unable to take off your %s while wielding that %s.",
2822 c_gloves, is_sword(uwep) ? c_sword : c_weapon);
2824 You("%s
\82ð
\8e\9d\82Á
\82½
\82Ü
\82Ü%s
\82ð
\82Í
\82¸
\82·
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81D",
2825 is_sword(uwep) ? c_sword : c_weapon, c_gloves);
2827 set_bknown(uwep, 1);
2831 pline("%s %s are too slippery to take off.",
2832 uarmg->unpaid ? "The" : "Your", /* simplified Shk_Your() */
2833 gloves_simple_name(uarmg));
2835 pline("%s
\82Í
\82·
\82×
\82é
\82Ì
\82Å
\92E
\82®
\82±
\82Æ
\82ª
\82Å
\82«
\82È
\82¢
\81D",
2836 gloves_simple_name(uarmg));
2841 /* special boot checks */
2842 if (otmp == uarmf) {
2843 if (u.utrap && u.utraptype == TT_BEARTRAP) {
2845 pline_The("bear trap prevents you from pulling your %s out.",
2847 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",
2850 } else if (u.utrap && u.utraptype == TT_INFLOOR) {
2852 You("are stuck in the %s, and cannot pull your %s out.",
2854 You("%s
\82ª%s
\82É
\82Í
\82Ü
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\92E
\82®
\82±
\82Æ
\82ª
\82Å
\82«
\82È
\82¢
\81D",
2855 surface(u.ux, u.uy), makeplural(body_part(FOOT)));
2859 /* special suit and shirt checks */
2860 if (otmp == uarm || otmp == uarmu) {
2861 why = 0; /* the item which prevents disrobing */
2862 if (uarmc && uarmc->cursed) {
2864 Sprintf(buf, "remove your %s", cloak_simple_name(uarmc));
2866 Sprintf(buf, "%s
\82ª
\92E
\82°
\82È
\82¢", cloak_simple_name(uarmc));
2868 } else if (otmp == uarmu && uarm && uarm->cursed) {
2870 Sprintf(buf, "remove your %s", c_suit);
2872 Sprintf(buf, "%s
\82ª
\92E
\82°
\82È
\82¢", c_suit);
2874 } else if (welded(uwep) && bimanual(uwep)) {
2876 Sprintf(buf, "release your %s",
2877 is_sword(uwep) ? c_sword : (uwep->otyp == BATTLE_AXE)
2881 Sprintf(buf, "%s
\82ª
\8eè
\95ú
\82¹
\82È
\82¢",
2882 is_sword(uwep) ? c_sword : (uwep->otyp == BATTLE_AXE)
2890 You("cannot %s to take off %s.", buf, the(xname(otmp)));
2892 You("%s
\82ð
\82Í
\82¸
\82»
\82¤
\82Æ
\82µ
\82½
\82ª%s
\81D", xname(otmp), buf);
2897 /* basic curse check */
2898 if (otmp == uquiver || (otmp == uswapwep && !u.twoweap)) {
2899 ; /* some items can be removed even when cursed */
2901 /* otherwise, this is fundamental */
2907 context.takeoff.mask |= WORN_ARMOR;
2908 else if (otmp == uarmc)
2909 context.takeoff.mask |= WORN_CLOAK;
2910 else if (otmp == uarmf)
2911 context.takeoff.mask |= WORN_BOOTS;
2912 else if (otmp == uarmg)
2913 context.takeoff.mask |= WORN_GLOVES;
2914 else if (otmp == uarmh)
2915 context.takeoff.mask |= WORN_HELMET;
2916 else if (otmp == uarms)
2917 context.takeoff.mask |= WORN_SHIELD;
2918 else if (otmp == uarmu)
2919 context.takeoff.mask |= WORN_SHIRT;
2920 else if (otmp == uleft)
2921 context.takeoff.mask |= LEFT_RING;
2922 else if (otmp == uright)
2923 context.takeoff.mask |= RIGHT_RING;
2924 else if (otmp == uamul)
2925 context.takeoff.mask |= WORN_AMUL;
2926 else if (otmp == ublindf)
2927 context.takeoff.mask |= WORN_BLINDF;
2928 else if (otmp == uwep)
2929 context.takeoff.mask |= W_WEP;
2930 else if (otmp == uswapwep)
2931 context.takeoff.mask |= W_SWAPWEP;
2932 else if (otmp == uquiver)
2933 context.takeoff.mask |= W_QUIVER;
2936 impossible("select_off: %s???", doname(otmp));
2941 STATIC_OVL struct obj *
2944 struct obj *otmp = (struct obj *) 0;
2945 struct takeoff_info *doff = &context.takeoff;
2947 context.takeoff.mask |= I_SPECIAL; /* set flag for cancel_doff() */
2948 if (doff->what == W_WEP) {
2949 if (!cursed(uwep)) {
2950 setuwep((struct obj *) 0);
2952 You("are empty %s.", body_part(HANDED));
2954 You("
\89½
\82à%s
\82É
\82µ
\82Ä
\82¢
\82È
\82¢
\81D", body_part(HAND));
2957 } else if (doff->what == W_SWAPWEP) {
2958 setuswapwep((struct obj *) 0);
2960 You("no longer have a second weapon readied.");
2962 You("
\97\
\94õ
\82Ì
\95\90\8aí
\82ð
\82¨
\82³
\82ß
\82½
\81D");
2964 } else if (doff->what == W_QUIVER) {
2965 setuqwep((struct obj *) 0);
2967 You("no longer have ammunition readied.");
2969 You("
\8f\80\94õ
\82µ
\82½
\96î
\92e
\82ð
\82¨
\82³
\82ß
\82½
\81D");
2970 } else if (doff->what == WORN_ARMOR) {
2974 } else if (doff->what == WORN_CLOAK) {
2978 } else if (doff->what == WORN_BOOTS) {
2982 } else if (doff->what == WORN_GLOVES) {
2985 (void) Gloves_off();
2986 } else if (doff->what == WORN_HELMET) {
2989 (void) Helmet_off();
2990 } else if (doff->what == WORN_SHIELD) {
2993 (void) Shield_off();
2994 } else if (doff->what == WORN_SHIRT) {
2998 } else if (doff->what == WORN_AMUL) {
3002 } else if (doff->what == LEFT_RING) {
3006 } else if (doff->what == RIGHT_RING) {
3010 } else if (doff->what == WORN_BLINDF) {
3011 if (!cursed(ublindf))
3012 Blindf_off(ublindf);
3014 impossible("do_takeoff: taking off %lx", doff->what);
3016 context.takeoff.mask &= ~I_SPECIAL; /* clear cancel_doff() flag */
3021 /* occupation callback for 'A' */
3027 register struct obj *otmp;
3028 struct takeoff_info *doff = &context.takeoff;
3031 if (doff->delay > 0) {
3033 return 1; /* still busy */
3035 if ((otmp = do_takeoff()) != 0)
3037 doff->mask &= ~doff->what;
3041 for (i = 0; takeoff_order[i]; i++)
3042 if (doff->mask & takeoff_order[i]) {
3043 doff->what = takeoff_order[i];
3047 otmp = (struct obj *) 0;
3050 if (doff->what == 0L) {
3052 You("finish %s.", doff->disrobing);
3054 You("
\91\95\94õ
\82ð
\89ð
\82«
\82¨
\82¦
\82½
\81D");
3056 } else if (doff->what == W_WEP) {
3058 } else if (doff->what == W_SWAPWEP) {
3060 } else if (doff->what == W_QUIVER) {
3062 } else if (doff->what == WORN_ARMOR) {
3064 /* If a cloak is being worn, add the time to take it off and put
3065 * it back on again. Kludge alert! since that time is 0 for all
3066 * known cloaks, add 1 so that it actually matters...
3069 doff->delay += 2 * objects[uarmc->otyp].oc_delay + 1;
3070 } else if (doff->what == WORN_CLOAK) {
3072 } else if (doff->what == WORN_BOOTS) {
3074 } else if (doff->what == WORN_GLOVES) {
3076 } else if (doff->what == WORN_HELMET) {
3078 } else if (doff->what == WORN_SHIELD) {
3080 } else if (doff->what == WORN_SHIRT) {
3082 /* add the time to take off and put back on armor and/or cloak */
3084 doff->delay += 2 * objects[uarm->otyp].oc_delay;
3086 doff->delay += 2 * objects[uarmc->otyp].oc_delay + 1;
3087 } else if (doff->what == WORN_AMUL) {
3089 } else if (doff->what == LEFT_RING) {
3091 } else if (doff->what == RIGHT_RING) {
3093 } else if (doff->what == WORN_BLINDF) {
3094 /* [this used to be 2, but 'R' (and 'T') only require 1 turn to
3095 remove a blindfold, so 'A' shouldn't have been requiring 2] */
3098 impossible("take_off: taking off %lx", doff->what);
3099 return 0; /* force done */
3103 doff->delay += objects[otmp->otyp].oc_delay;
3105 /* Since setting the occupation now starts the counter next move, that
3106 * would always produce a delay 1 too big per item unless we subtract
3107 * 1 here to account for it.
3109 if (doff->delay > 0)
3112 set_occupation(take_off, doff->disrobing, 0);
3113 return 1; /* get busy */
3116 /* clear saved context to avoid inappropriate resumption of interrupted 'A' */
3120 context.takeoff.what = context.takeoff.mask = 0L;
3121 context.takeoff.disrobing[0] = '\0';
3124 /* the 'A' command -- remove multiple worn items */
3130 if (context.takeoff.what || context.takeoff.mask) {
3132 You("continue %s.", context.takeoff.disrobing);
3134 You("
\91\95\94õ
\82ð
\89ð
\82
\82Ì
\82ð
\8dÄ
\8aJ
\82µ
\82½
\81D");
3136 set_occupation(take_off, context.takeoff.disrobing, 0);
3138 set_occupation(take_off, "
\91\95\94õ
\82ð
\89ð
\82", 0);
3140 } else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf && !uleft
3141 && !uright && !wearing_armor()) {
3143 You("are not wearing anything.");
3145 You("
\89½
\82à
\91\95\94õ
\82µ
\82Ä
\82¢
\82È
\82¢
\81D");
3149 add_valid_menu_class(0); /* reset */
3150 if (flags.menu_style != MENU_TRADITIONAL
3151 || (result = ggetobj("take off", select_off, 0, FALSE,
3152 (unsigned *) 0)) < -1)
3153 result = menu_remarm(result);
3155 if (context.takeoff.mask) {
3156 #if 0 /*JP*//*
\93ú
\96{
\8cê
\82Å
\82Í
\8eg
\82í
\82È
\82¢*/
3157 /* default activity for armor and/or accessories,
3158 possibly combined with weapons */
3159 (void) strncpy(context.takeoff.disrobing, "disrobing", CONTEXTVERBSZ);
3160 /* specific activity when handling weapons only */
3161 if (!(context.takeoff.mask & ~W_WEAPONS))
3162 (void) strncpy(context.takeoff.disrobing, "disarming",
3167 /* The time to perform the command is already completely accounted for
3168 * in take_off(); if we return 1, that would add an extra turn to each
3179 menu_item *pick_list;
3180 boolean all_worn_categories = TRUE;
3183 all_worn_categories = (retry == -2);
3184 } else if (flags.menu_style == MENU_FULL) {
3185 all_worn_categories = FALSE;
3187 n = query_category("What type of things do you want to take off?",
3189 n = query_category("
\82Ç
\82Ì
\83^
\83C
\83v
\82Ì
\95¨
\82Ì
\91\95\94õ
\82ð
\89ð
\82«
\82Ü
\82·
\82©
\81H",
3190 invent, (WORN_TYPES | ALL_TYPES
3191 | UNPAID_TYPES | BUCX_TYPES),
3192 &pick_list, PICK_ANY);
3195 for (i = 0; i < n; i++) {
3196 if (pick_list[i].item.a_int == ALL_TYPES_SELECTED)
3197 all_worn_categories = TRUE;
3199 add_valid_menu_class(pick_list[i].item.a_int);
3201 free((genericptr_t) pick_list);
3202 } else if (flags.menu_style == MENU_COMBINATION) {
3203 unsigned ggofeedback = 0;
3205 i = ggetobj("take off", select_off, 0, TRUE, &ggofeedback);
3206 if (ggofeedback & ALL_FINISHED)
3208 all_worn_categories = (i == -2);
3210 if (menu_class_present('u')
3211 || menu_class_present('B') || menu_class_present('U')
3212 || menu_class_present('C') || menu_class_present('X'))
3213 all_worn_categories = FALSE;
3216 n = query_objlist("What do you want to take off?", &invent,
3217 (SIGNAL_NOMENU | USE_INVLET | INVORDER_SORT),
3218 &pick_list, PICK_ANY,
3219 all_worn_categories ? is_worn : is_worn_by_type);
3221 n = query_objlist("
\82Ç
\82Ì
\91\95\94õ
\82ð
\89ð
\82«
\82Ü
\82·
\82©
\81H", &invent,
3222 (SIGNAL_NOMENU | USE_INVLET | INVORDER_SORT),
3223 &pick_list, PICK_ANY,
3224 all_worn_categories ? is_worn : is_worn_by_type);
3227 for (i = 0; i < n; i++)
3228 (void) select_off(pick_list[i].item.a_obj);
3229 free((genericptr_t) pick_list);
3230 } else if (n < 0 && flags.menu_style != MENU_COMBINATION) {
3232 There("is nothing else you can remove or unwield.");
3234 pline("
\91\95\94õ
\82ð
\89ð
\82¯
\82é
\82à
\82Ì
\82Í
\89½
\82à
\82È
\82¢
\81D");
3239 /* hit by destroy armor scroll/black dragon breath/monster spell */
3242 register struct obj *atmp;
3244 register struct obj *otmp;
3245 #define DESTROY_ARM(o) \
3246 ((otmp = (o)) != 0 && (!atmp || atmp == otmp) \
3247 && (!obj_resists(otmp, 0, 90)) \
3248 ? (otmp->in_use = TRUE) \
3251 if (DESTROY_ARM(uarmc)) {
3255 Your("%s crumbles and turns to dust!", cloak_simple_name(uarmc));
3257 Your("%s
\82Í
\95²
\81X
\82É
\82È
\82Á
\82½
\81I", cloak_simple_name(uarmc));
3260 } else if (DESTROY_ARM(uarm)) {
3264 Your("armor turns to dust and falls to the %s!", surface(u.ux, u.uy));
3266 Your("
\8aZ
\82Í
\90o
\82Æ
\82È
\82è%s
\82É
\97\8e\82¿
\82½
\81I", surface(u.ux,u.uy));
3267 (void) Armor_gone();
3269 } else if (DESTROY_ARM(uarmu)) {
3273 Your("shirt crumbles into tiny threads and falls apart!");
3275 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");
3278 } else if (DESTROY_ARM(uarmh)) {
3282 Your("%s turns to dust and is blown away!", helm_simple_name(uarmh));
3284 Your("%s
\82Í
\90o
\82Æ
\82È
\82è
\90\81\82«
\82Æ
\82ñ
\82¾
\81I", helm_simple_name(uarmh));
3285 (void) Helmet_off();
3287 } else if (DESTROY_ARM(uarmg)) {
3291 Your("gloves vanish!");
3293 Your("
\8f¬
\8eè
\82Í
\8fÁ
\82¦
\82½
\81I");
3294 (void) Gloves_off();
3299 selftouch("
\82»
\82Ì
\82Æ
\82«
\82 \82È
\82½
\82Í");
3300 } else if (DESTROY_ARM(uarmf)) {
3304 Your("boots disintegrate!");
3306 Your("
\8cC
\82Í
\95²
\81X
\82É
\8dÓ
\82¯
\82½
\81I");
3309 } else if (DESTROY_ARM(uarms)) {
3313 Your("shield crumbles away!");
3315 Your("
\8f\82\82Í
\8dÓ
\82¯
\8eU
\82Á
\82½
\81I");
3316 (void) Shield_off();
3319 return 0; /* could not destroy anything */
3328 adj_abon(otmp, delta)
3329 register struct obj *otmp;
3330 register schar delta;
3332 if (uarmg && uarmg == otmp && otmp->otyp == GAUNTLETS_OF_DEXTERITY) {
3334 makeknown(uarmg->otyp);
3335 ABON(A_DEX) += (delta);
3339 if (uarmh && uarmh == otmp && otmp->otyp == HELM_OF_BRILLIANCE) {
3341 makeknown(uarmh->otyp);
3342 ABON(A_INT) += (delta);
3343 ABON(A_WIS) += (delta);
3349 /* decide whether a worn item is covered up by some other worn item,
3350 used for dipping into liquid and applying grease;
3351 some criteria are different than select_off()'s */
3353 inaccessible_equipment(obj, verb, only_if_known_cursed)
3355 const char *verb; /* "dip" or "grease", or null to avoid messages */
3356 /*JP:
\93ú
\96{
\8cê
\82Å
\82Í "
\82ð
\90Z
\82·", "
\82É
\8e\89\82ð
\93h
\82é", null
\82Ì
\82¢
\82¸
\82ê
\82©*/
3357 boolean only_if_known_cursed; /* ignore covering unless known to be cursed */
3360 static NEARDATA const char need_to_take_off_outer_armor[] =
3361 "need to take off %s to %s %s.";
3362 #else /*JP:
\88ø
\90\94\82ª
\8c´
\95¶
\82Æ
\95Ï
\82í
\82Á
\82Ä
\82¢
\82é
\82±
\82Æ
\82É
\92\8d\88Ó*/
3363 static NEARDATA const char need_to_take_off_outer_armor[] =
3364 "%s%s
\82É
\82Í%s
\82ð%s
\95K
\97v
\82ª
\82 \82é
\81D";
3367 boolean anycovering = !only_if_known_cursed; /* more comprehensible... */
3368 #define BLOCKSACCESS(x) (anycovering || ((x)->cursed && (x)->bknown))
3370 if (!obj || !obj->owornmask)
3371 return FALSE; /* not inaccessible */
3373 /* check for suit covered by cloak */
3374 if (obj == uarm && uarmc && BLOCKSACCESS(uarmc)) {
3376 Strcpy(buf, yname(uarmc));
3378 You(need_to_take_off_outer_armor, buf, verb, yname(obj));
3379 #else /*JP:
\91Î
\8fÛ
\82Í
\83N
\83\8d\81[
\83N
\82È
\82Ì
\82Åjoffmsg
\82ð
\8eg
\82í
\82¸
\8c\88\82ß
\8c\82\82¿*/
3380 You(need_to_take_off_outer_armor, xname(obj), verb, buf, "
\92E
\82®");
3385 /* check for shirt covered by suit and/or cloak */
3387 && ((uarm && BLOCKSACCESS(uarm)) || (uarmc && BLOCKSACCESS(uarmc)))) {
3389 char cloaktmp[QBUFSZ], suittmp[QBUFSZ];
3390 /* if sameprefix, use yname and xname to get "your cloak and suit"
3391 or "Manlobbi's cloak and suit"; otherwise, use yname and yname
3392 to get "your cloak and Manlobbi's suit" or vice versa */
3393 boolean sameprefix = (uarm && uarmc
3394 && !strcmp(shk_your(cloaktmp, uarmc),
3395 shk_your(suittmp, uarm)));
3399 Strcat(buf, yname(uarmc));
3402 Strcat(buf, " and ");
3404 Strcat(buf, "
\82Æ");
3406 Strcat(buf, sameprefix ? xname(uarm) : yname(uarm));
3408 You(need_to_take_off_outer_armor, buf, verb, yname(obj));
3409 #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¿*/
3410 You(need_to_take_off_outer_armor, xname(obj), verb, buf, "
\92E
\82®");
3415 /* check for ring covered by gloves */
3416 if ((obj == uleft || obj == uright) && uarmg && BLOCKSACCESS(uarmg)) {
3418 Strcpy(buf, yname(uarmg));
3420 You(need_to_take_off_outer_armor, buf, verb, yname(obj));
3421 #else /*JP:
\91Î
\8fÛ
\82Í
\8f¬
\8eè
\82È
\82Ì
\82Åjoffmsg
\82ð
\8eg
\82í
\82¸
\8c\88\82ß
\8c\82\82¿*/
3422 You(need_to_take_off_outer_armor, xname(obj), verb, buf, "
\82Í
\82¸
\82·");
3427 /* item is not inaccessible */