Fandom

Wikihack

Source:SLASH'EM 0.0.7E7F2/do wear.c

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Below is the full text to do_wear.c from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/do_wear.c#line123]], for example.

The latest source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)do_wear.c	3.4	2003/11/14	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #include "hack.h"
6.    
7.    #ifndef OVLB
8.    
9.    STATIC_DCL long takeoff_mask, taking_off;
10.   
11.   #else /* OVLB */
12.   
13.   STATIC_OVL NEARDATA long takeoff_mask = 0L;
14.   static NEARDATA long taking_off = 0L;
15.   
16.   static NEARDATA int todelay;
17.   static boolean cancelled_don = FALSE;
18.   
19.   static NEARDATA const char see_yourself[] = "see yourself";
20.   static NEARDATA const char unknown_type[] = "Unknown type of %s (%d)";
21.   static NEARDATA const char c_armor[]  = "armor",
22.   			   c_suit[]   = "suit",
23.   #ifdef TOURIST
24.   			   c_shirt[]  = "shirt",
25.   #endif
26.   			   c_cloak[]  = "cloak",
27.   			   c_gloves[] = "gloves",
28.   			   c_boots[]  = "boots",
29.   			   c_helmet[] = "helmet",
30.   			   c_shield[] = "shield",
31.   			   c_weapon[] = "weapon",
32.   			   c_sword[]  = "sword",
33.   			   c_axe[]    = "axe",
34.   			   c_that_[]  = "that";
35.   
36.   static NEARDATA const long takeoff_order[] = { WORN_BLINDF, W_WEP,
37.   	WORN_SHIELD, WORN_GLOVES, LEFT_RING, RIGHT_RING, WORN_CLOAK,
38.   	WORN_HELMET, WORN_AMUL, WORN_ARMOR,
39.   #ifdef TOURIST
40.   	WORN_SHIRT,
41.   #endif
42.   	WORN_BOOTS, W_SWAPWEP, W_QUIVER, 0L };
43.   
44.   STATIC_DCL void FDECL(on_msg, (struct obj *));
45.   STATIC_DCL void FDECL(Ring_off_or_gone, (struct obj *, BOOLEAN_P));
46.   STATIC_PTR int FDECL(select_off, (struct obj *));
47.   STATIC_DCL struct obj *NDECL(do_takeoff);
48.   STATIC_PTR int NDECL(take_off);
49.   STATIC_DCL int FDECL(menu_remarm, (int));
50.   STATIC_DCL void FDECL(already_wearing, (const char*));
51.   STATIC_DCL void FDECL(already_wearing2, (const char*, const char*));
52.   
53.   void
54.   off_msg(otmp)
55.   register struct obj *otmp;
56.   {
57.   	if(flags.verbose)
58.   	    You("were wearing %s.", doname(otmp));
59.   }
60.   
61.   /* for items that involve no delay */
62.   STATIC_OVL void
63.   on_msg(otmp)
64.   register struct obj *otmp;
65.   {
66.   	if (flags.verbose) {
67.   	    char how[BUFSZ];
68.   
69.   	    how[0] = '\0';
70.   	    if (otmp->otyp == TOWEL)
71.   		Sprintf(how, " around your %s", body_part(HEAD));
72.   	    You("are now wearing %s%s.",
73.   		obj_is_pname(otmp) ? the(xname(otmp)) : an(xname(otmp)),
74.   		how);
75.   	}
76.   }
77.   
78.   /*
79.    * The Type_on() functions should be called *after* setworn().
80.    * The Type_off() functions call setworn() themselves.
81.    */
82.   
83.   int
84.   Boots_on()
85.   {
86.       long oldprop =
87.   	u.uprops[objects[uarmf->otyp].oc_oprop].extrinsic & ~WORN_BOOTS;
88.   
89.       switch(uarmf->otyp) {
90.   	case LOW_BOOTS:
91.   	case IRON_SHOES:
92.   	case HIGH_BOOTS:
93.   	case JUMPING_BOOTS:
94.   	case KICKING_BOOTS:
95.   		break;
96.   	case WATER_WALKING_BOOTS:
97.   		if (u.uinwater) spoteffects(TRUE);
98.   		break;
99.   	case SPEED_BOOTS:
100.  		/* Speed boots are still better than intrinsic speed, */
101.  		/* though not better than potion speed */
102.  		if (!oldprop && !(HFast & TIMEOUT)) {
103.  			makeknown(uarmf->otyp);
104.  			You_feel("yourself speed up%s.",
105.  				(oldprop || HFast) ? " a bit more" : "");
106.  		}
107.  		break;
108.  	case ELVEN_BOOTS:
109.  		if (!oldprop && !HStealth && !BStealth) {
110.  			makeknown(uarmf->otyp);
111.  			You("walk very quietly.");
112.  		}
113.  		break;
114.  	case FUMBLE_BOOTS:
115.  		if (!oldprop && !(HFumbling & ~TIMEOUT))
116.  			incr_itimeout(&HFumbling, rnd(20));
117.  		break;
118.  	case LEVITATION_BOOTS:
119.  		if (!oldprop && !HLevitation) {
120.  			makeknown(uarmf->otyp);
121.  			float_up();
122.  			spoteffects(FALSE);
123.  		}
124.  		break;
125.  	default: impossible(unknown_type, c_boots, uarmf->otyp);
126.      }
127.      return 0;
128.  }
129.  
130.  int
131.  Boots_off()
132.  {
133.      int otyp = uarmf->otyp;
134.      long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_BOOTS;
135.  
136.      takeoff_mask &= ~W_ARMF;
137.  	/* For levitation, float_down() returns if Levitation, so we
138.  	 * must do a setworn() _before_ the levitation case.
139.  	 */
140.      setworn((struct obj *)0, W_ARMF);
141.      switch (otyp) {
142.  	case SPEED_BOOTS:
143.  		if (!Very_fast && !cancelled_don) {
144.  			makeknown(otyp);
145.  			You_feel("yourself slow down%s.",
146.  				Fast ? " a bit" : "");
147.  		}
148.  		break;
149.  	case WATER_WALKING_BOOTS:
150.  		if (is_pool(u.ux,u.uy) && !Levitation && !Flying &&
151.  		    !is_clinger(youmonst.data) && !cancelled_don) {
152.  			makeknown(otyp);
153.  			/* make boots known in case you survive the drowning */
154.  			spoteffects(TRUE);
155.  		}
156.  		break;
157.  	case ELVEN_BOOTS:
158.  		if (!oldprop && !HStealth && !BStealth && !cancelled_don) {
159.  			makeknown(otyp);
160.  			You("sure are noisy.");
161.  		}
162.  		break;
163.  	case FUMBLE_BOOTS:
164.  		if (!oldprop && !(HFumbling & ~TIMEOUT))
165.  			HFumbling = EFumbling = 0;
166.  		break;
167.  	case LEVITATION_BOOTS:
168.  		if (!oldprop && !HLevitation && !cancelled_don) {
169.  			(void) float_down(0L, 0L);
170.  			makeknown(otyp);
171.  		}
172.  		break;
173.  	case LOW_BOOTS:
174.  	case IRON_SHOES:
175.  	case HIGH_BOOTS:
176.  	case JUMPING_BOOTS:
177.  	case KICKING_BOOTS:
178.  		break;
179.  	default: impossible(unknown_type, c_boots, otyp);
180.      }
181.      cancelled_don = FALSE;
182.      return 0;
183.  }
184.  
185.  int
186.  Cloak_on()
187.  {
188.      long oldprop =
189.  	u.uprops[objects[uarmc->otyp].oc_oprop].extrinsic & ~WORN_CLOAK;
190.  
191.      switch(uarmc->otyp) {
192.  	case ELVEN_CLOAK:
193.  	case CLOAK_OF_PROTECTION:
194.  	case CLOAK_OF_DISPLACEMENT:
195.  		makeknown(uarmc->otyp);
196.  		break;
197.  	case ORCISH_CLOAK:
198.  	case DWARVISH_CLOAK:
199.  	case CLOAK_OF_MAGIC_RESISTANCE:
200.  	case ROBE:
201.  	case LEATHER_CLOAK:
202.  	/* KMH, balance patch -- removed
203.  	case CLOAK_OF_DRAIN_RESISTANCE: */               
204.  		break;
205.  	/* KMH, balance patch -- lab coat gives poison _and_ acid resistance */
206.  	case LAB_COAT:
207.  		EAcid_resistance |= WORN_CLOAK;
208.  		break;
209.  	case MUMMY_WRAPPING:
210.  		/* Note: it's already being worn, so we have to cheat here. */
211.  		if ((HInvis || EInvis || pm_invisible(youmonst.data)) && !Blind) {
212.  		    newsym(u.ux,u.uy);
213.  		    You("can %s!",
214.  			See_invisible ? "no longer see through yourself"
215.  			: see_yourself);
216.  		}
217.  		break;
218.  	case CLOAK_OF_INVISIBILITY:
219.  		/* since cloak of invisibility was worn, we know mummy wrapping
220.  		   wasn't, so no need to check `oldprop' against blocked */
221.  		if (!oldprop && !HInvis && !Blind) {
222.  		    makeknown(uarmc->otyp);
223.  		    newsym(u.ux,u.uy);
224.  		    pline("Suddenly you can%s yourself.",
225.  			See_invisible ? " see through" : "not see");
226.  		}
227.  		break;
228.  	case POISONOUS_CLOAK:
229.  		if (Poison_resistance)
230.  			pline("This cloak feels a little itchy.");
231.  		else {
232.  		    makeknown(uarmc->otyp);
233.  		    poisoned("cloak",A_STR,"poisonous cloak",3);
234.  		}
235.  		break;
236.  	case OILSKIN_CLOAK:
237.  		pline("%s very tightly.", Tobjnam(uarmc, "fit"));
238.  		break;
239.  	/* Alchemy smock gives poison _and_ acid resistance */
240.  #if 0
241.  	case ALCHEMY_SMOCK:
242.  		EAcid_resistance |= WORN_CLOAK;
243.    		break;
244.  #endif
245.  	default: impossible(unknown_type, c_cloak, uarmc->otyp);
246.      }
247.      return 0;
248.  }
249.  
250.  int
251.  Cloak_off()
252.  {
253.      int otyp = uarmc->otyp;
254.      long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_CLOAK;
255.  
256.      takeoff_mask &= ~W_ARMC;
257.  	/* For mummy wrapping, taking it off first resets `Invisible'. */
258.      setworn((struct obj *)0, W_ARMC);
259.      switch (otyp) {
260.  	case ELVEN_CLOAK:
261.  	case ORCISH_CLOAK:
262.  	case DWARVISH_CLOAK:
263.  	case CLOAK_OF_PROTECTION:
264.  	case CLOAK_OF_MAGIC_RESISTANCE:
265.  	case CLOAK_OF_DISPLACEMENT:
266.  	case POISONOUS_CLOAK:
267.  	case OILSKIN_CLOAK:
268.  	case ROBE:
269.  	case LEATHER_CLOAK:
270.  	/* KMH, balance patch -- removed
271.  	case CLOAK_OF_DRAIN_RESISTANCE: */
272.  		break;
273.  	/* KMH, balance patch -- lab coat gives poison _and_ acid resistance */
274.  	case LAB_COAT:
275.  		EAcid_resistance &= ~WORN_CLOAK;
276.  		break;
277.  	case MUMMY_WRAPPING:
278.  		if (Invis && !Blind) {
279.  		    newsym(u.ux,u.uy);
280.  		    You("can %s.",
281.  			See_invisible ? "see through yourself"
282.  			: "no longer see yourself");
283.  		}
284.  		break;
285.  	case CLOAK_OF_INVISIBILITY:
286.  		if (!oldprop && !HInvis && !Blind) {
287.  		    makeknown(CLOAK_OF_INVISIBILITY);
288.  		    newsym(u.ux,u.uy);
289.  		    pline("Suddenly you can %s.",
290.  			See_invisible ? "no longer see through yourself"
291.  			: see_yourself);
292.  		}
293.  		break;
294.  #if 0
295.  	/* Alchemy smock gives poison _and_ acid resistance */
296.  	case ALCHEMY_SMOCK:
297.  		EAcid_resistance &= ~WORN_CLOAK;
298.    		break;
299.  #endif
300.  	default: impossible(unknown_type, c_cloak, otyp);
301.      }
302.      return 0;
303.  }
304.  
305.  int
306.  Helmet_on()
307.  {
308.      switch(uarmh->otyp) {
309.  	case FEDORA:
310.  		set_moreluck();
311.  		break;
312.  	case HELMET:
313.  	case DENTED_POT:
314.  	case ELVEN_LEATHER_HELM:
315.  	case DWARVISH_IRON_HELM:
316.  	case ORCISH_HELM:
317.  	/* KMH, balance patch -- removed
318.  	case FIRE_HELMET: */
319.  	case HELM_OF_TELEPATHY:
320.  		break;
321.  	case HELM_OF_BRILLIANCE:
322.  		adj_abon(uarmh, uarmh->spe);
323.  		break;
324.  	case CORNUTHAUM:
325.  		/* people think marked wizards know what they're talking
326.  		 * about, but it takes trained arrogance to pull it off,
327.  		 * and the actual enchantment of the hat is irrelevant.
328.  		 */
329.  		ABON(A_CHA) += (Role_if(PM_WIZARD) ? 1 : -1);
330.  		flags.botl = 1;
331.  		makeknown(uarmh->otyp);
332.  		break;
333.  	case HELM_OF_OPPOSITE_ALIGNMENT:
334.  		if (u.ualign.type == A_NEUTRAL)
335.  		    u.ualign.type = rn2(2) ? A_CHAOTIC : A_LAWFUL;
336.  		else u.ualign.type = -(u.ualign.type);
337.  		u.ublessed = 0; /* lose your god's protection */
338.  	     /* makeknown(uarmh->otyp);   -- moved below, after xname() */
339.  		/*FALLTHRU*/
340.  	case DUNCE_CAP:
341.  		if (!uarmh->cursed) {
342.  		    if (Blind)
343.  			pline("%s for a moment.", Tobjnam(uarmh, "vibrate"));
344.  		    else
345.  			pline("%s %s for a moment.",
346.  			      Tobjnam(uarmh, "glow"), hcolor(NH_BLACK));
347.  		    curse(uarmh);
348.  		}
349.  		flags.botl = 1;		/* reveal new alignment or INT & WIS */
350.  		if (Hallucination) {
351.  		    pline("My brain hurts!"); /* Monty Python's Flying Circus */
352.  		} else if (uarmh->otyp == DUNCE_CAP) {
353.  		    You_feel("%s.",	/* track INT change; ignore WIS */
354.  		  ACURR(A_INT) <= (ABASE(A_INT) + ABON(A_INT) + ATEMP(A_INT)) ?
355.  			     "like sitting in a corner" : "giddy");
356.  		} else {
357.  		    Your("mind oscillates briefly.");
358.  		    makeknown(HELM_OF_OPPOSITE_ALIGNMENT);
359.  		}
360.  		break;
361.  	default: impossible(unknown_type, c_helmet, uarmh->otyp);
362.      }
363.      return 0;
364.  }
365.  
366.  int
367.  Helmet_off()
368.  {
369.      takeoff_mask &= ~W_ARMH;
370.  
371.      switch(uarmh->otyp) {
372.  	case FEDORA:
373.  	    setworn((struct obj *)0, W_ARMH);
374.  	    set_moreluck();
375.  	    return 0;
376.  	case HELMET:
377.  	case DENTED_POT:
378.  	case ELVEN_LEATHER_HELM:
379.  	case DWARVISH_IRON_HELM:
380.  	case ORCISH_HELM:
381.  	/* KMH, balance patch -- removed
382.  	case FIRE_HELMET: */
383.  	    break;
384.  	case DUNCE_CAP:
385.  	    flags.botl = 1;
386.  	    break;
387.  	case CORNUTHAUM:
388.  	    if (!cancelled_don) {
389.  		ABON(A_CHA) += (Role_if(PM_WIZARD) ? -1 : 1);
390.  		flags.botl = 1;
391.  	    }
392.  	    break;
393.  	case HELM_OF_TELEPATHY:
394.  	    /* need to update ability before calling see_monsters() */
395.  	    setworn((struct obj *)0, W_ARMH);
396.  	    see_monsters();
397.  	    return 0;
398.  	case HELM_OF_BRILLIANCE:
399.  	    if (!cancelled_don) adj_abon(uarmh, -uarmh->spe);
400.  	    break;
401.  	case HELM_OF_OPPOSITE_ALIGNMENT:
402.  	    u.ualign.type = u.ualignbase[A_CURRENT];
403.  	    u.ublessed = 0; /* lose the other god's protection */
404.  	    flags.botl = 1;
405.  	    break;
406.  	default: impossible(unknown_type, c_helmet, uarmh->otyp);
407.      }
408.      setworn((struct obj *)0, W_ARMH);
409.      cancelled_don = FALSE;
410.      return 0;
411.  }
412.  
413.  int
414.  Gloves_on()
415.  {
416.      long oldprop =
417.  	u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES;
418.  
419.      switch(uarmg->otyp) {
420.  	case LEATHER_GLOVES:
421.  		break;
422.  	case GAUNTLETS_OF_SWIMMING:
423.  		if (u.uinwater) {
424.  		   pline("Hey! You can swim!");
425.  		   spoteffects(TRUE);
426.  		}
427.  		break;
428.  	case GAUNTLETS_OF_FUMBLING:
429.  		if (!oldprop && !(HFumbling & ~TIMEOUT))
430.  			incr_itimeout(&HFumbling, rnd(20));
431.  		break;
432.  	case GAUNTLETS_OF_POWER:
433.  		makeknown(uarmg->otyp);
434.  		flags.botl = 1; /* taken care of in attrib.c */
435.  		break;
436.  	case GAUNTLETS_OF_DEXTERITY:
437.  		adj_abon(uarmg, uarmg->spe);
438.  		break;
439.  	default: impossible(unknown_type, c_gloves, uarmg->otyp);
440.      }
441.      return 0;
442.  }
443.  
444.  int
445.  Gloves_off()
446.  {
447.      long oldprop =
448.  	u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES;
449.  
450.      takeoff_mask &= ~W_ARMG;
451.  
452.      switch(uarmg->otyp) {
453.  	case LEATHER_GLOVES:
454.  	    break;
455.  	case GAUNTLETS_OF_SWIMMING:
456.  	    if (u.uinwater) {
457.  	       You("begin to thrash about!");
458.  	       spoteffects(TRUE);
459.  	    }
460.  	    break;
461.  	case GAUNTLETS_OF_FUMBLING:
462.  	    if (!oldprop && !(HFumbling & ~TIMEOUT))
463.  		HFumbling = EFumbling = 0;
464.  	    break;
465.  	case GAUNTLETS_OF_POWER:
466.  	    makeknown(uarmg->otyp);
467.  	    flags.botl = 1; /* taken care of in attrib.c */
468.  	    break;
469.  	case GAUNTLETS_OF_DEXTERITY:
470.  	    if (!cancelled_don) adj_abon(uarmg, -uarmg->spe);
471.  	    break;
472.  	default: impossible(unknown_type, c_gloves, uarmg->otyp);
473.      }
474.      setworn((struct obj *)0, W_ARMG);
475.      cancelled_don = FALSE;
476.      (void) encumber_msg();		/* immediate feedback for GoP */
477.  
478.      /* Prevent wielding cockatrice when not wearing gloves */
479.      if (uwep && uwep->otyp == CORPSE &&
480.  		touch_petrifies(&mons[uwep->corpsenm])) {
481.  	char kbuf[BUFSZ];
482.  
483.  	You("wield the %s in your bare %s.",
484.  	    corpse_xname(uwep, TRUE), makeplural(body_part(HAND)));
485.  	Strcpy(kbuf, an(killer_cxname(uwep, TRUE)));
486.  	instapetrify(kbuf);
487.  	uwepgone();  /* life-saved still doesn't allow touching cockatrice */
488.      }
489.  
490.      /* KMH -- ...or your secondary weapon when you're wielding it */
491.      if (u.twoweap && uswapwep && uswapwep->otyp == CORPSE &&
492.  	touch_petrifies(&mons[uswapwep->corpsenm])) {
493.  	char kbuf[BUFSZ];
494.  
495.  	You("wield the %s in your bare %s.",
496.  	    corpse_xname(uswapwep, TRUE), body_part(HAND));
497.  
498.  	Strcpy(kbuf, an(killer_cxname(uswapwep, TRUE)));
499.  	instapetrify(kbuf);
500.  	uswapwepgone();	/* lifesaved still doesn't allow touching cockatrice */
501.      }
502.  
503.      return 0;
504.  }
505.  
506.  int
507.  Shield_on()
508.  {
509.  /*
510.      switch (uarms->otyp) {
511.  	case SMALL_SHIELD:
512.  	case ELVEN_SHIELD:
513.  	case URUK_HAI_SHIELD:
514.  	case ORCISH_SHIELD:
515.  	case DWARVISH_ROUNDSHIELD:
516.  	case LARGE_SHIELD:
517.  	case SHIELD_OF_REFLECTION:
518.  		break;
519.  	default: impossible(unknown_type, c_shield, uarms->otyp);
520.      }
521.  */
522.      return 0;
523.  }
524.  
525.  int
526.  Shield_off()
527.  {
528.      takeoff_mask &= ~W_ARMS;
529.  /*
530.      switch (uarms->otyp) {
531.  	case SMALL_SHIELD:
532.  	case ELVEN_SHIELD:
533.  	case URUK_HAI_SHIELD:
534.  	case ORCISH_SHIELD:
535.  	case DWARVISH_ROUNDSHIELD:
536.  	case LARGE_SHIELD:
537.  	case SHIELD_OF_REFLECTION:
538.  		break;
539.  	default: impossible(unknown_type, c_shield, uarms->otyp);
540.      }
541.  */
542.      setworn((struct obj *)0, W_ARMS);
543.      return 0;
544.  }
545.  
546.  #ifdef TOURIST
547.  int
548.  Shirt_on()
549.  {
550.  /*
551.      switch (uarmu->otyp) {
552.  	case HAWAIIAN_SHIRT:
553.  	case T_SHIRT:
554.  		break;
555.  	default: impossible(unknown_type, c_shirt, uarmu->otyp);
556.      }
557.  */
558.      return 0;
559.  }
560.  
561.  int
562.  Shirt_off()
563.  {
564.      takeoff_mask &= ~W_ARMU;
565.  /*
566.      switch (uarmu->otyp) {
567.  	case HAWAIIAN_SHIRT:
568.  	case T_SHIRT:
569.  		break;
570.  	default: impossible(unknown_type, c_shirt, uarmu->otyp);
571.      }
572.  */
573.      setworn((struct obj *)0, W_ARMU);
574.      return 0;
575.  }
576.  #endif	/*TOURIST*/
577.  
578.  /* This must be done in worn.c, because one of the possible intrinsics conferred
579.   * is fire resistance, and we have to immediately set HFire_resistance in worn.c
580.   * since worn.c will check it before returning.
581.   */
582.  int
583.  Armor_on()
584.  {
585.  	/* KMH -- certain armor is obvious when worn */
586.  	switch (uarm->otyp) {
587.  		case ROBE_OF_PROTECTION:
588.  		case ROBE_OF_WEAKNESS:
589.  			makeknown(uarm->otyp);
590.  			break;
591.  	}
592.      return 0;
593.  }
594.  
595.  int
596.  Armor_off()
597.  {
598.      takeoff_mask &= ~W_ARM;
599.      setworn((struct obj *)0, W_ARM);
600.      cancelled_don = FALSE;
601.      return 0;
602.  }
603.  
604.  /* The gone functions differ from the off functions in that if you die from
605.   * taking it off and have life saving, you still die.
606.   */
607.  int
608.  Armor_gone()
609.  {
610.      takeoff_mask &= ~W_ARM;
611.      setnotworn(uarm);
612.      cancelled_don = FALSE;
613.      return 0;
614.  }
615.  
616.  void
617.  Amulet_on()
618.  {
619.      switch(uamul->otyp) {
620.  	case AMULET_OF_ESP:
621.  #if 0	/* OBSOLETE */
622.  		if(uamul->oartifact == ART_MEDALLION_OF_SHIFTERS) rescham();
623.  #endif
624.  	case AMULET_OF_LIFE_SAVING:
625.  	case AMULET_VERSUS_POISON:
626.  	case AMULET_OF_DRAIN_RESISTANCE:
627.  	case AMULET_OF_REFLECTION:
628.  	case AMULET_OF_MAGICAL_BREATHING:
629.  	/* KMH, balance patch -- removed
630.  	case AMULET_OF_REGENERATION:
631.  	case AMULET_OF_CONFLICT:*/
632.  	case FAKE_AMULET_OF_YENDOR:
633.  		break;
634.  	case AMULET_OF_UNCHANGING:
635.  		if (Slimed) {
636.  		    Slimed = 0;
637.  		    flags.botl = 1;
638.  		}
639.  		break;
640.  	case AMULET_OF_CHANGE:
641.  	    {
642.  		int orig_sex = poly_gender();
643.  
644.  		if (Unchanging) break;
645.  		change_sex();
646.  		/* Don't use same message as polymorph */
647.  		if (orig_sex != poly_gender()) {
648.  		    makeknown(AMULET_OF_CHANGE);
649.  		    You("are suddenly very %s!", flags.female ? "feminine"
650.  			: "masculine");
651.  		    flags.botl = 1;
652.  		} else
653.  		    /* already polymorphed into single-gender monster; only
654.  		       changed the character's base sex */
655.  		    You("don't feel like yourself.");
656.  		pline_The("amulet disintegrates!");
657.  		if (orig_sex == poly_gender() && uamul->dknown &&
658.  			!objects[AMULET_OF_CHANGE].oc_name_known &&
659.  			!objects[AMULET_OF_CHANGE].oc_uname)
660.  		    docall(uamul);
661.  		useup(uamul);
662.  		break;
663.  	    }
664.  	/* KMH, balance patch -- removed
665.  	case AMULET_OF_POLYMORPH:        
666.  		makeknown(AMULET_OF_POLYMORPH);
667.  		You("feel rather strange.");
668.  		polyself();
669.  		flags.botl = 1;
670.  		pline("The amulet disintegrates!");
671.  		useup(uamul);
672.  		break;*/
673.  	case AMULET_OF_STRANGULATION:
674.  		makeknown(AMULET_OF_STRANGULATION);
675.  		pline("It constricts your throat!");
676.  		Strangled = 6;
677.  		break;
678.  	case AMULET_OF_RESTFUL_SLEEP:
679.  		if(uamul->blessed) {
680.  			char buf[BUFSZ];
681.  			int sleeptime;
682.    
683.  			makeknown(AMULET_OF_RESTFUL_SLEEP);
684.  			do {
685.  			getlin("How many moves do you wish to sleep for? [1-500]", buf);
686.  				    sleeptime = (!*buf || *buf=='\033') ? 0 : atoi(buf);
687.  				} while (sleeptime < 1 || sleeptime > 500);
688.  			if (sleeptime > 0) {
689.  				You("sit down and fall asleep.");
690.  				nomul(-sleeptime);
691.  				u.usleep = 1;
692.  				nomovemsg = "You wake up from your refreshing nap.";
693.  		HSleeping = rnd(100);
694.  			}                
695.  		} else HSleeping = rnd(100);
696.  		break;
697.  	case AMULET_OF_YENDOR:
698.  		break;
699.  	/* KMH, balance patch -- added */
700.  	case AMULET_VERSUS_STONE:
701.  		uunstone();
702.  		break;
703.  	case AMULET_OF_FLYING:
704.  		if (!(EFlying & ~W_AMUL) && !is_flyer(youmonst.data)) {
705.  			You_feel("like flying!");
706.  			if (!Levitation)
707.  				float_up();
708.  			makeknown(AMULET_OF_FLYING);
709.  		}
710.  		break;
711.      }
712.  }
713.  
714.  void
715.  Amulet_off()
716.  {
717.      takeoff_mask &= ~W_AMUL;
718.  
719.      switch(uamul->otyp) {
720.  	case AMULET_OF_ESP:
721.  		/* need to update ability before calling see_monsters() */
722.  #if 0	/* OBSOLETE */
723.  		if(uamul->oartifact == ART_MEDALLION_OF_SHIFTERS) restartcham();
724.  #endif
725.  		setworn((struct obj *)0, W_AMUL);
726.  		see_monsters();
727.  		return;
728.  	case AMULET_OF_LIFE_SAVING:
729.  	case AMULET_VERSUS_POISON:
730.  	case AMULET_OF_DRAIN_RESISTANCE:
731.  	/* KMH, balance patch -- removed
732.  	case AMULET_OF_REGENERATION:
733.  	case AMULET_OF_CONFLICT:*/
734.  	/* KMH, balance patch -- added */
735.  	case AMULET_VERSUS_STONE:
736.  	case AMULET_OF_REFLECTION:
737.  	case AMULET_OF_CHANGE:
738.  	case AMULET_OF_UNCHANGING:
739.  	case FAKE_AMULET_OF_YENDOR:
740.  		break;
741.  	case AMULET_OF_MAGICAL_BREATHING:
742.  		if (Underwater) {
743.  		    /* HMagical_breathing must be set off
744.  			before calling drown() */
745.  		    setworn((struct obj *)0, W_AMUL);
746.  		    if (!breathless(youmonst.data) && !amphibious(youmonst.data)
747.  						&& !Swimming) {
748.  			You("suddenly inhale an unhealthy amount of water!");
749.  		    	(void) drown();
750.  		    }
751.  		    return;
752.  		}
753.  		break;
754.  	case AMULET_OF_STRANGULATION:
755.  		if (Strangled) {
756.  			You("can breathe more easily!");
757.  			Strangled = 0;
758.  		}
759.  		break;
760.  	case AMULET_OF_RESTFUL_SLEEP:
761.  		setworn((struct obj *)0, W_AMUL);
762.  		if (!ESleeping)
763.  			HSleeping = 0;
764.  		return;
765.  	/* KMH, balance patch -- added */
766.  	case AMULET_OF_FLYING:
767.  		setworn((struct obj *)0, W_AMUL);
768.  		(void) float_down(0L, 0L);
769.  		return;
770.  	case AMULET_OF_YENDOR:
771.  		break;
772.      }
773.      setworn((struct obj *)0, W_AMUL);
774.      return;
775.  }
776.  
777.  void
778.  Ring_on(obj)
779.  register struct obj *obj;
780.  {
781.      long oldprop = u.uprops[objects[obj->otyp].oc_oprop].extrinsic;
782.      int old_attrib, which;
783.  
784.      if (obj == uwep) setuwep((struct obj *) 0, TRUE);
785.      if (obj == uswapwep) setuswapwep((struct obj *) 0, TRUE);
786.      if (obj == uquiver) setuqwep((struct obj *) 0);
787.  
788.      /* only mask out W_RING when we don't have both
789.         left and right rings of the same type */
790.      if ((oldprop & W_RING) != W_RING) oldprop &= ~W_RING;
791.  
792.      switch(obj->otyp){
793.  	case RIN_TELEPORTATION:
794.  	case RIN_REGENERATION:
795.  	case RIN_SEARCHING:
796.  	case RIN_STEALTH:
797.  	case RIN_HUNGER:
798.  	case RIN_AGGRAVATE_MONSTER:
799.  	case RIN_POISON_RESISTANCE:
800.  	case RIN_FIRE_RESISTANCE:
801.  	case RIN_COLD_RESISTANCE:
802.  	case RIN_SHOCK_RESISTANCE:
803.  	case RIN_CONFLICT:
804.  	case RIN_TELEPORT_CONTROL:
805.  	case RIN_POLYMORPH:
806.  	case RIN_POLYMORPH_CONTROL:
807.  	/* KMH, balance patch -- now an amulet
808.  	case RIN_DRAIN_RESISTANCE: */
809.  	/* KMH -- added */
810.  	case RIN_MOOD:
811.  	case RIN_FREE_ACTION:                
812.  	case RIN_SLOW_DIGESTION:
813.  	case RIN_SUSTAIN_ABILITY:
814.  	case MEAT_RING:
815.  		break;
816.  	case RIN_SLEEPING:        
817.  		HSleeping = rnd(100);
818.  		break;
819.  #if 0
820.  	case RIN_INDIGESTION:
821.  		incr_itimeout(&HIndigestion, rnd(20));
822.  		break;
823.  #endif
824.  	case RIN_WARNING:
825.  		see_monsters();
826.  		break;
827.  	case RIN_SEE_INVISIBLE:
828.  		/* can now see invisible monsters */
829.  		set_mimic_blocking(); /* do special mimic handling */
830.  		see_monsters();
831.  #ifdef INVISIBLE_OBJECTS
832.  		see_objects();
833.  #endif
834.  
835.  		if (Invis && !oldprop && !HSee_invisible &&
836.  				!perceives(youmonst.data) && !Blind) {
837.  		    newsym(u.ux,u.uy);
838.  		    pline("Suddenly you are transparent, but there!");
839.  		    makeknown(RIN_SEE_INVISIBLE);
840.  		}
841.  		break;
842.  	case RIN_INVISIBILITY:
843.  		if (!oldprop && !HInvis && !BInvis && !Blind) {
844.  		    makeknown(RIN_INVISIBILITY);
845.  		    newsym(u.ux,u.uy);
846.  		    self_invis_message();
847.  		}
848.  		break;
849.  	case RIN_LEVITATION:
850.  		if (!oldprop && !HLevitation) {
851.  		    float_up();
852.  		    makeknown(RIN_LEVITATION);
853.  		    spoteffects(FALSE);	/* for sinks */
854.  		}
855.  		break;
856.  	case RIN_GAIN_STRENGTH:
857.  		which = A_STR;
858.  		goto adjust_attrib;
859.  	case RIN_GAIN_CONSTITUTION:
860.  		which = A_CON;
861.  		goto adjust_attrib;
862.  	case RIN_ADORNMENT:
863.  		which = A_CHA;
864.   adjust_attrib:
865.  		old_attrib = ACURR(which);
866.  		ABON(which) += obj->spe;
867.  		if (ACURR(which) != old_attrib ||
868.  			(objects[obj->otyp].oc_name_known &&
869.  			    old_attrib != 25 && old_attrib != 3)) {
870.  		    flags.botl = 1;
871.  		    makeknown(obj->otyp);
872.  		    obj->known = 1;
873.  		    update_inventory();
874.  		}
875.  		break;
876.  	case RIN_GAIN_INTELLIGENCE:
877.  		ABON(A_INT) += obj->spe;
878.  		flags.botl = 1;
879.  		if (obj->spe || objects[RIN_GAIN_INTELLIGENCE].oc_name_known) {
880.  			makeknown(RIN_GAIN_INTELLIGENCE);
881.  			obj->known = TRUE;
882.  		}
883.  		break;
884.  	case RIN_GAIN_WISDOM:
885.  		ABON(A_WIS) += obj->spe;
886.  		flags.botl = 1;
887.  		if (obj->spe || objects[RIN_GAIN_WISDOM].oc_name_known) {
888.  			makeknown(RIN_GAIN_WISDOM);
889.  			obj->known = TRUE;
890.  		}
891.  		break;
892.  	case RIN_GAIN_DEXTERITY:
893.  		ABON(A_DEX) += obj->spe;
894.  		flags.botl = 1;
895.  		if (obj->spe || objects[RIN_GAIN_DEXTERITY].oc_name_known) {
896.  			makeknown(RIN_GAIN_DEXTERITY);
897.  			obj->known = TRUE;
898.  		}
899.  		break;
900.  	case RIN_INCREASE_ACCURACY:	/* KMH */
901.  		u.uhitinc += obj->spe;
902.  		break;
903.  	case RIN_INCREASE_DAMAGE:
904.  		u.udaminc += obj->spe;
905.  		break;
906.  	case RIN_PROTECTION_FROM_SHAPE_CHAN:
907.  		rescham();
908.  		break;
909.  	case RIN_PROTECTION:
910.  		if (obj->spe || objects[RIN_PROTECTION].oc_name_known) {
911.  		    flags.botl = 1;
912.  		    makeknown(RIN_PROTECTION);
913.  		    obj->known = 1;
914.  		    update_inventory();
915.  		}
916.  		break;
917.      }
918.  }
919.  
920.  STATIC_OVL void
921.  Ring_off_or_gone(obj,gone)
922.  register struct obj *obj;
923.  boolean gone;
924.  {
925.      long mask = (obj->owornmask & W_RING);
926.      int old_attrib, which;
927.  
928.      takeoff_mask &= ~mask;
929.      if(!(u.uprops[objects[obj->otyp].oc_oprop].extrinsic & mask))
930.  	impossible("Strange... I didn't know you had that ring.");
931.      if(gone) setnotworn(obj);
932.      else setworn((struct obj *)0, obj->owornmask);
933.  
934.      switch(obj->otyp) {
935.  	case RIN_TELEPORTATION:
936.  	case RIN_REGENERATION:
937.  	case RIN_SEARCHING:
938.  	case RIN_STEALTH:
939.  	case RIN_HUNGER:
940.  	case RIN_AGGRAVATE_MONSTER:
941.  	case RIN_POISON_RESISTANCE:
942.  	case RIN_FIRE_RESISTANCE:
943.  	case RIN_COLD_RESISTANCE:
944.  	case RIN_SHOCK_RESISTANCE:
945.  	case RIN_CONFLICT:
946.  	case RIN_TELEPORT_CONTROL:
947.  	case RIN_POLYMORPH:
948.  	case RIN_POLYMORPH_CONTROL:
949.  	/* KMH, balance patch -- now an amulet
950.  	case RIN_DRAIN_RESISTANCE: */
951.  	/* KMH, balance patch -- added */
952.  	case RIN_MOOD:
953.  	case RIN_FREE_ACTION:                
954.  	case RIN_SLOW_DIGESTION:
955.  	case RIN_SUSTAIN_ABILITY:
956.  	case MEAT_RING:
957.  		break;
958.  	case RIN_SLEEPING:
959.  		if (!ESleeping)
960.  			HSleeping = 0;
961.  		break;
962.  #if 0
963.  	case RIN_INDIGESTION:
964.  		if (!EIndigestion)
965.  			HIndigestion = 0;
966.  		break;
967.  #endif
968.  	case RIN_WARNING:
969.  		see_monsters();
970.  		break;
971.  	case RIN_SEE_INVISIBLE:
972.  		/* Make invisible monsters go away */
973.  		if (!See_invisible) {
974.  		    set_mimic_blocking(); /* do special mimic handling */
975.  		    see_monsters();
976.  #ifdef INVISIBLE_OBJECTS                
977.  		    see_objects();
978.  #endif
979.  		}
980.  
981.  		if (Invisible && !Blind) {
982.  		    newsym(u.ux,u.uy);
983.  		    pline("Suddenly you cannot see yourself.");
984.  		    makeknown(RIN_SEE_INVISIBLE);
985.  		}
986.  		break;
987.  	case RIN_INVISIBILITY:
988.  		if (!Invis && !BInvis && !Blind) {
989.  		    newsym(u.ux,u.uy);
990.  		    Your("body seems to unfade%s.",
991.  			 See_invisible ? " completely" : "..");
992.  		    makeknown(RIN_INVISIBILITY);
993.  		}
994.  		break;
995.  	case RIN_LEVITATION:
996.  		(void) float_down(0L, 0L);
997.  		if (!Levitation) makeknown(RIN_LEVITATION);
998.  		break;
999.  	case RIN_GAIN_STRENGTH:
1000. 		which = A_STR;
1001. 		goto adjust_attrib;
1002. 	case RIN_GAIN_INTELLIGENCE:
1003. 		which = A_INT;
1004. 		goto adjust_attrib;
1005. 	case RIN_GAIN_WISDOM:
1006. 		which = A_WIS;
1007. 		goto adjust_attrib;
1008. 	case RIN_GAIN_DEXTERITY:
1009. 		which = A_DEX;
1010. 		goto adjust_attrib;
1011. 	case RIN_GAIN_CONSTITUTION:
1012. 		which = A_CON;
1013. 		goto adjust_attrib;
1014. 	case RIN_ADORNMENT:
1015. 		which = A_CHA;
1016.  adjust_attrib:
1017. 		old_attrib = ACURR(which);
1018. 		ABON(which) -= obj->spe;
1019. 		if (ACURR(which) != old_attrib) {
1020. 		    flags.botl = 1;
1021. 		    makeknown(obj->otyp);
1022. 		    obj->known = 1;
1023. 		    update_inventory();
1024. 		}
1025. 		break;
1026. 	case RIN_INCREASE_ACCURACY:	/* KMH */
1027. 		u.uhitinc -= obj->spe;
1028. 		break;
1029. 	case RIN_INCREASE_DAMAGE:
1030. 		u.udaminc -= obj->spe;
1031. 		break;
1032. 	case RIN_PROTECTION:
1033. 		/* might have forgotten it due to amnesia */
1034. 		if (obj->spe) {
1035. 		    flags.botl = 1;
1036. 		    makeknown(RIN_PROTECTION);
1037. 		    obj->known = 1;
1038. 		    update_inventory();
1039. 		}
1040. 	case RIN_PROTECTION_FROM_SHAPE_CHAN:
1041. 		/* If you're no longer protected, let the chameleons
1042. 		 * change shape again -dgk
1043. 		 */
1044. 		restartcham();
1045. 		break;
1046.     }
1047. }
1048. 
1049. void
1050. Ring_off(obj)
1051. struct obj *obj;
1052. {
1053. 	Ring_off_or_gone(obj,FALSE);
1054. }
1055. 
1056. void
1057. Ring_gone(obj)
1058. struct obj *obj;
1059. {
1060. 	Ring_off_or_gone(obj,TRUE);
1061. }
1062. 
1063. void
1064. Blindf_on(otmp)
1065. register struct obj *otmp;
1066. {
1067. 	long already_blind = Blind, changed = FALSE;
1068. 
1069. 	if (otmp == uwep)
1070. 	    setuwep((struct obj *) 0, TRUE);
1071. 	if (otmp == uswapwep)
1072. 	    setuswapwep((struct obj *) 0, TRUE);
1073. 	if (otmp == uquiver)
1074. 	    setuqwep((struct obj *) 0);
1075. 	setworn(otmp, W_TOOL);
1076. 	on_msg(otmp);
1077. 
1078. 	if (Blind && !already_blind) {
1079. 	    changed = TRUE;
1080. 	    if (flags.verbose) You_cant("see any more.");
1081. 	    /* set ball&chain variables before the hero goes blind */
1082. 	    if (Punished) set_bc(0);
1083. 	} else if (already_blind && !Blind) {
1084. 	    changed = TRUE;
1085. 	    /* "You are now wearing the Eyes of the Overworld." */
1086. 	    You("can see!");
1087. 	}
1088. 	if (changed) {
1089. 	    /* blindness has just been toggled */
1090. 	    if (Blind_telepat || Infravision) see_monsters();
1091. 	    vision_full_recalc = 1;	/* recalc vision limits */
1092. 	    flags.botl = 1;
1093. 	}
1094. }
1095. 
1096. void
1097. Blindf_off(otmp)
1098. register struct obj *otmp;
1099. {
1100. 	boolean was_blind = Blind, changed = FALSE;
1101. 
1102. 	takeoff_mask &= ~W_TOOL;
1103. 	setworn((struct obj *)0, otmp->owornmask);
1104. 	off_msg(otmp);
1105. 
1106. 	if (Blind) {
1107. 	    if (was_blind) {
1108. 		/* "still cannot see" makes no sense when removing lenses
1109. 		   since they can't have been the cause of your blindness */
1110. 		if (otmp->otyp != LENSES)
1111. 		    You("still cannot see.");
1112. 	    } else {
1113. 		changed = TRUE;	/* !was_blind */
1114. 		/* "You were wearing the Eyes of the Overworld." */
1115. 		You_cant("see anything now!");
1116. 		/* set ball&chain variables before the hero goes blind */
1117. 		if (Punished) set_bc(0);
1118. 	    }
1119. 	} else if (was_blind) {
1120. 	    changed = TRUE;	/* !Blind */
1121. 	    You("can see again.");
1122. 	}
1123. 	if (changed) {
1124. 	    /* blindness has just been toggled */
1125. 	    if (Blind_telepat || Infravision) see_monsters();
1126. 	    vision_full_recalc = 1;	/* recalc vision limits */
1127. 	    flags.botl = 1;
1128. 	}
1129. }
1130. 
1131. 
1132. /* called in main to set intrinsics of worn start-up items */
1133. void
1134. set_wear()
1135. {
1136. #ifdef TOURIST
1137. 	if (uarmu) (void) Shirt_on();
1138. #endif
1139. 	if (uarm)  (void) Armor_on();
1140. 	if (uarmc) (void) Cloak_on();
1141. 	if (uarmf) (void) Boots_on();
1142. 	if (uarmg) (void) Gloves_on();
1143. 	if (uarmh) (void) Helmet_on();
1144. 	if (uarms) (void) Shield_on();
1145. }
1146. 
1147. /* check whether the target object is currently being put on (or taken off) */
1148. boolean
1149. donning(otmp)		/* also checks for doffing */
1150. register struct obj *otmp;
1151. {
1152.  /* long what = (occupation == take_off) ? taking_off : 0L; */
1153.     long what = taking_off;	/* if nonzero, occupation is implied */
1154.     boolean result = FALSE;
1155. 
1156.     if (otmp == uarm)
1157. 	result = (afternmv == Armor_on || afternmv == Armor_off ||
1158. 		  what == WORN_ARMOR);
1159. #ifdef TOURIST
1160.     else if (otmp == uarmu)
1161. 	result = (afternmv == Shirt_on || afternmv == Shirt_off ||
1162. 		  what == WORN_SHIRT);
1163. #endif
1164.     else if (otmp == uarmc)
1165. 	result = (afternmv == Cloak_on || afternmv == Cloak_off ||
1166. 		  what == WORN_CLOAK);
1167.     else if (otmp == uarmf)
1168. 	result = (afternmv == Boots_on || afternmv == Boots_off ||
1169. 		  what == WORN_BOOTS);
1170.     else if (otmp == uarmh)
1171. 	result = (afternmv == Helmet_on || afternmv == Helmet_off ||
1172. 		  what == WORN_HELMET);
1173.     else if (otmp == uarmg)
1174. 	result = (afternmv == Gloves_on || afternmv == Gloves_off ||
1175. 		  what == WORN_GLOVES);
1176.     else if (otmp == uarms)
1177. 	result = (afternmv == Shield_on || afternmv == Shield_off ||
1178. 		  what == WORN_SHIELD);
1179. 
1180.     return result;
1181. }
1182. 
1183. void
1184. cancel_don()
1185. {
1186. 	/* the piece of armor we were donning/doffing has vanished, so stop
1187. 	 * wasting time on it (and don't dereference it when donning would
1188. 	 * otherwise finish)
1189. 	 */
1190. 	cancelled_don = (afternmv == Boots_on || afternmv == Helmet_on ||
1191. 			 afternmv == Gloves_on || afternmv == Armor_on);
1192. 	afternmv = 0;
1193. 	nomovemsg = (char *)0;
1194. 	multi = 0;
1195. 	todelay = 0;
1196. 	taking_off = 0L;
1197. }
1198. 
1199. static NEARDATA const char clothes[] = {ARMOR_CLASS, 0};
1200. static NEARDATA const char accessories[] = {RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, 0};
1201. 
1202. /* the 'T' command */
1203. int
1204. dotakeoff()
1205. {
1206. 	register struct obj *otmp = (struct obj *)0;
1207. 	int armorpieces = 0;
1208. 
1209. #define MOREARM(x) if (x) { armorpieces++; otmp = x; }
1210. 	MOREARM(uarmh);
1211. 	MOREARM(uarms);
1212. 	MOREARM(uarmg);
1213. 	MOREARM(uarmf);
1214. 	if (uarmc) {
1215. 		armorpieces++;
1216. 		otmp = uarmc;
1217. 	} else if (uarm) {
1218. 		armorpieces++;
1219. 		otmp = uarm;
1220. #ifdef TOURIST
1221. 	} else if (uarmu) {
1222. 		armorpieces++;
1223. 		otmp = uarmu;
1224. #endif
1225. 	}
1226. 	if (!armorpieces) {
1227. 	     /* assert( GRAY_DRAGON_SCALES > YELLOW_DRAGON_SCALE_MAIL ); */
1228. 		if (uskin)
1229. 		    pline_The("%s merged with your skin!",
1230. 			      uskin->otyp >= GRAY_DRAGON_SCALES ?
1231. 				"dragon scales are" : "dragon scale mail is");
1232. 		else
1233. 		    pline("Not wearing any armor.%s", (iflags.cmdassist && 
1234. 				(uleft || uright || uamul || ublindf)) ?
1235. 			  "  Use 'R' command to remove accessories." : "");
1236. 		return 0;
1237. 	}
1238. 	if (armorpieces > 1)
1239. 		otmp = getobj(clothes, "take off");
1240. 	if (otmp == 0) return(0);
1241. 	if (!(otmp->owornmask & W_ARMOR)) {
1242. 		You("are not wearing that.");
1243. 		return(0);
1244. 	}
1245. 	/* note: the `uskin' case shouldn't be able to happen here; dragons
1246. 	   can't wear any armor so will end up with `armorpieces == 0' above */
1247. 	if (otmp == uskin || ((otmp == uarm) && uarmc)
1248. #ifdef TOURIST
1249. 			  || ((otmp == uarmu) && (uarmc || uarm))
1250. #endif
1251. 		) {
1252. 	    You_cant("take that off.");
1253. 	    return 0;
1254. 	}
1255. 
1256. 	reset_remarm();		/* clear takeoff_mask and taking_off */
1257. 	(void) select_off(otmp);
1258. 	if (!takeoff_mask) return 0;
1259. 	reset_remarm();		/* armoroff() doesn't use takeoff_mask */
1260. 
1261. 	(void) armoroff(otmp);
1262. 	return(1);
1263. }
1264. 
1265. /* the 'R' command */
1266. int
1267. doremring()
1268. {
1269. 	register struct obj *otmp = 0;
1270. 	int Accessories = 0;
1271. 
1272. #define MOREACC(x) if (x) { Accessories++; otmp = x; }
1273. 	MOREACC(uleft);
1274. 	MOREACC(uright);
1275. 	MOREACC(uamul);
1276. 	MOREACC(ublindf);
1277. 
1278. 	if(!Accessories) {
1279. 		pline("Not wearing any accessories.%s", (iflags.cmdassist &&
1280. 			    (uarm || uarmc ||
1281. #ifdef TOURIST
1282. 			     uarmu ||
1283. #endif
1284. 			     uarms || uarmh || uarmg || uarmf)) ?
1285. 		      "  Use 'T' command to take off armor." : "");
1286. 		return(0);
1287. 	}
1288. 	if (Accessories != 1) otmp = getobj(accessories, "remove");
1289. 	if(!otmp) return(0);
1290. 	if(!(otmp->owornmask & (W_RING | W_AMUL | W_TOOL))) {
1291. 		You("are not wearing that.");
1292. 		return(0);
1293. 	}
1294. 
1295. 	reset_remarm();		/* clear takeoff_mask and taking_off */
1296. 	(void) select_off(otmp);
1297. 	if (!takeoff_mask) return 0;
1298. 	reset_remarm();		/* not used by Ring_/Amulet_/Blindf_off() */
1299. 
1300. 	if (otmp == uright || otmp == uleft) {
1301. 		/* Sometimes we want to give the off_msg before removing and
1302. 		 * sometimes after; for instance, "you were wearing a moonstone
1303. 		 * ring (on right hand)" is desired but "you were wearing a
1304. 		 * square amulet (being worn)" is not because of the redundant
1305. 		 * "being worn".
1306. 		 */
1307. 		off_msg(otmp);
1308. 		Ring_off(otmp);
1309. 	} else if (otmp == uamul) {
1310. 		Amulet_off();
1311. 		off_msg(otmp);
1312. 	} else if (otmp == ublindf) {
1313. 		Blindf_off(otmp);	/* does its own off_msg */
1314. 	} else {
1315. 		impossible("removing strange accessory?");
1316. 	}
1317. 	return(1);
1318. }
1319. 
1320. /* Check if something worn is cursed _and_ unremovable. */
1321. int
1322. cursed(otmp)
1323. register struct obj *otmp;
1324. {
1325. 	/* Curses, like chickens, come home to roost. */
1326. 	if((otmp == uwep) ? welded(otmp) : (int)otmp->cursed) {
1327. 		You("can't.  %s cursed.",
1328. 			(is_boots(otmp) || is_gloves(otmp) || otmp->quan > 1L)
1329. 			? "They are" : "It is");
1330. 		otmp->bknown = TRUE;
1331. 		return(1);
1332. 	}
1333. 	return(0);
1334. }
1335. 
1336. int
1337. armoroff(otmp)
1338. register struct obj *otmp;
1339. {
1340. 	register int delay = -objects[otmp->otyp].oc_delay;
1341. 
1342. 	if(cursed(otmp)) return(0);
1343. 	if(delay) {
1344. 		nomul(delay);
1345. 		if (is_helmet(otmp)) {
1346. 			nomovemsg = "You finish taking off your helmet.";
1347. 			afternmv = Helmet_off;
1348. 		     }
1349. 		else if (is_gloves(otmp)) {
1350. 			nomovemsg = "You finish taking off your gloves.";
1351. 			afternmv = Gloves_off;
1352. 		     }
1353. 		else if (is_boots(otmp)) {
1354. 			nomovemsg = "You finish taking off your boots.";
1355. 			afternmv = Boots_off;
1356. 		     }
1357. 		else {
1358. 			nomovemsg = "You finish taking off your suit.";
1359. 			afternmv = Armor_off;
1360. 		}
1361. 	} else {
1362. 		/* Be warned!  We want off_msg after removing the item to
1363. 		 * avoid "You were wearing ____ (being worn)."  However, an
1364. 		 * item which grants fire resistance might cause some trouble
1365. 		 * if removed in Hell and lifesaving puts it back on; in this
1366. 		 * case the message will be printed at the wrong time (after
1367. 		 * the messages saying you died and were lifesaved).  Luckily,
1368. 		 * no cloak, shield, or fast-removable armor grants fire
1369. 		 * resistance, so we can safely do the off_msg afterwards.
1370. 		 * Rings do grant fire resistance, but for rings we want the
1371. 		 * off_msg before removal anyway so there's no problem.  Take
1372. 		 * care in adding armors granting fire resistance; this code
1373. 		 * might need modification.
1374. 		 * 3.2 (actually 3.1 even): this comment is obsolete since
1375. 		 * fire resistance is not needed for Gehennom.
1376. 		 */
1377. 		if(is_cloak(otmp))
1378. 			(void) Cloak_off();
1379. 		else if(is_shield(otmp))
1380. 			(void) Shield_off();
1381. 		else if (is_helmet(otmp))
1382. 			/* [Finn E. Theodorsen] For fedoras */
1383. 			(void) Helmet_off();
1384. 		else setworn((struct obj *)0, otmp->owornmask & W_ARMOR);
1385. 		off_msg(otmp);
1386. 	}
1387. 	takeoff_mask = taking_off = 0L;
1388. 	return(1);
1389. }
1390. 
1391. STATIC_OVL void
1392. already_wearing(cc)
1393. const char *cc;
1394. {
1395. 	You("are already wearing %s%c", cc, (cc == c_that_) ? '!' : '.');
1396. }
1397. 
1398. STATIC_OVL void
1399. already_wearing2(cc1, cc2)
1400. const char *cc1, *cc2;
1401. {
1402. 	You_cant("wear %s because you're wearing %s there already.", cc1, cc2);
1403. }
1404. 
1405. /*
1406.  * canwearobj checks to see whether the player can wear a piece of armor
1407.  *
1408.  * inputs: otmp (the piece of armor)
1409.  *         noisy (if TRUE give error messages, otherwise be quiet about it)
1410.  * output: mask (otmp's armor type)
1411.  */
1412. int
1413. canwearobj(otmp,mask,noisy)
1414. struct obj *otmp;
1415. long *mask;
1416. boolean noisy;
1417. {
1418.     int err = 0;
1419.     const char *which;
1420. 
1421.     which = is_cloak(otmp) ? c_cloak :
1422. #ifdef TOURIST
1423. 	    is_shirt(otmp) ? c_shirt :
1424. #endif
1425. 	    is_suit(otmp) ? c_suit : 0;
1426.     if (which && cantweararm(youmonst.data) &&
1427. 	    /* same exception for cloaks as used in m_dowear() */
1428. 	    (which != c_cloak || youmonst.data->msize != MZ_SMALL) &&
1429. 	    (racial_exception(&youmonst, otmp) < 1)) {
1430. 	if (noisy) pline_The("%s will not fit on your body.", which);
1431. 	return 0;
1432.     } else if (otmp->owornmask & W_ARMOR) {
1433. 	if (noisy) already_wearing(c_that_);
1434. 	return 0;
1435.     }
1436. 
1437.     if (welded(uwep) && bimanual(uwep) &&
1438. 	    (is_suit(otmp)
1439. #ifdef TOURIST
1440. 			|| is_shirt(otmp)
1441. #endif
1442. 	    )) {
1443. 	if (noisy)
1444. 	    You("cannot do that while holding your %s.",
1445. 		is_sword(uwep) ? c_sword : c_weapon);
1446. 	return 0;
1447.     }
1448. 
1449.     if (is_helmet(otmp)) {
1450. 	if (uarmh) {
1451. 	    if (noisy) already_wearing(an(c_helmet));
1452. 	    err++;
1453. 	} else if (Upolyd && has_horns(youmonst.data) && !is_flimsy(otmp)) {
1454. 	    /* (flimsy exception matches polyself handling) */
1455. 	    if (noisy)
1456. 		pline_The("%s won't fit over your horn%s.",
1457. 			  c_helmet, plur(num_horns(youmonst.data)));
1458. 	    err++;
1459. 	} else
1460. 	    *mask = W_ARMH;
1461.     } else if (is_shield(otmp)) {
1462. 	if (uarms) {
1463. 	    if (noisy) already_wearing(an(c_shield));
1464. 	    err++;
1465. 	} else if (uwep && bimanual(uwep)) {
1466. 	    if (noisy) 
1467. 		You("cannot wear a shield while wielding a two-handed %s.",
1468. 		    is_sword(uwep) ? c_sword :
1469. 		    (uwep->otyp == BATTLE_AXE) ? c_axe : c_weapon);
1470. 	    err++;
1471. 	} else if (u.twoweap) {
1472. 	    if (noisy) {
1473. 		if (uwep && uswapwep)
1474. 		    You("cannot wear a shield while wielding two weapons.");
1475. 		else
1476. 		    You("cannot wear a shield while fighting with two %s.",
1477. 			    makeplural(body_part(HAND)));
1478. 	    }
1479. 	    err++;
1480. 	} else
1481. 	    *mask = W_ARMS;
1482.     } else if (is_boots(otmp)) {
1483. 	if (uarmf) {
1484. 	    if (noisy) already_wearing(c_boots);
1485. 	    err++;
1486. 	} else if (Upolyd && slithy(youmonst.data)) {
1487. 	    if (noisy) You("have no feet...");	/* not body_part(FOOT) */
1488. 	    err++;
1489. 	} else if (Upolyd && youmonst.data->mlet == S_CENTAUR) {
1490. 	    /* break_armor() pushes boots off for centaurs,
1491. 	       so don't let dowear() put them back on... */
1492. 	    if (noisy) pline("You have too many hooves to wear %s.",
1493. 			     c_boots);	/* makeplural(body_part(FOOT)) yields
1494. 					   "rear hooves" which sounds odd */
1495. 	    err++;
1496. 	} else if (u.utrap && (u.utraptype == TT_BEARTRAP ||
1497. 				u.utraptype == TT_INFLOOR)) {
1498. 	    if (u.utraptype == TT_BEARTRAP) {
1499. 		if (noisy) Your("%s is trapped!", body_part(FOOT));
1500. 	    } else {
1501. 		if (noisy) Your("%s are stuck in the %s!",
1502. 				makeplural(body_part(FOOT)),
1503. 				surface(u.ux, u.uy));
1504. 	    }
1505. 	    err++;
1506. 	} else
1507. 	    *mask = W_ARMF;
1508.     } else if (is_gloves(otmp)) {
1509. 	if (uarmg) {
1510. 	    if (noisy) already_wearing(c_gloves);
1511. 	    err++;
1512. 	} else if (welded(uwep)) {
1513. 	    if (noisy) You("cannot wear gloves over your %s.",
1514. 			   is_sword(uwep) ? c_sword : c_weapon);
1515. 	    err++;
1516. 	} else
1517. 	    *mask = W_ARMG;
1518. #ifdef TOURIST
1519.     } else if (is_shirt(otmp)) {
1520. 	if (uarm || uarmc || uarmu) {
1521. 	    if (uarmu) {
1522. 		if (noisy) already_wearing(an(c_shirt));
1523. 	    } else {
1524. 		if (noisy) You_cant("wear that over your %s.",
1525. 			           (uarm && !uarmc) ? c_armor : cloak_simple_name(uarmc));
1526. 	    }
1527. 	    err++;
1528. 	} else
1529. 	    *mask = W_ARMU;
1530. #endif
1531.     } else if (is_cloak(otmp)) {
1532. 	if (uarmc) {
1533. 	    if (noisy) already_wearing(an(cloak_simple_name(uarmc)));
1534. 	    err++;
1535. 	} else
1536. 	    *mask = W_ARMC;
1537.     } else if (is_suit(otmp)) {
1538. 	if (uarmc) {
1539. 	    if (noisy) You("cannot wear armor over a %s.", cloak_simple_name(uarmc));
1540. 	    err++;
1541. 	} else if (uarm) {
1542. 	    if (noisy) already_wearing("some armor");
1543. 	    err++;
1544. 	} else
1545. 	    *mask = W_ARM;
1546.     } else {
1547. 	/* getobj can't do this after setting its allow_all flag; that
1548. 	   happens if you have armor for slots that are covered up or
1549. 	   extra armor for slots that are filled */
1550. 	if (noisy) silly_thing("wear", otmp);
1551. 	err++;
1552.     }
1553. /* Unnecessary since now only weapons and special items like pick-axes get
1554.  * welded to your hand, not armor
1555.     if (welded(otmp)) {
1556. 	if (!err++) {
1557. 	    if (noisy) weldmsg(otmp);
1558. 	}
1559.     }
1560.  */
1561.     return !err;
1562. }
1563. 
1564. /* the 'W' command */
1565. int
1566. dowear()
1567. {
1568. 	struct obj *otmp;
1569. 	int delay;
1570. 	long mask = 0;
1571. 
1572. 	/* cantweararm checks for suits of armor */
1573. 	/* verysmall or nohands checks for shields, gloves, etc... */
1574. 	if ((verysmall(youmonst.data) || nohands(youmonst.data))) {
1575. 		pline("Don't even bother.");
1576. 		return(0);
1577. 	}
1578. 
1579. 	otmp = getobj(clothes, "wear");
1580. 	if(!otmp) return(0);
1581. 
1582. 	if (!canwearobj(otmp,&mask,TRUE)) return(0);
1583. 
1584. 	if (otmp->oartifact && !touch_artifact(otmp, &youmonst))
1585. 	    return 1;	/* costs a turn even though it didn't get worn */
1586. 
1587. 	if (otmp->otyp == HELM_OF_OPPOSITE_ALIGNMENT &&
1588. 			qstart_level.dnum == u.uz.dnum) {	/* in quest */
1589. 		if (u.ualignbase[A_CURRENT] == u.ualignbase[A_ORIGINAL])
1590. 			You("narrowly avoid losing all chance at your goal.");
1591. 		else	/* converted */
1592. 			You("are suddenly overcome with shame and change your mind.");
1593. 		u.ublessed = 0; /* lose your god's protection */
1594. 		makeknown(otmp->otyp);
1595. 		flags.botl = 1;
1596. 		return 1;
1597. 	}
1598. 
1599. 	otmp->known = TRUE;
1600. 	if(otmp == uwep)
1601. 		setuwep((struct obj *)0, TRUE);
1602. 	if (otmp == uswapwep)
1603. 		setuswapwep((struct obj *) 0, TRUE);
1604. 	if (otmp == uquiver)
1605. 		setuqwep((struct obj *) 0);
1606. 	setworn(otmp, mask);
1607. 	delay = -objects[otmp->otyp].oc_delay;
1608. 	if(delay){
1609. 		nomul(delay);
1610. 		if(is_boots(otmp)) afternmv = Boots_on;
1611. 		if(is_helmet(otmp)) afternmv = Helmet_on;
1612. 		if(is_gloves(otmp)) afternmv = Gloves_on;
1613. 		if(otmp == uarm) afternmv = Armor_on;
1614. 		nomovemsg = "You finish your dressing maneuver.";
1615. 	} else {
1616. 		if(is_cloak(otmp)) (void) Cloak_on();
1617. 		if (is_shield(otmp)) (void) Shield_on();
1618. #ifdef TOURIST
1619. 		if (is_shirt(otmp)) (void) Shirt_on();
1620. #endif
1621. 		if (is_helmet(otmp)) (void) Helmet_on();	/* fedoras */
1622. 		on_msg(otmp);
1623. 	}
1624. 	takeoff_mask = taking_off = 0L;
1625. 	return(1);
1626. }
1627. 
1628. int
1629. doputon()
1630. {
1631. 	register struct obj *otmp;
1632. 	long mask = 0L;
1633. 
1634. 	if(uleft && uright && uamul && ublindf) {
1635. 		Your("%s%s are full, and you're already wearing an amulet and %s.",
1636. 			humanoid(youmonst.data) ? "ring-" : "",
1637. 			makeplural(body_part(FINGER)),
1638. 			ublindf->otyp==LENSES ? "some lenses" : "a blindfold");
1639. 		return(0);
1640. 	}
1641. 	otmp = getobj(accessories, "put on");
1642. 	if(!otmp) return(0);
1643. 	if(otmp->owornmask & (W_RING | W_AMUL | W_TOOL)) {
1644. 		already_wearing(c_that_);
1645. 		return(0);
1646. 	}
1647. 	if(welded(otmp)) {
1648. 		weldmsg(otmp);
1649. 		return(0);
1650. 	}
1651. 	if(otmp == uwep)
1652. 		setuwep((struct obj *)0, TRUE);
1653. 	if(otmp == uswapwep)
1654. 		setuswapwep((struct obj *) 0, TRUE);
1655. 	if(otmp == uquiver)
1656. 		setuqwep((struct obj *) 0);
1657. 	if(otmp->oclass == RING_CLASS || otmp->otyp == MEAT_RING) {
1658. 		if(nolimbs(youmonst.data)) {
1659. 			You("cannot make the ring stick to your body.");
1660. 			return(0);
1661. 		}
1662. 		if(uleft && uright){
1663. 			There("are no more %s%s to fill.",
1664. 				humanoid(youmonst.data) ? "ring-" : "",
1665. 				makeplural(body_part(FINGER)));
1666. 			return(0);
1667. 		}
1668. 		if(uleft) mask = RIGHT_RING;
1669. 		else if(uright) mask = LEFT_RING;
1670. 		else do {
1671. 			char qbuf[QBUFSZ];
1672. 			char answer;
1673. 
1674. 			Sprintf(qbuf, "Which %s%s, Right or Left?",
1675. 				humanoid(youmonst.data) ? "ring-" : "",
1676. 				body_part(FINGER));
1677. 			if(!(answer = yn_function(qbuf, "rl", '\0')))
1678. 				return(0);
1679. 			switch(answer){
1680. 			case 'l':
1681. 			case 'L':
1682. 				mask = LEFT_RING;
1683. 				break;
1684. 			case 'r':
1685. 			case 'R':
1686. 				mask = RIGHT_RING;
1687. 				break;
1688. 			}
1689. 		} while(!mask);
1690. 		if (uarmg && uarmg->cursed) {
1691. 			uarmg->bknown = TRUE;
1692. 		    You("cannot remove your gloves to put on the ring.");
1693. 			return(0);
1694. 		}
1695. 		if (welded(uwep) && bimanual(uwep)) {
1696. 			/* welded will set bknown */
1697. 	    You("cannot free your weapon hands to put on the ring.");
1698. 			return(0);
1699. 		}
1700. 		if (welded(uwep) && mask==RIGHT_RING) {
1701. 			/* welded will set bknown */
1702. 	    You("cannot free your weapon hand to put on the ring.");
1703. 			return(0);
1704. 		}
1705. 		if (otmp->oartifact && !touch_artifact(otmp, &youmonst))
1706. 		    return 1; /* costs a turn even though it didn't get worn */
1707. 		setworn(otmp, mask);
1708. 		Ring_on(otmp);
1709. 	} else if (otmp->oclass == AMULET_CLASS) {
1710. 		if(uamul) {
1711. 			already_wearing("an amulet");
1712. 			return(0);
1713. 		}
1714. 		if (otmp->oartifact && !touch_artifact(otmp, &youmonst))
1715. 		    return 1;
1716. 		setworn(otmp, W_AMUL);
1717. 		if (otmp->otyp == AMULET_OF_CHANGE) {
1718. 			Amulet_on();
1719. 			/* Don't do a prinv() since the amulet is now gone */
1720. 			return(1);
1721. 		}
1722. 		Amulet_on();
1723. 	} else {	/* it's a blindfold, towel, or lenses */
1724. 		if (ublindf) {
1725. 			if (ublindf->otyp == TOWEL)
1726. 				Your("%s is already covered by a towel.",
1727. 					body_part(FACE));
1728. 			else if (ublindf->otyp == BLINDFOLD) {
1729. 				if (otmp->otyp == LENSES)
1730. 					already_wearing2("lenses", "a blindfold");
1731. 				else
1732. 					already_wearing("a blindfold");
1733. 			} else if (ublindf->otyp == LENSES) {
1734. 				if (otmp->otyp == BLINDFOLD)
1735. 					already_wearing2("a blindfold", "some lenses");
1736. 				else
1737. 					already_wearing("some lenses");
1738. 			} else
1739. 				already_wearing(something); /* ??? */
1740. 			return(0);
1741. 		}
1742. 		if (otmp->otyp != BLINDFOLD && otmp->otyp != TOWEL && otmp->otyp != LENSES) {
1743. 			You_cant("wear that!");
1744. 			return(0);
1745. 		}
1746. 		if (otmp->oartifact && !touch_artifact(otmp, &youmonst))
1747. 		    return 1;
1748. 		Blindf_on(otmp);
1749. 		return(1);
1750. 	}
1751. 	if (is_worn(otmp))
1752. 	    prinv((char *)0, otmp, 0L);
1753. 	return(1);
1754. }
1755. 
1756. #endif /* OVLB */
1757. 
1758. #ifdef OVL0
1759. 
1760. /* Limits of uac (conveniently equal to the limits of an schar ;) */
1761. #define UAC_MIN (-128)
1762. #define UAC_LIM 127
1763. 
1764. void
1765. find_ac()
1766. {
1767. 	int uac = mons[u.umonnum].ac;
1768. 
1769. 	if(uarm) uac -= ARM_BONUS(uarm);
1770. 	if(uarmc) uac -= ARM_BONUS(uarmc);
1771. 	if(uarmh) uac -= ARM_BONUS(uarmh);
1772. 	if(uarmf) uac -= ARM_BONUS(uarmf);
1773. 	if(uarms) uac -= ARM_BONUS(uarms);
1774. 	if(uarmg) uac -= ARM_BONUS(uarmg);
1775. #ifdef TOURIST
1776. 	if(uarmu) uac -= ARM_BONUS(uarmu);
1777. #endif
1778. 	if(uleft && uleft->otyp == RIN_PROTECTION) uac -= uleft->spe;
1779. 	if(uright && uright->otyp == RIN_PROTECTION) uac -= uright->spe;
1780. 	if (HProtection & INTRINSIC) uac -= u.ublessed;
1781. 	uac -= u.uspellprot;
1782. 
1783. /* STEPHEN WHITE'S NEW CODE */
1784. 	/* Dexterity now affects AC */
1785. 	if (ACURR(A_DEX) < 4) uac += 3;
1786. 	else if (ACURR(A_DEX) < 6) uac += 2;
1787. 	else if (ACURR(A_DEX) < 8) uac += 1;
1788. 	else if (ACURR(A_DEX) < 14) uac -= 0;
1789. 	else if (ACURR(A_DEX) < 21) uac -= ACURR(A_DEX)-14;
1790. 	else if (ACURR(A_DEX) < 22) uac -= 6;
1791. 	else if (ACURR(A_DEX) < 24) uac -= 7;
1792. 	else uac -= 8;
1793. 
1794. 	if (Role_if(PM_MONK) && !uwep && (!uarm ||
1795. 		uarm->otyp==ROBE ||
1796. 		uarm->otyp==ROBE_OF_POWER ||
1797. 		uarm->otyp==ROBE_OF_WEAKNESS ||
1798. 		uarm->otyp==ROBE_OF_PROTECTION) && !uarms) {
1799. /*WAC cap off the Monk's ac bonus to -11 */
1800.             if (u.ulevel > 18) uac -= 11;
1801.             else uac -= (u.ulevel / 2) + 2;
1802. 	}
1803. 	if (Race_if(PM_DOPPELGANGER) && !uarm) uac -= (u.ulevel / 4) + 1;
1804. 	if (Race_if(PM_HUMAN_WEREWOLF) && !uarm) uac -= (u.ulevel / 4) + 1;
1805. 
1806. 	/* Harlow - make sure it doesn't wrap around ;) */
1807. 	uac = (uac < UAC_MIN ? UAC_MIN : (uac > UAC_LIM ? UAC_LIM : uac));
1808. 	
1809. 	if(uac != u.uac){
1810. 		u.uac = uac;
1811. 		flags.botl = 1;
1812. 	}
1813. }
1814. 
1815. #endif /* OVL0 */
1816. #ifdef OVLB
1817. 
1818. void
1819. glibr()
1820. {
1821. 	register struct obj *otmp;
1822. 	int xfl = 0;
1823. 	boolean leftfall, rightfall;
1824. 	const char *otherwep = 0;
1825. 
1826. 	leftfall = (uleft && !uleft->cursed &&
1827. 		    (!uwep || !welded(uwep) || !bimanual(uwep)));
1828. 	rightfall = (uright && !uright->cursed && (!welded(uwep)));
1829. 	if (!uarmg && (leftfall || rightfall) && !nolimbs(youmonst.data)) {
1830. 		/* changed so cursed rings don't fall off, GAN 10/30/86 */
1831. 		Your("%s off your %s.",
1832. 			(leftfall && rightfall) ? "rings slip" : "ring slips",
1833. 			(leftfall && rightfall) ? makeplural(body_part(FINGER)) :
1834. 			body_part(FINGER));
1835. 		xfl++;
1836. 		if (leftfall) {
1837. 			otmp = uleft;
1838. 			Ring_off(uleft);
1839. 			dropx(otmp);
1840. 		}
1841. 		if (rightfall) {
1842. 			otmp = uright;
1843. 			Ring_off(uright);
1844. 			dropx(otmp);
1845. 		}
1846. 	}
1847. 
1848. 	otmp = uswapwep;
1849. 	if (u.twoweap && otmp) {
1850. 		otherwep = is_sword(otmp) ? c_sword :
1851. 		    makesingular(oclass_names[(int)otmp->oclass]);
1852. 		Your("%s %sslips from your %s.",
1853. 			otherwep,
1854. 			xfl ? "also " : "",
1855. 			makeplural(body_part(HAND)));
1856. 		setuswapwep((struct obj *)0, FALSE);
1857. 		xfl++;
1858. 		if (otmp->otyp != LOADSTONE || !otmp->cursed)
1859. 			dropx(otmp);
1860. 	}
1861. 	otmp = uwep;
1862. 	if (otmp && !welded(otmp)) {
1863. 		const char *thiswep;
1864. 
1865. 		/* nice wording if both weapons are the same type */
1866. 		thiswep = is_sword(otmp) ? c_sword :
1867. 		    makesingular(oclass_names[(int)otmp->oclass]);
1868. 		if (otherwep && strcmp(thiswep, otherwep)) otherwep = 0;
1869. 
1870. 		/* changed so cursed weapons don't fall, GAN 10/30/86 */
1871. 		Your("%s%s %sslips from your %s.",
1872. 			otherwep ? "other " : "", thiswep,
1873. 			xfl ? "also " : "",
1874. 			makeplural(body_part(HAND)));
1875. 		setuwep((struct obj *)0, FALSE);
1876. 		if (otmp->otyp != LOADSTONE || !otmp->cursed)
1877. 			dropx(otmp);
1878. 	}
1879. }
1880. 
1881. struct obj *
1882. some_armor(victim)
1883. struct monst *victim;
1884. {
1885. 	register struct obj *otmph, *otmp;
1886. 
1887. 	otmph = (victim == &youmonst) ? uarmc : which_armor(victim, W_ARMC);
1888. 	if (!otmph)
1889. 	    otmph = (victim == &youmonst) ? uarm : which_armor(victim, W_ARM);
1890. #ifdef TOURIST
1891. 	if (!otmph)
1892. 	    otmph = (victim == &youmonst) ? uarmu : which_armor(victim, W_ARMU);
1893. #endif
1894. 	
1895. 	otmp = (victim == &youmonst) ? uarmh : which_armor(victim, W_ARMH);
1896. 	if(otmp && (!otmph || !rn2(4))) otmph = otmp;
1897. 	otmp = (victim == &youmonst) ? uarmg : which_armor(victim, W_ARMG);
1898. 	if(otmp && (!otmph || !rn2(4))) otmph = otmp;
1899. 	otmp = (victim == &youmonst) ? uarmf : which_armor(victim, W_ARMF);
1900. 	if(otmp && (!otmph || !rn2(4))) otmph = otmp;
1901. 	otmp = (victim == &youmonst) ? uarms : which_armor(victim, W_ARMS);
1902. 	if(otmp && (!otmph || !rn2(4))) otmph = otmp;
1903. 	return(otmph);
1904. }
1905. 
1906. /* erode some arbitrary armor worn by the victim */
1907. void
1908. erode_armor(victim, acid_dmg)
1909. struct monst *victim;
1910. boolean acid_dmg;
1911. {
1912. 	struct obj *otmph = some_armor(victim);
1913. 
1914. 	if (otmph && (otmph != uarmf)) {
1915. 	    erode_obj(otmph, acid_dmg, FALSE);
1916. 	    if (carried(otmph)) update_inventory();
1917. 	}
1918. }
1919. 
1920. /* used for praying to check and fix levitation trouble */
1921. struct obj *
1922. stuck_ring(ring, otyp)
1923. struct obj *ring;
1924. int otyp;
1925. {
1926.     if (ring != uleft && ring != uright) {
1927. 	impossible("stuck_ring: neither left nor right?");
1928. 	return (struct obj *)0;
1929.     }
1930. 
1931.     if (ring && ring->otyp == otyp) {
1932. 	/* reasons ring can't be removed match those checked by select_off();
1933. 	   limbless case has extra checks because ordinarily it's temporary */
1934. 	if (nolimbs(youmonst.data) &&
1935. 		uamul && uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed)
1936. 	    return uamul;
1937. 	if (welded(uwep) && (ring == uright || bimanual(uwep))) return uwep;
1938. 	if (uarmg && uarmg->cursed) return uarmg;
1939. 	if (ring->cursed) return ring;
1940.     }
1941.     /* either no ring or not right type or nothing prevents its removal */
1942.     return (struct obj *)0;
1943. }
1944. 
1945. /* also for praying; find worn item that confers "Unchanging" attribute */
1946. struct obj *
1947. unchanger()
1948. {
1949.     if (uamul && uamul->otyp == AMULET_OF_UNCHANGING) return uamul;
1950.     return 0;
1951. }
1952. 
1953. /* occupation callback for 'A' */
1954. STATIC_PTR
1955. int
1956. select_off(otmp)
1957. register struct obj *otmp;
1958. {
1959. 	struct obj *why;
1960. 	char buf[BUFSZ];
1961. 
1962. 	if (!otmp) return 0;
1963. 	*buf = '\0';			/* lint suppresion */
1964. 
1965. 	/* special ring checks */
1966. 	if (otmp == uright || otmp == uleft) {
1967. 	    if (nolimbs(youmonst.data)) {
1968. 		pline_The("ring is stuck.");
1969. 		return 0;
1970. 	    }
1971. 	    why = 0;	/* the item which prevents ring removal */
1972. 	    if (welded(uwep) && (otmp == uright || bimanual(uwep))) {
1973. 		Sprintf(buf, "free a weapon %s", body_part(HAND));
1974. 		why = uwep;
1975. 	    } else if (uarmg && uarmg->cursed) {
1976. 		Sprintf(buf, "take off your %s", c_gloves);
1977. 		why = uarmg;
1978. 	    }
1979. 	    if (why) {
1980. 		You("cannot %s to remove the ring.", buf);
1981. 		why->bknown = TRUE;
1982. 		return 0;
1983. 	    }
1984. 	}
1985. 	/* special glove checks */
1986. 	if (otmp == uarmg) {
1987. 	    if (welded(uwep)) {
1988. 		You("are unable to take off your %s while wielding that %s.",
1989. 		    c_gloves, is_sword(uwep) ? c_sword : c_weapon);
1990. 		uwep->bknown = TRUE;
1991. 		return 0;
1992. 	    } else if (Glib) {
1993. 		You_cant("take off the slippery %s with your slippery %s.",
1994. 			 c_gloves, makeplural(body_part(FINGER)));
1995. 		return 0;
1996. 	    }
1997. 	}
1998. 	/* special boot checks */
1999. 	if (otmp == uarmf) {
2000. 	    if (u.utrap && u.utraptype == TT_BEARTRAP) {
2001. 		pline_The("bear trap prevents you from pulling your %s out.",
2002. 			  body_part(FOOT));
2003. 		return 0;
2004. 	    } else if (u.utrap && u.utraptype == TT_INFLOOR) {
2005. 		You("are stuck in the %s, and cannot pull your %s out.",
2006. 		    surface(u.ux, u.uy), makeplural(body_part(FOOT)));
2007. 		return 0;
2008. 	    }
2009. 	}
2010. 	/* special suit and shirt checks */
2011. 	if (otmp == uarm
2012. #ifdef TOURIST
2013. 			|| otmp == uarmu
2014. #endif
2015. 		) {
2016. 	    why = 0;	/* the item which prevents disrobing */
2017. 	    if (uarmc && uarmc->cursed) {
2018. 		Sprintf(buf, "remove your %s", cloak_simple_name(uarmc));
2019. 		why = uarmc;
2020. #ifdef TOURIST
2021. 	    } else if (otmp == uarmu && uarm && uarm->cursed) {
2022. 		Sprintf(buf, "remove your %s", c_suit);
2023. 		why = uarm;
2024. #endif
2025. 	    } else if (welded(uwep) && bimanual(uwep)) {
2026. 		Sprintf(buf, "release your %s",
2027. 			is_sword(uwep) ? c_sword :
2028. 			(uwep->otyp == BATTLE_AXE) ? c_axe : c_weapon);
2029. 		why = uwep;
2030. 	    }
2031. 	    if (why) {
2032. 		You("cannot %s to take off %s.", buf, the(xname(otmp)));
2033. 		why->bknown = TRUE;
2034. 		return 0;
2035. 	    }
2036. 	}
2037. 	/* basic curse check */
2038. 	if (otmp == uquiver || (otmp == uswapwep && !u.twoweap)) {
2039. 	    ;	/* some items can be removed even when cursed */
2040. 	} else {
2041. 	    /* otherwise, this is fundamental */
2042. 	    if (cursed(otmp)) return 0;
2043. 	}
2044. 
2045. 	if(otmp == uarm) takeoff_mask |= WORN_ARMOR;
2046. 	else if(otmp == uarmc) takeoff_mask |= WORN_CLOAK;
2047. 	else if(otmp == uarmf) takeoff_mask |= WORN_BOOTS;
2048. 	else if(otmp == uarmg) takeoff_mask |= WORN_GLOVES;
2049. 	else if(otmp == uarmh) takeoff_mask |= WORN_HELMET;
2050. 	else if(otmp == uarms) takeoff_mask |= WORN_SHIELD;
2051. #ifdef TOURIST
2052. 	else if(otmp == uarmu) takeoff_mask |= WORN_SHIRT;
2053. #endif
2054. 	else if(otmp == uleft) takeoff_mask |= LEFT_RING;
2055. 	else if(otmp == uright) takeoff_mask |= RIGHT_RING;
2056. 	else if(otmp == uamul) takeoff_mask |= WORN_AMUL;
2057. 	else if(otmp == ublindf) takeoff_mask |= WORN_BLINDF;
2058. 	else if(otmp == uwep) takeoff_mask |= W_WEP;
2059. 	else if(otmp == uswapwep) takeoff_mask |= W_SWAPWEP;
2060. 	else if(otmp == uquiver) takeoff_mask |= W_QUIVER;
2061. 
2062. 	else impossible("select_off: %s???", doname(otmp));
2063. 
2064. 	return(0);
2065. }
2066. 
2067. STATIC_OVL struct obj *
2068. do_takeoff()
2069. {
2070. 	register struct obj *otmp = (struct obj *)0;
2071. 
2072. 	if (taking_off == W_WEP) {
2073. 	  if(!cursed(uwep)) {
2074. 	    setuwep((struct obj *) 0, TRUE);
2075. 	    You("are empty %s.", body_part(HANDED));
2076. 	    u.twoweap = FALSE;
2077. 	  }
2078. 	} else if (taking_off == W_SWAPWEP) {
2079. 	  setuswapwep((struct obj *) 0, TRUE);
2080. 	  You("no longer have a second weapon readied.");
2081. 	  u.twoweap = FALSE;
2082. 	} else if (taking_off == W_QUIVER) {
2083. 	  setuqwep((struct obj *) 0);
2084. 	  You("no longer have ammunition readied.");
2085. 	} else if (taking_off == WORN_ARMOR) {
2086. 	  otmp = uarm;
2087. 	  if(!cursed(otmp)) (void) Armor_off();
2088. 	} else if (taking_off == WORN_CLOAK) {
2089. 	  otmp = uarmc;
2090. 	  if(!cursed(otmp)) (void) Cloak_off();
2091. 	} else if (taking_off == WORN_BOOTS) {
2092. 	  otmp = uarmf;
2093. 	  if(!cursed(otmp)) (void) Boots_off();
2094. 	} else if (taking_off == WORN_GLOVES) {
2095. 	  otmp = uarmg;
2096. 	  if(!cursed(otmp)) (void) Gloves_off();
2097. 	} else if (taking_off == WORN_HELMET) {
2098. 	  otmp = uarmh;
2099. 	  if(!cursed(otmp)) (void) Helmet_off();
2100. 	} else if (taking_off == WORN_SHIELD) {
2101. 	  otmp = uarms;
2102. 	  if(!cursed(otmp)) (void) Shield_off();
2103. #ifdef TOURIST
2104. 	} else if (taking_off == WORN_SHIRT) {
2105. 	  otmp = uarmu;
2106. 	  if (!cursed(otmp)) (void) Shirt_off();
2107. #endif
2108. 	} else if (taking_off == WORN_AMUL) {
2109. 	  otmp = uamul;
2110. 	  if(!cursed(otmp)) Amulet_off();
2111. 	} else if (taking_off == LEFT_RING) {
2112. 	  otmp = uleft;
2113. 	  if(!cursed(otmp)) Ring_off(uleft);
2114. 	} else if (taking_off == RIGHT_RING) {
2115. 	  otmp = uright;
2116. 	  if(!cursed(otmp)) Ring_off(uright);
2117. 	} else if (taking_off == WORN_BLINDF) {
2118. 	  if (!cursed(ublindf)) Blindf_off(ublindf);
2119. 	} else impossible("do_takeoff: taking off %lx", taking_off);
2120. 
2121. 	return(otmp);
2122. }
2123. 
2124. static const char *disrobing = "";
2125. 
2126. STATIC_PTR
2127. int
2128. take_off()
2129. {
2130. 	register int i;
2131. 	register struct obj *otmp;
2132. 
2133. 	if (taking_off) {
2134. 	    if (todelay > 0) {
2135. 		todelay--;
2136. 		return(1);	/* still busy */
2137. 	    } else {
2138. 		if ((otmp = do_takeoff())) off_msg(otmp);
2139. 	    }
2140. 	    takeoff_mask &= ~taking_off;
2141. 	    taking_off = 0L;
2142. 	}
2143. 
2144. 	for(i = 0; takeoff_order[i]; i++)
2145. 	    if(takeoff_mask & takeoff_order[i]) {
2146. 		taking_off = takeoff_order[i];
2147. 		break;
2148. 	    }
2149. 
2150. 	otmp = (struct obj *) 0;
2151. 	todelay = 0;
2152. 
2153. 	if (taking_off == 0L) {
2154. 	  You("finish %s.", disrobing);
2155. 	  return 0;
2156. 	} else if (taking_off == W_WEP) {
2157. 	  todelay = 1;
2158. 	} else if (taking_off == W_SWAPWEP) {
2159. 	  todelay = 1;
2160. 	} else if (taking_off == W_QUIVER) {
2161. 	  todelay = 1;
2162. 	} else if (taking_off == WORN_ARMOR) {
2163. 	  otmp = uarm;
2164. 	  /* If a cloak is being worn, add the time to take it off and put
2165. 	   * it back on again.  Kludge alert! since that time is 0 for all
2166. 	   * known cloaks, add 1 so that it actually matters...
2167. 	   */
2168. 	  if (uarmc) todelay += 2 * objects[uarmc->otyp].oc_delay + 1;
2169. 	} else if (taking_off == WORN_CLOAK) {
2170. 	  otmp = uarmc;
2171. 	} else if (taking_off == WORN_BOOTS) {
2172. 	  otmp = uarmf;
2173. 	} else if (taking_off == WORN_GLOVES) {
2174. 	  otmp = uarmg;
2175. 	} else if (taking_off == WORN_HELMET) {
2176. 	  otmp = uarmh;
2177. 	} else if (taking_off == WORN_SHIELD) {
2178. 	  otmp = uarms;
2179. #ifdef TOURIST
2180. 	} else if (taking_off == WORN_SHIRT) {
2181. 	  otmp = uarmu;
2182. 	  /* add the time to take off and put back on armor and/or cloak */
2183. 	  if (uarm)  todelay += 2 * objects[uarm->otyp].oc_delay;
2184. 	  if (uarmc) todelay += 2 * objects[uarmc->otyp].oc_delay + 1;
2185. #endif
2186. 	} else if (taking_off == WORN_AMUL) {
2187. 	  todelay = 1;
2188. 	} else if (taking_off == LEFT_RING) {
2189. 	  todelay = 1;
2190. 	} else if (taking_off == RIGHT_RING) {
2191. 	  todelay = 1;
2192. 	} else if (taking_off == WORN_BLINDF) {
2193. 	  todelay = 2;
2194. 	} else {
2195. 	  impossible("take_off: taking off %lx", taking_off);
2196. 	  return 0;	/* force done */
2197. 	}
2198. 
2199. 	if (otmp) todelay += objects[otmp->otyp].oc_delay;
2200. 
2201. 	/* Since setting the occupation now starts the counter next move, that
2202. 	 * would always produce a delay 1 too big per item unless we subtract
2203. 	 * 1 here to account for it.
2204. 	 */
2205. 	if (todelay > 0) todelay--;
2206. 
2207. 	set_occupation(take_off, disrobing, 0);
2208. 	return(1);		/* get busy */
2209. }
2210. 
2211. /* clear saved context to avoid inappropriate resumption of interrupted 'A' */
2212. void
2213. reset_remarm()
2214. {
2215. 	taking_off = takeoff_mask = 0L;
2216. 	disrobing = nul;
2217. }
2218. 
2219. /* the 'A' command -- remove multiple worn items */
2220. int
2221. doddoremarm()
2222. {
2223.     int result = 0;
2224. 
2225.     if (taking_off || takeoff_mask) {
2226. 	You("continue %s.", disrobing);
2227. 	set_occupation(take_off, disrobing, 0);
2228. 	return 0;
2229.     } else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf &&
2230. 		!uleft && !uright && !wearing_armor()) {
2231. 	You("are not wearing anything.");
2232. 	return 0;
2233.     }
2234. 
2235.     add_valid_menu_class(0); /* reset */
2236.     if (flags.menu_style != MENU_TRADITIONAL ||
2237. 	    (result = ggetobj("take off", select_off, 0, FALSE, (unsigned *)0)) < -1)
2238. 	result = menu_remarm(result);
2239. 
2240.     if (takeoff_mask) {
2241. 	/* default activity for armor and/or accessories,
2242. 	   possibly combined with weapons */
2243. 	disrobing = "disrobing";
2244. 	/* specific activity when handling weapons only */
2245. 	if (!(takeoff_mask & ~(W_WEP|W_SWAPWEP|W_QUIVER)))
2246. 	    disrobing = "disarming";
2247. 	(void) take_off();
2248.     }
2249.     /* The time to perform the command is already completely accounted for
2250.      * in take_off(); if we return 1, that would add an extra turn to each
2251.      * disrobe.
2252.      */
2253.     return 0;
2254. }
2255. 
2256. STATIC_OVL int
2257. menu_remarm(retry)
2258. int retry;
2259. {
2260.     int n, i = 0;
2261.     menu_item *pick_list;
2262.     boolean all_worn_categories = TRUE;
2263. 
2264.     if (retry) {
2265. 	all_worn_categories = (retry == -2);
2266.     } else if (flags.menu_style == MENU_FULL) {
2267. 	all_worn_categories = FALSE;
2268. 	n = query_category("What type of things do you want to take off?",
2269. 			   invent, WORN_TYPES|ALL_TYPES, &pick_list, PICK_ANY);
2270. 	if (!n) return 0;
2271. 	for (i = 0; i < n; i++) {
2272. 	    if (pick_list[i].item.a_int == ALL_TYPES_SELECTED)
2273. 		all_worn_categories = TRUE;
2274. 	    else
2275. 		add_valid_menu_class(pick_list[i].item.a_int);
2276. 	}
2277. 	free((genericptr_t) pick_list);
2278.     } else if (flags.menu_style == MENU_COMBINATION) {
2279. 	all_worn_categories = FALSE;
2280. 	if (ggetobj("take off", select_off, 0, TRUE, (unsigned *)0) == -2)
2281. 	    all_worn_categories = TRUE;
2282.     }
2283. 
2284.     n = query_objlist("What do you want to take off?", invent,
2285. 			SIGNAL_NOMENU|USE_INVLET|INVORDER_SORT,
2286. 			&pick_list, PICK_ANY,
2287. 			all_worn_categories ? is_worn : is_worn_by_type);
2288.     if (n > 0) {
2289. 	for (i = 0; i < n; i++)
2290. 	    (void) select_off(pick_list[i].item.a_obj);
2291. 	free((genericptr_t) pick_list);
2292.     } else if (n < 0 && flags.menu_style != MENU_COMBINATION) {
2293. 	There("is nothing else you can remove or unwield.");
2294.     }
2295.     return 0;
2296. }
2297. 
2298. /* hit by destroy armor scroll/black dragon breath/monster spell */
2299. int
2300. destroy_arm(atmp)
2301. register struct obj *atmp;
2302. {
2303. 	register struct obj *otmp;
2304. #define DESTROY_ARM(o) ((otmp = (o)) != 0 && \
2305. 			(!atmp || atmp == otmp) && \
2306. 			(!obj_resists(otmp, 0, 90)))
2307. 
2308. 	if (DESTROY_ARM(uarmc)) {
2309. 		if (donning(otmp)) cancel_don();
2310. 		Your("%s crumbles and turns to dust!",
2311. 		     cloak_simple_name(uarmc));
2312. 		(void) Cloak_off();
2313. 		useup(otmp);
2314. 	} else if (DESTROY_ARM(uarm)) {
2315. 		if (donning(otmp)) cancel_don();
2316. 		Your("armor turns to dust and falls to the %s!",
2317. 			surface(u.ux,u.uy));
2318. 		(void) Armor_gone();
2319. 		useup(otmp);
2320. #ifdef TOURIST
2321. 	} else if (DESTROY_ARM(uarmu)) {
2322. 		if (donning(otmp)) cancel_don();
2323. 		Your("shirt crumbles into tiny threads and falls apart!");
2324. 		(void) Shirt_off();
2325. 		useup(otmp);
2326. #endif
2327. 	} else if (DESTROY_ARM(uarmh)) {
2328. 		if (donning(otmp)) cancel_don();
2329. 		Your("helmet turns to dust and is blown away!");
2330. 		(void) Helmet_off();
2331. 		useup(otmp);
2332. 	} else if (DESTROY_ARM(uarmg)) {
2333. 		if (donning(otmp)) cancel_don();
2334. 		Your("gloves vanish!");
2335. 		(void) Gloves_off();
2336. 		useup(otmp);
2337. 		selftouch("You");
2338. 	} else if (DESTROY_ARM(uarmf)) {
2339. 		if (donning(otmp)) cancel_don();
2340. 		Your("boots disintegrate!");
2341. 		(void) Boots_off();
2342. 		useup(otmp);
2343. 	} else if (DESTROY_ARM(uarms)) {
2344. 		if (donning(otmp)) cancel_don();
2345. 		Your("shield crumbles away!");
2346. 		(void) Shield_off();
2347. 		useup(otmp);
2348. 	} else {
2349. 		return 0;		/* could not destroy anything */
2350. 	}
2351. 
2352. #undef DESTROY_ARM
2353. 	stop_occupation();
2354. 	return(1);
2355. }
2356. 
2357. void
2358. adj_abon(otmp, delta)
2359. register struct obj *otmp;
2360. register schar delta;
2361. {
2362. 	if (uarmg && uarmg == otmp && otmp->otyp == GAUNTLETS_OF_DEXTERITY) {
2363. 		if (delta) {
2364. 			makeknown(uarmg->otyp);
2365. 			ABON(A_DEX) += (delta);
2366. 		}
2367. 		flags.botl = 1;
2368. 	}
2369. 	if (uarmh && uarmh == otmp && otmp->otyp == HELM_OF_BRILLIANCE) {
2370. 		if (delta) {
2371. 			makeknown(uarmh->otyp);
2372. 			ABON(A_INT) += (delta);
2373. 			ABON(A_WIS) += (delta);
2374. 		}
2375. 		flags.botl = 1;
2376. 	}
2377. }
2378. 
2379. #endif /* OVLB */
2380. 
2381. /*do_wear.c*/

Also on Fandom

Random Wiki