Source:NetHack 3.0.0/do wear.c

Below is the full text to do_wear.c from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/do_wear.c#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   /*	SCCS Id: @(#)do_wear.c	3.0	88/05/10 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.   static int todelay; 8.    9.    static long takeoff_mask = 0L, taking_off = 0L; 10.  static const long takeoff_order[] = { WORN_BLINDF, 1L, /* weapon */ 11.  	WORN_SHIELD, WORN_GLOVES, LEFT_RING, RIGHT_RING, WORN_CLOAK, 12.  	WORN_HELMET, WORN_AMUL, WORN_ARMOR, 13.  #ifdef SHIRT 14.  	WORN_SHIRT, 15.  #endif 16.  	WORN_BOOTS, 0L }; 17.   18.   void 19.  off_msg(otmp) register struct obj *otmp; { 20.  	if(flags.verbose) 21.  	    You("were wearing %s.", doname(otmp)); 22.  }  23.    24.   /* for items that involve no delay */ 25.  static void 26.  on_msg(otmp) register struct obj *otmp; { 27.  	register char *bp = xname(otmp); 28.  	char buf[BUFSZ]; 29.   30.   	setan(bp, buf); 31.  	if(flags.verbose) 32.  	    You("are now wearing %s.", buf); 33.  }  34.    35.   boolean 36.  is_boots(otmp) register struct obj *otmp; { 37.  	return(otmp->otyp >= LOW_BOOTS &&  38.   	   	otmp->otyp <= LEVITATION_BOOTS); 39.  }  40.    41.   boolean 42.  is_helmet(otmp) register struct obj *otmp; { 43.  #ifdef TOLKIEN 44.  	return(otmp->otyp >= ELVEN_LEATHER_HELM &&  45.   		otmp->otyp <= HELM_OF_TELEPATHY); 46.  #else 47.  	return(otmp->otyp >= ORCISH_HELM &&  48.   		otmp->otyp <= HELM_OF_TELEPATHY); 49.  #endif 50.  }  51.    52.   boolean 53.  is_gloves(otmp) register struct obj *otmp; { 54.  	return(otmp->otyp >= LEATHER_GLOVES &&  55.   	   	otmp->otyp <= GAUNTLETS_OF_DEXTERITY); 56.  }  57.    58.   boolean 59.  is_cloak(otmp) register struct obj *otmp; { 60.  	return(otmp->otyp >= MUMMY_WRAPPING &&  61.   		otmp->otyp <= CLOAK_OF_DISPLACEMENT); 62.  }  63.    64.   boolean 65.  is_shield(otmp) register struct obj *otmp; { 66.  	return(otmp->otyp >= SMALL_SHIELD &&  67.   	   	otmp->otyp <= SHIELD_OF_REFLECTION); 68.  }  69.    70.   /*  71.    * The Type_on functions should be called *after* setworn. 72.   * The Type_off functions call setworn themselves. 73.   */  74.    75.   static int 76.  Boots_on { 77.      long oldprop = 78.  		u.uprops[objects[uarmf->otyp].oc_oprop].p_flgs & ~(WORN_BOOTS | TIMEOUT); 79.   80.       switch(uarmf->otyp) { 81.  	case LOW_BOOTS: 82.  	case IRON_SHOES: 83.  	case HIGH_BOOTS: 84.  	case WATER_WALKING_BOOTS: 85.  	case JUMPING_BOOTS: 86.  		break; 87.  	case SPEED_BOOTS: 88.  		if (!oldprop) { 89.  			makeknown(uarmf->otyp); 90.  			You("feel yourself speed up."); 91.  		}  92.   		break; 93.  	case ELVEN_BOOTS: 94.  		if (!oldprop) { 95.  			makeknown(uarmf->otyp); 96.  			You("walk very quietly."); 97.  		}  98.   		break; 99.  	case FUMBLE_BOOTS: 100. 		if (!oldprop) 101. 			Fumbling += rnd(20); 102. 		break; 103. 	case LEVITATION_BOOTS: 104. 		if (!oldprop) { 105. 			makeknown(uarmf->otyp); 106. 			float_up; 107. 		}  108.  		break; 109. 	default: impossible("Unknown type of boots (%d)", uarmf->otyp); 110.     }  111.      return 0; 112. }  113.   114.  int 115. Boots_off { 116.     register struct obj *obj = uarmf; 117. 	/* For levitation, float_down returns if Levitation, so we  118. * must do a setworn _before_ the levitation case. 119. 	 */  120.      long oldprop = 121. 		u.uprops[objects[uarmf->otyp].oc_oprop].p_flgs & ~(WORN_BOOTS | TIMEOUT); 122.  123.      setworn((struct obj *)0, W_ARMF); 124.     switch(obj->otyp) { 125. 	case SPEED_BOOTS: 126. 		if (!oldprop) { 127. 			makeknown(obj->otyp); 128. 			You("feel yourself slow down."); 129. 		}  130.  		break; 131. 	case WATER_WALKING_BOOTS: 132. 		if(is_pool(u.ux,u.uy) && !Levitation  133.  #ifdef POLYSELF  134.  		    && !is_flyer(uasmon)  135.  #endif  136.  		    ) { 137. 			makeknown(obj->otyp); 138. 			/* make boots known in case you survive the drowning */ 139. 			drown; 140. 		}  141.  		break; 142. 	case ELVEN_BOOTS: 143. 		if (!oldprop) { 144. 			makeknown(obj->otyp); 145. 			You("sure are noisy."); 146. 		}  147.  		break; 148. 	case FUMBLE_BOOTS: 149. 		if (!oldprop) 150. 			Fumbling = 0; 151. 		break; 152. 	case LEVITATION_BOOTS: 153. 		if (!oldprop) { 154. 			(void) float_down; 155. 			makeknown(obj->otyp); 156. 		}  157.  		break; 158. 	case LOW_BOOTS: 159. 	case IRON_SHOES: 160. 	case HIGH_BOOTS: 161. 	case JUMPING_BOOTS: 162. 		break; 163. 	default: impossible("Unknown type of boots (%d)", obj->otyp); 164.     }  165.      return 0; 166. }  167.   168.  static int 169. Cloak_on { 170.     long oldprop = u.uprops[objects[uarmc->otyp].oc_oprop].p_flgs & ~WORN_CLOAK; 171.  172.      switch(uarmc->otyp) { 173. 	case ELVEN_CLOAK: 174. 	case CLOAK_OF_PROTECTION: 175. 	case CLOAK_OF_DISPLACEMENT: 176. 		makeknown(uarmc->otyp); 177. 		break; 178. 	case MUMMY_WRAPPING: 179. #ifdef TOLKIEN 180. 	case ORCISH_CLOAK: 181. 	case DWARVISH_CLOAK: 182. #endif 183. 	case CLOAK_OF_MAGIC_RESISTANCE: 184. 		break; 185. 	case CLOAK_OF_INVISIBILITY: 186. 		if (!oldprop && !See_invisible && !Blind) { 187. 			makeknown(uarmc->otyp); 188. 			pline("Suddenly you cannot see yourself."); 189. 		}  190.  		break; 191. 	default: impossible("Unknown type of cloak (%d)", uarmc->otyp); 192.     }  193.      return 0; 194. }  195.   196.  int 197. Cloak_off { 198.     long oldprop = u.uprops[objects[uarmc->otyp].oc_oprop].p_flgs & ~WORN_CLOAK; 199.  200.      switch(uarmc->otyp) { 201. 	case MUMMY_WRAPPING: 202. 	case ELVEN_CLOAK: 203. #ifdef TOLKIEN 204. 	case ORCISH_CLOAK: 205. 	case DWARVISH_CLOAK: 206. #endif 207. 	case CLOAK_OF_PROTECTION: 208. 	case CLOAK_OF_MAGIC_RESISTANCE: 209. 	case CLOAK_OF_DISPLACEMENT: 210. 		break; 211. 	case CLOAK_OF_INVISIBILITY: 212. 		if (!oldprop && !See_invisible && !Blind) { 213. 			makeknown(uarmc->otyp); 214. 			pline("Suddenly you can see yourself."); 215. 		}  216.  		break; 217. 	default: impossible("Unknown type of cloak (%d)", uarmc->otyp); 218.     }  219.      setworn((struct obj *)0, W_ARMC); 220.     return 0; 221. }  222.   223.  static int 224. Helmet_on { 225.     switch(uarmh->otyp) { 226. 	case FEDORA: 227. 	case HELMET: 228. #ifdef TOLKIEN 229. 	case ELVEN_LEATHER_HELM: 230. 	case DWARVISH_IRON_HELM: 231. #endif 232. 	case ORCISH_HELM: 233. 	case HELM_OF_TELEPATHY: 234. 		break; 235. 	case HELM_OF_BRILLIANCE: 236. 		if (uarmh->spe) { 237. 			ABON(A_INT) += uarmh->spe; 238. 			ABON(A_WIS) += uarmh->spe; 239. 			flags.botl = 1; 240. 			makeknown(uarmh->otyp); 241. 		}  242.  		break; 243. 	case HELM_OF_OPPOSITE_ALIGNMENT: 244. 		if (u.ualigntyp == U_NEUTRAL) u.ualigntyp = rnd(2) ? -1 : 1; 245.  		else u.ualigntyp = -(u.ualigntyp); 246. 		makeknown(uarmh->otyp); 247. 		flags.botl = 1; 248. 		break; 249. 	default: impossible("Unknown type of helm (%d)", uarmh->otyp); 250.     }  251.      return 0; 252. }  253.   254.  int 255. Helmet_off { 256.     switch(uarmh->otyp) { 257. 	case FEDORA: 258. 	case HELMET: 259. #ifdef TOLKIEN 260. 	case ELVEN_LEATHER_HELM: 261. 	case DWARVISH_IRON_HELM: 262. #endif 263. 	case ORCISH_HELM: 264. 	case HELM_OF_TELEPATHY: 265. 		break; 266. 	case HELM_OF_BRILLIANCE: 267. 		if (uarmh->spe) { 268. 			ABON(A_INT) -= uarmh->spe; 269. 			ABON(A_WIS) -= uarmh->spe; 270. 			flags.botl = 1; 271. 		}  272.  		break; 273. 	case HELM_OF_OPPOSITE_ALIGNMENT: 274. #ifdef THEOLOGY 275. 		u.ualigntyp = u.ualignbase[0]; 276. #else 277. 		if (pl_character[0] == 'P' ||  278.  		    pl_character[0] == 'T' ||  279.  		    pl_character[0] == 'W') 280. 			u.ualigntyp = U_NEUTRAL; 281. 		else u.ualigntyp = -(u.ualigntyp); 282. #endif 283. 		flags.botl = 1; 284. 		break; 285. 	default: impossible("Unknown type of helm (%d)", uarmh->otyp); 286.     }  287.      setworn((struct obj *)0, W_ARMH); 288.     return 0; 289. }  290.   291.  static int 292. Gloves_on { 293.     long oldprop = 294. 	u.uprops[objects[uarmg->otyp].oc_oprop].p_flgs & ~(WORN_GLOVES | TIMEOUT); 295.  296.      switch(uarmg->otyp) { 297. 	case LEATHER_GLOVES: 298. 		break; 299. 	case GAUNTLETS_OF_FUMBLING: 300. 		if (!oldprop) 301. 			Fumbling += rnd(20); 302. 		break; 303. 	case GAUNTLETS_OF_POWER: 304. 		makeknown(uarmg->otyp); 305. 		flags.botl = 1; /* taken care of in attrib.c */ 306. 		break; 307. 	case GAUNTLETS_OF_DEXTERITY: 308. 		if (uarmg->spe) makeknown(uarmg->otyp); 309. 		ABON(A_DEX) += uarmg->spe; 310. 		flags.botl = 1; 311. 		break; 312. 	default: impossible("Unknown type of gloves (%d)", uarmg->otyp); 313.     }  314.      return 0; 315. }  316.   317.  int 318. Gloves_off { 319.     long oldprop = 320. 	u.uprops[objects[uarmg->otyp].oc_oprop].p_flgs & ~(WORN_GLOVES | TIMEOUT); 321.  322.      switch(uarmg->otyp) { 323. 	case LEATHER_GLOVES: 324. 		break; 325. 	case GAUNTLETS_OF_FUMBLING: 326. 		if (!oldprop) 327. 			Fumbling = 0; 328. 		break; 329. 	case GAUNTLETS_OF_POWER: 330. 		makeknown(uarmg->otyp); 331. 		flags.botl = 1; /* taken care of in attrib.c */ 332. 		break; 333. 	case GAUNTLETS_OF_DEXTERITY: 334. 		if (uarmg->spe) makeknown(uarmg->otyp); 335. 		ABON(A_DEX) -= uarmg->spe; 336. 		flags.botl = 1; 337. 		break; 338. 	default: impossible("Unknown type of gloves (%d)", uarmg->otyp); 339.     }  340.      setworn((struct obj *)0, W_ARMG); 341.     return 0; 342. }  343.   344.  /*  345.  static int 346. Shield_on { 347.     switch(uarms->otyp) { 348. 	case SMALL_SHIELD: 349. #ifdef TOLKIEN 350. 	case ELVEN_SHIELD: 351. 	case URUK_HAI_SHIELD: 352. 	case ORCISH_SHIELD: 353. 	case DWARVISH_ROUNDSHIELD: 354. #endif 355. 	case LARGE_SHIELD: 356. 	case SHIELD_OF_REFLECTION: 357. 		break; 358. 	default: impossible("Unknown type of shield (%d)", uarms->otyp); 359.     }  360.      return 0; 361. }  362.  */  363.   364.  int 365. Shield_off { 366. /*  367.      switch(uarms->otyp) { 368. 	case SMALL_SHIELD: 369. #ifdef TOLKIEN 370. 	case ELVEN_SHIELD: 371. 	case URUK_HAI_SHIELD: 372. 	case ORCISH_SHIELD: 373. 	case DWARVISH_ROUNDSHIELD: 374. #endif 375. 	case LARGE_SHIELD: 376. 	case SHIELD_OF_REFLECTION: 377. 		break; 378. 	default: impossible("Unknown type of shield (%d)", uarms->otyp); 379.     }  380.  */  381.      setworn((struct obj *)0, W_ARMS); 382.     return 0; 383. }  384.   385.  /* This must be done in worn.c, because one of the possible intrinsics conferred 386.  * is fire resistance, and we have to immediately set HFire_resistance in worn.c  387. * since worn.c will check it before returning. 388. static int 389. Armor_on 390. {  391.      return 0; 392. }  393.   */  394.   395.  int 396. Armor_off 397. {  398.      setworn((struct obj *)0, W_ARM); 399.     return 0; 400. }  401.   402.  /* The gone functions differ from the off functions in that if you die from 403.  * taking it off and have life saving, you still die. 404.  */  405.  int 406. Armor_gone 407. {  408.      setnotworn(uarm); 409.     return 0; 410. }  411.   412.  static void 413. Amulet_on 414. {  415.      char buf[BUFSZ]; 416.  417.      switch(uamul->otyp) { 418. 	case AMULET_OF_ESP: 419. 	case AMULET_OF_LIFE_SAVING: 420. 	case AMULET_VERSUS_POISON: 421. 	case AMULET_OF_REFLECTION: 422. 		break; 423. 	case AMULET_OF_CHANGE: 424. 		makeknown(AMULET_OF_CHANGE); 425. 		flags.female = !flags.female; 426. 		max_rank_sz; 427. 		/* Don't use same message as polymorph */ 428. 		You("are suddenly very %s!", flags.female ? "feminine"  429.  			: "masculine"); 430. 		if (pl_character[0]=='P') 431. 			Strcpy(pl_character+6, flags.female? "ess":""); 432. 		if (pl_character[0]=='C') 433. 			Strcpy(pl_character+5, flags.female ? "woman" : "man"); 434. #ifdef WIZARD 435. 		if (!wizard) { 436. #endif 437. newname:	more; 438. 		do { 439. 		    pline("What shall you be called, %s? ",  440.  			flags.female ? "madam" : "sir"); 441. 		    getlin(buf); 442. 		} while (buf[0]=='\033' || buf[0]==0); 443. 		if (!strcmp(plname,buf)) { 444. 		    pline("Sorry, that name no longer seems appropriate!"); 445. 		    goto newname; 446. 		}  447.  		flags.botl = 1; 448. 		(void)strncpy(plname, buf, sizeof(plname)-1); 449. 		Sprintf(SAVEF, "save/%d%s", getuid, plname); 450. 		regularize(SAVEF+5);		/* avoid. or / in name */ 451. #ifdef WIZARD 452. 		}  453.  #endif 454. 		pline("The amulet disintegrates!"); 455. 		useup(uamul); 456. 		break; 457. 	case AMULET_OF_STRANGULATION: 458. 		makeknown(AMULET_OF_STRANGULATION); 459. 		pline("It constricts your throat!"); 460. 		Strangled = 6; 461. 		break; 462. 	case AMULET_OF_RESTFUL_SLEEP: 463. 		Sleeping = rnd(100); 464. 		break; 465. 	case AMULET_OF_YENDOR: 466. 		break; 467.     }  468.  }  469.   470.  void 471. Amulet_off 472. {  473.      switch(uamul->otyp) { 474. 	case AMULET_OF_ESP: 475. 	case AMULET_OF_LIFE_SAVING: 476. 	case AMULET_VERSUS_POISON: 477. 	case AMULET_OF_REFLECTION: 478. 		break; 479. 	case AMULET_OF_CHANGE: 480. 		impossible("Wearing an amulet of change?"); 481. 		break; 482. 	case AMULET_OF_STRANGULATION: 483. 		if (Strangled) { 484. 			You("can breathe more easily!"); 485. 			Strangled = 0; 486. 		}  487.  		break; 488. 	case AMULET_OF_RESTFUL_SLEEP: 489. 		Sleeping = 0; 490. 		break; 491. 	case AMULET_OF_YENDOR: 492. 		break; 493.     }  494.      setworn((struct obj *)0, W_AMUL); 495. }  496.   497.  void 498. Ring_on(obj) 499. register struct obj *obj; 500. {  501.      long oldprop = u.uprops[objects[obj->otyp].oc_oprop].p_flgs & ~W_RING; 502.  503.      switch(obj->otyp){ 504. 	case RIN_TELEPORTATION: 505. 	case RIN_REGENERATION: 506. 	case RIN_SEARCHING: 507. 	case RIN_STEALTH: 508. 	case RIN_HUNGER: 509. 	case RIN_AGGRAVATE_MONSTER: 510. 	case RIN_POISON_RESISTANCE: 511. 	case RIN_FIRE_RESISTANCE: 512. 	case RIN_COLD_RESISTANCE: 513. 	case RIN_SHOCK_RESISTANCE: 514. 	case RIN_CONFLICT: 515. 	case RIN_WARNING: 516. 	case RIN_TELEPORT_CONTROL: 517. #ifdef POLYSELF 518. 	case RIN_POLYMORPH: 519. 	case RIN_POLYMORPH_CONTROL: 520. #endif 521. 		break; 522. 	case RIN_SEE_INVISIBLE: 523. 		if (Invisible && !Blind) { 524. 			newsym(u.ux,u.uy); 525. 			pline("Suddenly you can see yourself."); 526. 			makeknown(RIN_SEE_INVISIBLE); 527. 		}  528.  		break; 529. 	case RIN_INVISIBILITY: 530. 		if (!oldprop && !See_invisible && !Blind) { 531. 			makeknown(RIN_INVISIBILITY); 532. 			Your("body takes on a %s transparency...",  533.  				Hallucination ? "normal" : "strange"); 534. 		}  535.  	case RIN_ADORNMENT: 536. 		ABON(A_CHA) += obj->spe; 537. 		flags.botl = 1; 538. 		if (obj->spe || objects[RIN_ADORNMENT].oc_name_known) { 539. 			makeknown(RIN_ADORNMENT); 540. 			obj->known = 1; 541. 		}  542.  		break; 543. 	case RIN_LEVITATION: 544. 		if(!oldprop) { 545. 			float_up; 546. 			makeknown(RIN_LEVITATION); 547. 			obj->known = 1; 548. 		}  549.  		break; 550. 	case RIN_GAIN_STRENGTH: 551. 		ABON(A_STR) += obj->spe; 552. 		flags.botl = 1; 553. 		if (obj->spe || objects[RIN_GAIN_STRENGTH].oc_name_known) { 554. 			makeknown(RIN_GAIN_STRENGTH); 555. 			obj->known = 1; 556. 		}  557.  		break; 558. 	case RIN_INCREASE_DAMAGE: 559. 		u.udaminc += obj->spe; 560. 		break; 561. 	case RIN_PROTECTION_FROM_SHAPE_CHAN: 562. 		rescham; 563. 		break; 564. 	case RIN_PROTECTION: 565. 		flags.botl = 1; 566. 		if (obj->spe || objects[RIN_PROTECTION].oc_name_known) { 567. 			makeknown(RIN_PROTECTION); 568. 			obj->known = 1; 569. 		}  570.  		break; 571.     }  572.  }  573.   574.  static void 575. Ring_off_or_gone(obj,gone) 576. register struct obj *obj; 577. boolean gone; 578. {  579.      register long mask = obj->owornmask & W_RING; 580.  581.      if(!(u.uprops[objects[obj->otyp].oc_oprop].p_flgs & mask)) 582. 	impossible("Strange... I didn't know you had that ring."); 583.     if(gone) setnotworn(obj); 584.     else setworn((struct obj *)0, obj->owornmask); 585.     switch(obj->otyp) { 586. 	case RIN_TELEPORTATION: 587. 	case RIN_REGENERATION: 588. 	case RIN_SEARCHING: 589. 	case RIN_STEALTH: 590. 	case RIN_HUNGER: 591. 	case RIN_AGGRAVATE_MONSTER: 592. 	case RIN_POISON_RESISTANCE: 593. 	case RIN_FIRE_RESISTANCE: 594. 	case RIN_COLD_RESISTANCE: 595. 	case RIN_SHOCK_RESISTANCE: 596. 	case RIN_CONFLICT: 597. 	case RIN_WARNING: 598. 	case RIN_TELEPORT_CONTROL: 599. #ifdef POLYSELF 600. 	case RIN_POLYMORPH: 601. 	case RIN_POLYMORPH_CONTROL: 602. #endif 603. 		break; 604. 	case RIN_SEE_INVISIBLE: 605. 		if (Invisible && !Blind) { 606. 			pline("Suddenly you cannot see yourself."); 607. 			makeknown(RIN_SEE_INVISIBLE); 608. 		}  609.  		break; 610. 	case RIN_INVISIBILITY: 611. 		if (!(Invisible & ~W_RING) && !See_invisible && !Blind) { 612. 			Your("body seems to unfade..."); 613. 			makeknown(RIN_INVISIBILITY); 614. 		}  615.  		break; 616. 	case RIN_ADORNMENT: 617. 		ABON(A_CHA) -= obj->spe; 618. 		flags.botl = 1; 619. 		break; 620. 	case RIN_LEVITATION: 621. 		(void) float_down; 622. 		if (!Levitation) makeknown(RIN_LEVITATION); 623. 		break; 624. 	case RIN_GAIN_STRENGTH: 625. 		ABON(A_STR) -= obj->spe; 626. 		flags.botl = 1; 627. 		break; 628. 	case RIN_INCREASE_DAMAGE: 629. 		u.udaminc -= obj->spe; 630. 		break; 631. 	case RIN_PROTECTION_FROM_SHAPE_CHAN: 632. 		/* If you're no longer protected, let the chameleons 633. 		 * change shape again -dgk 634. 		 */  635.  		restartcham; 636. 		break; 637.     }  638.  }  639.   640.  void 641. Ring_off(obj) 642. struct obj *obj; 643. {  644.  	Ring_off_or_gone(obj,FALSE); 645. }  646.   647.  void 648. Ring_gone(obj) 649. struct obj *obj; 650. {  651.  	Ring_off_or_gone(obj,TRUE); 652. }  653.   654.  void 655. Blindf_on(otmp) 656. register struct obj *otmp; 657. {  658.  	setworn(otmp, W_TOOL); 659. 	on_msg(otmp); 660. 	seeoff(0); 661. }  662.   663.  void 664. Blindf_off(otmp) 665. register struct obj *otmp; 666. {  667.  	setworn((struct obj *)0, otmp->owornmask); 668. 	off_msg(otmp); 669. 	if (!Blinded)	make_blinded(1L,FALSE); /* See on next move */ 670. 	else		You("still cannot see."); 671. }  672.   673.  /* called in main to set intrinsics of worn start-up items */ 674. void 675. set_wear { 676. /*	if (uarm)  (void) Armor_on; */ 677. 	if (uarmc) (void) Cloak_on; 678. 	if (uarmf) (void) Boots_on; 679. 	if (uarmg) (void) Gloves_on; 680. 	if (uarmh) (void) Helmet_on; 681. /*	if (uarms) (void) Shield_on; */ 682. }  683.   684.  static const char clothes[] = {ARMOR_SYM, 0}; 685. static const char accessories[] = {RING_SYM, AMULET_SYM, TOOL_SYM, 0}; 686.  687.  int 688. dotakeoff { 689. 	register struct obj *otmp; 690. 	int armorpieces = 0; 691.  692.  #define MOREARM(x) if (x) { armorpieces++; otmp = x; } 693. 	MOREARM(uarmh); 694. 	MOREARM(uarms); 695. 	MOREARM(uarmg); 696. 	MOREARM(uarmf); 697. 	if (uarmc) { 698. 		armorpieces++; 699. 		otmp = uarmc; 700. 	} else if (uarm) { 701. 		armorpieces++; 702. 		otmp = uarm; 703. #ifdef SHIRT 704. 	} else if (uarmu) { 705. 		armorpieces++; 706. 		otmp = uarmu; 707. #endif 708. 	}  709.  	if (!armorpieces) { 710. 		pline("Not wearing any armor."); 711. 		return 0; 712. 	}  713.  	if (armorpieces > 1) 714. 		otmp = getobj(clothes, "take off"); 715. 	if (otmp == 0) return(0); 716. 	if (!(otmp->owornmask & W_ARMOR)) { 717. 		You("are not wearing that."); 718. 		return(0); 719. 	}  720.  	if (((otmp == uarm) && (uarmc))  721.  #ifdef SHIRT  722.  				|| ((otmp == uarmu) && (uarmc || uarm))  723.  #endif  724.  								) { 725. 		You("can't take that off."); 726. 		return(0); 727. 	}  728.  	if(otmp == uarmg && uwep && uwep->cursed) {	/* myers@uwmacc */ 729.     You("seem unable to take off the gloves while holding your %s.",  730.  	  is_sword(uwep) ? "sword" : "weapon"); 731. 		uwep->bknown = 1; 732. 		return(0); 733. 	}  734.  	if(otmp == uarmg && Glib) { 735.     You("can't remove the slippery gloves with your slippery fingers."); 736. 		return(0); 737. 	}  738.  	if(otmp == uarmf && u.utrap && u.utraptype == TT_BEARTRAP) {  /* -3. */ 739.  		pline("The bear trap prevents you from pulling your foot out."); 740. 		return(0); 741. 	}  742.  	(void) armoroff(otmp); 743. 	return(1); 744. }  745.   746.  int 747. doremring { 748. 	register struct obj *otmp; 749. 	int Accessories = 0; 750.  751.  #define MOREACC(x) if (x) { Accessories++; otmp = x; } 752. 	MOREACC(uleft); 753. 	MOREACC(uright); 754. 	MOREACC(uamul); 755. 	MOREACC(ublindf); 756.  757.  	if(!Accessories) { 758. 		pline("Not wearing any accessories."); 759. 		return(0); 760. 	}  761.  	if (Accessories != 1) otmp = getobj(accessories, "take off"); 762. 	if(!otmp) return(0); 763. 	if(!(otmp->owornmask & (W_RING | W_AMUL | W_TOOL))) { 764. 		You("are not wearing that."); 765. 		return(0); 766. 	}  767.  	if(cursed(otmp)) return(0); 768. 	if(otmp->olet == RING_SYM) { 769. #ifdef POLYSELF 770. 		if (nolimbs(uasmon)) { 771. 			pline("It seems to be stuck."); 772. 			return(0); 773. 		}  774.  #endif 775. 		if (uarmg && uarmg->cursed) { 776. 			uarmg->bknown = 1; 777. You("seem unable to remove your ring without taking off your gloves."); 778. 			return(0); 779. 		}  780.  		if (welded(uwep) && bimanual(uwep)) { 781. 			uwep->bknown = 1; 782. You("seem unable to remove the ring while your hands hold your %s.",  783.  				is_sword(uwep) ? "sword" : "weapon"); 784. 			return(0); 785. 		}  786.  		if (welded(uwep) && otmp==uright) { 787. 			uwep->bknown = 1; 788. You("seem unable to remove the ring while your right hand holds your %s.",  789.  				is_sword(uwep) ? "sword" : "weapon"); 790. 			return(0); 791. 		}  792.  		/* Sometimes we want to give the off_msg before removing and 793. 		 * sometimes after; for instance, "you were wearing a moonstone  794.  		 * ring (on right hand)" is desired but "you were wearing a  795.  		 * square amulet (being worn)" is not because of the redundant 796. 		 * "being worn". 797. 		 */  798.  		off_msg(otmp); 799. 		Ring_off(otmp); 800. 	} else if(otmp->olet == AMULET_SYM) { 801. 		Amulet_off; 802. 		off_msg(otmp); 803. 	} else Blindf_off(otmp); /* does its own off_msg */ 804. 	return(1); 805. }  806.   807.  int 808. cursed(otmp) register struct obj *otmp; { 809. 	/* Curses, like chickens, come home to roost. */ 810.  	if(otmp->cursed){ 811. 		You("can't.  %s to be cursed.",  812.  			(is_boots(otmp) || is_gloves(otmp) || otmp->quan > 1)  813.  			? "They seem" : "It seems"); 814. 		otmp->bknown = 1; 815. 		return(1); 816. 	}  817.  	return(0); 818. }  819.   820.  int 821. armoroff(otmp) register struct obj *otmp; { 822. 	register int delay = -objects[otmp->otyp].oc_delay; 823.  824.  	if(cursed(otmp)) return(0); 825. 	if(delay) { 826. 		nomul(delay); 827. 		if (is_helmet(otmp)) { 828. 			nomovemsg = "You finish taking off your helmet."; 829. 			afternmv = Helmet_off; 830. 		     }  831.  		else if (is_gloves(otmp)) { 832. 			nomovemsg = "You finish taking off your gloves."; 833. 			afternmv = Gloves_off; 834. 		     }  835.  		else if (is_boots(otmp)) { 836. 			nomovemsg = "You finish taking off your boots."; 837. 			afternmv = Boots_off; 838. 		     }  839.  		else { 840. 			nomovemsg = "You finish taking off your suit."; 841. 			afternmv = Armor_off; 842. 		}  843.  	} else { 844. 		/* Be warned! We want off_msg after removing the item to 845. * avoid "You were wearing ____ (being worn)." However, an 846. * item which grants fire resistance might cause some trouble 847. 		 * if removed in Hell and lifesaving puts it back on; in this 848. 		 * case the message will be printed at the wrong time (after  849.  		 * the messages saying you died and were lifesaved). Luckily, 850. 		 * no cloak, shield, or fast-removable armor grants fire 851. 		 * resistance, so we can safely do the off_msg afterwards. 852. 		 * Rings do grant fire resistance, but for rings we want the 853. 		 * off_msg before removal anyway so there's no problem. Take 854. 		 * care in adding armors granting fire resistance; this code 855. 		 * might need modification. 856. 		 */  857.  		if(is_cloak(otmp)) 858. 			(void) Cloak_off; 859. 		else if(is_shield(otmp)) 860. 			(void) Shield_off; 861. 		else setworn((struct obj *)0, otmp->owornmask & W_ARMOR); 862. 		off_msg(otmp); 863. 	}  864.  	return(1); 865. }  866.   867.  int 868. dowear { 869. 	register struct obj *otmp; 870. 	register int delay; 871. 	register int err = 0; 872. 	long mask = 0; 873.  874.  #ifdef POLYSELF 875. 	/* cantweararm checks for suits of armor */ 876. 	/* verysmall or nohands checks for shields, gloves, etc... */ 877.  	if ((verysmall(uasmon) || nohands(uasmon))) { 878. 		pline("Don't even bother."); 879. 		return(0); 880. 	}  881.  #endif 882. 	otmp = getobj(clothes, "wear"); 883. 	if(!otmp) return(0); 884. #ifdef POLYSELF 885. 	if (cantweararm(uasmon) && !is_shield(otmp) &&  886.  			!is_helmet(otmp) && !is_gloves(otmp) &&  887.  			!is_boots(otmp)) { 888. 		pline("The %s will not fit on your body.",  889.  			is_cloak(otmp) ? "cloak" :  890.  # ifdef SHIRT  891.  			otmp->otyp == HAWAIIAN_SHIRT ? "shirt" :  892.  # endif  893.  			"suit"); 894. 		return(0); 895. 	}  896.  #endif 897. 	if(otmp->owornmask & W_ARMOR) { 898. 		You("are already wearing that!"); 899. 		return(0); 900. 	}  901.  	if(is_helmet(otmp)) { 902. 		if(uarmh) { 903. 			You("are already wearing a helmet."); 904. 			err++; 905. 		} else 906. 			mask = W_ARMH; 907. 	} else if(is_shield(otmp)){ 908. 		if(uarms) { 909. 			You("are already wearing a shield."); 910. 			err++; 911. 		}  912.  		if(uwep && bimanual(uwep)) { 913. 		You("cannot hold a shield and wield a two-handed %s.",  914.  		      is_sword(uwep) ? "sword" : "weapon"); 915. 			err++; 916. 		}  917.  		if(!err) mask = W_ARMS; 918. 	} else if(is_boots(otmp)) { 919. 		   if(uarmf) { 920. 			You("are already wearing boots."); 921. 			err++; 922. 		   } else 923. 			mask = W_ARMF; 924. 	} else if(is_gloves(otmp)) { 925. 		if(uarmg) { 926. 			You("are already wearing gloves."); 927. 			err++; 928. 		} else 929. 		if(uwep && uwep->cursed) { 930. 			You("cannot wear gloves over your %s.",  931.  			      is_sword(uwep) ? "sword" : "weapon"); 932. 			err++; 933. 		} else 934. 			mask = W_ARMG; 935. #ifdef SHIRT 936. 	} else if( otmp->otyp == HAWAIIAN_SHIRT ) { 937. 		if (uarm || uarmc || uarmu) { 938. 			if(!uarm && !uarmc) /* then uarmu */ 939. 			   You("are already wearing a shirt."); 940. 			else 941. 			   You("can't wear that over your %s.",  942.  				 (uarm && !uarmc) ? "armor" : "cloak"); 943. 			err++; 944. 		} else 945. 			mask = W_ARMU; 946. #endif 947. 	} else if(is_cloak(otmp)) { 948. 		if(uarmc) { 949. 			You("are already wearing a cloak."); 950. 			err++; 951. 		} else 952. 			mask = W_ARMC; 953. 	} else { 954. 		if(uarmc) { 955. 			You("cannot wear armor over a cloak."); 956. 			err++; 957. 		} else if(uarm) { 958. 			You("are already wearing some armor."); 959. 			err++; 960. 		}  961.  		if(!err) mask = W_ARM; 962. 	}  963.  /* Unnecessary since now only weapons and special items like pick-axes get 964.  * welded to your hand, not armor 965. 	if(welded(otmp)) { 966. 		if(!err++) 967. 			weldmsg(otmp, FALSE); 968. 	}  969.   */  970.  	if(err) return(0); 971.  972.  	otmp->known = 1; 973. 	if(otmp == uwep) 974. 		setuwep((struct obj *)0); 975. 	setworn(otmp, mask); 976. 	delay = -objects[otmp->otyp].oc_delay; 977. 	if(delay){ 978. 		nomul(delay); 979. 		if(is_boots(otmp)) afternmv = Boots_on; 980. 		if(is_helmet(otmp)) afternmv = Helmet_on; 981. 		if(is_gloves(otmp)) afternmv = Gloves_on; 982. /*		if(otmp == uarm) afternmv = Armor_on; */ 983. 		nomovemsg = "You finish your dressing maneuver."; 984. 	} else { 985. 		if(is_cloak(otmp)) (void) Cloak_on; 986. /*		if(is_shield(otmp)) (void) Shield_on; */ 987. 		on_msg(otmp); 988. 	}  989.  	return(1); 990. }  991.   992.  int 993. doputon { 994. 	register struct obj *otmp; 995. 	long mask = 0; 996.  997.  	if(uleft && uright && uamul && ublindf) { 998. #ifdef POLYSELF 999. 		Your("%s%s are full, and you're already wearing an amulet and a blindfold.",  1000. 			(humanoid(uasmon) || u.usym==S_CENTAUR) ? "ring-" : "",  1001. 			makeplural(body_part(FINGER))); 1002. #else 1003. 		Your("ring-fingers are full, and you're already wearing an amulet and a blindfold."); 1004. #endif 1005. 		return(0); 1006. 	} 1007. 	otmp = getobj(accessories, "wear"); 1008. 	if(!otmp) return(0); 1009. 	if(otmp->owornmask & (W_RING | W_AMUL | W_TOOL)) { 1010. 		You("are already wearing that!"); 1011. 		return(0); 1012. 	} 1013. 	if(welded(otmp)) { 1014. 		weldmsg(otmp, TRUE); 1015. 		return(0); 1016. 	} 1017. 	if(otmp == uwep) 1018. 		setuwep((struct obj *)0); 1019. 	if(otmp->olet == RING_SYM) { 1020. #ifdef POLYSELF 1021. 		if(nolimbs(uasmon)) { 1022. 			You("cannot make the ring stick to your body."); 1023. 			return(0); 1024. 		} 1025. #endif 1026. 		if(uleft && uright){ 1027. #ifdef POLYSELF 1028. 			pline("There are no more %s%s to fill.", 1029. 				(humanoid(uasmon) || u.usym==S_CENTAUR)  1030. 					? "ring-" : "",  1031. 				makeplural(body_part(FINGER))); 1032. #else 1033. 			pline("There are no more ring-fingers to fill."); 1034. #endif 1035. 			return(0); 1036. 		} 1037. 		if(uleft) mask = RIGHT_RING; 1038. 		else if(uright) mask = LEFT_RING; 1039. 		else do { 1040. 			char answer; 1041. 1042. #ifdef POLYSELF 1043. 			pline("What %s%s, Right or Left? ", 1044. 				(humanoid(uasmon) || u.usym==S_CENTAUR)  1045. 					? "ring-" : "",  1046. 				body_part(FINGER)); 1047. #else 1048. 			pline("What ring-finger, Right or Left? "); 1049. #endif 1050. 			if(index(quitchars, (answer = readchar))) 1051. 				return(0); 1052. 			switch(answer){ 1053. 			case 'l': 1054. 			case 'L': 1055. 				mask = LEFT_RING; 1056. 				break; 1057. 			case 'r': 1058. 			case 'R': 1059. 				mask = RIGHT_RING; 1060. 				break; 1061. 			} 1062. 		} while(!mask); 1063. 		if (uarmg && uarmg->cursed) { 1064. 			uarmg->bknown = 1; 1065. 		   You("cannot remove your gloves to put on the ring."); 1066. 			return(0); 1067. 		} 1068. 		if (welded(uwep) && bimanual(uwep)) { 1069. 			/* welded will set bknown */ 1070. 	   You("cannot free your weapon hands to put on the ring."); 1071. 			return(0); 1072. 		} 1073. 		if (welded(uwep) && mask==RIGHT_RING) { 1074. 			/* welded will set bknown */ 1075. 	   You("cannot free your weapon hand to put on the ring."); 1076. 			return(0); 1077. 		} 1078. 		setworn(otmp, mask); 1079. 		Ring_on(otmp); 1080. 	} else if (otmp->olet == AMULET_SYM) { 1081. 		if(uamul) { 1082. 			You("are already wearing an amulet."); 1083. 			return(0); 1084. 		} 1085. 		setworn(otmp, W_AMUL); 1086. 		if (otmp->otyp == AMULET_OF_CHANGE) { 1087. 			Amulet_on; 1088. 			/* Don't do a prinv since the amulet is now gone */ 1089. 			return(1); 1090. 		} 1091. 		Amulet_on; 1092. 	} else {	/* it's a blindfold */ 1093. 		if (ublindf) { 1094. 			You("are already wearing a blindfold."); 1095. 			return(0); 1096. 		} 1097. 		if (otmp->otyp != BLINDFOLD) { 1098. 			You("can't wear that!"); 1099. 			return(0); 1100. 		} 1101. 		Blindf_on(otmp); 1102. 		return(1); 1103. 	} 1104. 	prinv(otmp); 1105. 	return(1); 1106. } 1107.  1108. void 1109. find_ac { 1110. 	register int uac = 10; 1111. #ifdef POLYSELF 1112. 	if (u.mtimedone) uac = mons[u.umonnum].ac; 1113. #endif 1114. 	if(uarm) uac -= ARM_BONUS(uarm); 1115. 	if(uarmc) uac -= ARM_BONUS(uarmc); 1116. 	if(uarmh) uac -= ARM_BONUS(uarmh); 1117. 	if(uarmf) uac -= ARM_BONUS(uarmf); 1118. 	if(uarms) uac -= ARM_BONUS(uarms); 1119. 	if(uarmg) uac -= ARM_BONUS(uarmg); 1120. #ifdef SHIRT 1121. 	if(uarmu) uac -= ARM_BONUS(uarmu); 1122. #endif 1123. 	if(uleft && uleft->otyp == RIN_PROTECTION) uac -= uleft->spe; 1124. 	if(uright && uright->otyp == RIN_PROTECTION) uac -= uright->spe; 1125. #ifdef THEOLOGY 1126. 	if (Protection & INTRINSIC) uac -= u.ublessed; 1127. #endif 1128. 	if(uac != u.uac){ 1129. 		u.uac = uac; 1130. 		flags.botl = 1; 1131. 	} 1132. }  1133.  1134. void 1135. glibr{ 1136. register struct obj *otmp; 1137. int xfl = 0; 1138. 	if(!uarmg) if(uleft || uright) 1139. #ifdef POLYSELF 1140. 				if(!nolimbs(uasmon)) 1141. #endif 1142. 						{ 1143. 		/* Note: at present also cursed rings fall off */ 1144. 		/* changed 10/30/86 by GAN */ 1145. 		Your("%s off your %s.", 1146. #ifdef HARD  1147. 			((uleft && !uleft->cursed) && (uright && !uright->cursed)) ? "rings slip" : "ring slips",  1148. #else  1149. 			(uleft && uright) ? "rings slip" : "ring slips",  1150. #endif  1151. 			makeplural(body_part(FINGER))); 1152. 		xfl++; 1153. 		if((otmp = uleft) != (struct obj *)0){ 1154. 			Ring_off(uleft); 1155. 			dropx(otmp); 1156. 		} 1157. 		if((otmp = uright) != (struct obj *)0){ 1158. 			Ring_off(uright); 1159. 			dropx(otmp); 1160. 		} 1161. 	}  1162. 	if(((otmp = uwep) != (struct obj *)0)  1163. #ifdef HARD  1164. 	   && !otmp->cursed  1165. #endif  1166. 	) { 1167. 		/* Note: at present also cursed weapons fall */ 1168. 		/* changed 10/30/86 by GAN */ 1169. 		Your("%s %sslips from your %s.", 1170. 			is_sword(uwep) ? "sword" : "weapon",  1171. 			xfl ? "also " : "",  1172. 			makeplural(body_part(HAND))); 1173. 		setuwep((struct obj *)0); 1174. 		dropx(otmp); 1175. 	} 1176. }  1177.  1178. struct obj * 1179. some_armor{ 1180. register struct obj *otmph = (uarmc ? uarmc : uarm); 1181. 	if(uarmh && (!otmph || !rn2(4))) otmph = uarmh; 1182. 	if(uarmg && (!otmph || !rn2(4))) otmph = uarmg; 1183. 	if(uarmf && (!otmph || !rn2(4))) otmph = uarmf; 1184. 	if(uarms && (!otmph || !rn2(4))) otmph = uarms; 1185. #ifdef SHIRT 1186. 	if(!uarm && !uarmc && uarmu && (!otmph || !rn2(4))) otmph = uarmu; 1187. #endif 1188. 	return(otmph); 1189. } 1190.  1191. void 1192. corrode_armor{ 1193. register struct obj *otmph = some_armor; 1194. 1195. 	if (otmph && otmph != uarmf) { 1196. 	   if (otmph->rustfree || objects[otmph->otyp].oc_material != METAL ||  1197. 		otmph->otyp >= LEATHER_ARMOR) { 1198. 			Your("%s not affected!", 1199. 				aobjnam(otmph, "are")); 1200. 			return; 1201. 	   }  1202. 	    Your("%s!", aobjnam(otmph, "corrode")); 1203. 	   otmph->spe--; 1204. 	   adj_abon(otmph, -1); 1205. 	} 1206. }  1207.  1208. static int 1209. select_off(otmp) 1210. register struct obj *otmp; 1211. { 1212. 	if(!otmp) return(0); 1213. 	if(cursed(otmp)) return(0); 1214. #ifdef POLYSELF 1215. 	if(otmp->olet==RING_SYM && nolimbs(uasmon)) return(0); 1216. #endif 1217. 	if(welded(uwep) && (otmp==uarmg || otmp==uright || (otmp==uleft 1218. 			&& bimanual(uwep)))) 1219. 		return(0); 1220. 	if(uarmg && uarmg->cursed && (otmp==uright || otmp==uleft)) { 1221. 		uarmg->bknown = 1; 1222. 		return(0); 1223. 	} 1224. 	if((otmp==uarm 1225. #ifdef SHIRT 1226. 			|| otmp==uarmu 1227. #endif 1228. 					) && uarmc && uarmc->cursed) { 1229. 		uarmc->bknown = 1; 1230. 		return(0); 1231. 	} 1232. #ifdef SHIRT 1233. 	if(otmp==uarmu && uarm && uarm->cursed) { 1234. 		uarm->bknown = 1; 1235. 		return(0); 1236. 	} 1237. #endif 1238. 1239. 	if(otmp == uarm) takeoff_mask |= WORN_ARMOR; 1240. 	else if(otmp == uarmc) takeoff_mask |= WORN_CLOAK; 1241. 	else if(otmp == uarmf) takeoff_mask |= WORN_BOOTS; 1242. 	else if(otmp == uarmg) takeoff_mask |= WORN_GLOVES; 1243. 	else if(otmp == uarmh) takeoff_mask |= WORN_HELMET; 1244. 	else if(otmp == uarms) takeoff_mask |= WORN_SHIELD; 1245. #ifdef SHIRT 1246. 	else if(otmp == uarmu) takeoff_mask |= WORN_SHIRT; 1247. #endif 1248. 	else if(otmp == uleft) takeoff_mask |= LEFT_RING; 1249. 	else if(otmp == uright) takeoff_mask |= RIGHT_RING; 1250. 	else if(otmp == uamul) takeoff_mask |= WORN_AMUL; 1251. 	else if(otmp == ublindf) takeoff_mask |= WORN_BLINDF; 1252. 	else if(otmp == uwep) takeoff_mask |= 1L;	/* WIELDED_WEAPON */ 1253. 1254. 	else impossible("select_off: %s???", doname(otmp)); 1255. 1256. 	return(0); 1257. } 1258.  1259. static struct obj * 1260. do_takeoff { 1261. 1262. 	register struct obj *otmp = 0; 1263. 1264. 	if (taking_off == 1L) { /* weapon */ 1265. 	 if(!cursed(uwep)) { 1266. 	   setuwep((struct obj *) 0); 1267. 	   You("are empty %s.", body_part(HANDED)); 1268. 	 }  1269. 	} else if (taking_off ==  WORN_ARMOR) { 1270. 	 otmp = uarm; 1271. 	 if(!cursed(otmp)) (void) Armor_off; 1272. 	} else if (taking_off == WORN_CLOAK) { 1273. 	 otmp = uarmc; 1274. 	 if(!cursed(otmp)) (void) Cloak_off; 1275. 	} else if (taking_off == WORN_BOOTS) { 1276. 	 otmp = uarmf; 1277. 	 if(!cursed(otmp)) (void) Boots_off; 1278. 	} else if (taking_off == WORN_GLOVES) { 1279. 	 otmp = uarmg; 1280. 	 if(!cursed(otmp)) (void) Gloves_off; 1281. 	} else if (taking_off == WORN_HELMET) { 1282. 	 otmp = uarmh; 1283. 	 if(!cursed(otmp)) (void) Helmet_off; 1284. 	} else if (taking_off == WORN_SHIELD) { 1285. 	 otmp = uarms; 1286. 	 if(!cursed(otmp)) (void) Shield_off; 1287. #ifdef SHIRT 1288. 	} else if (taking_off == WORN_SHIRT) { 1289. 	 otmp = uarmu; 1290. 	 if(!cursed(otmp)) 1291. 	   setworn((struct obj *)0, uarmu->owornmask & W_ARMOR); 1292. #endif 1293. 	} else if (taking_off == WORN_AMUL) { 1294. 	 otmp = uamul; 1295. 	 if(!cursed(otmp)) Amulet_off; 1296. 	} else if (taking_off == LEFT_RING) { 1297. 	 otmp = uleft; 1298. 	 if(!cursed(otmp)) Ring_off(uleft); 1299. 	} else if (taking_off == RIGHT_RING) { 1300. 	 otmp = uright; 1301. 	 if(!cursed(otmp)) Ring_off(uright); 1302. 	} else if (taking_off == WORN_BLINDF) { 1303. 	 if(!cursed(ublindf)) { 1304. 	   setworn((struct obj *)0, ublindf->owornmask); 1305. 	   if(!Blinded) make_blinded(1L,FALSE); /* See on next move */ 1306. 	   else	 You("still cannot see."); 1307. 	 }  1308. 	} else impossible("do_takeoff: taking off %lx", taking_off); 1309. 1310. 	return(otmp); 1311. } 1312.  1313. static int 1314. take_off { 1315. 1316. 	register int i;  1317. register struct obj *otmp; 1318. 1319. 	if(taking_off) { 1320. 	   if(todelay > 0) { 1321. 1322. 		todelay--; 1323. 		return(1);	/* still busy */ 1324. 	   } else if((otmp = do_takeoff)) off_msg(otmp); 1325. 1326. 	    takeoff_mask &= ~taking_off; 1327. 	   taking_off = 0L; 1328. 	} 1329.  1330. 	for(i = 0; takeoff_order[i]; i++) 1331. 	   if(takeoff_mask & takeoff_order[i]) { 1332. 1333. 		taking_off = takeoff_order[i]; 1334. 		break; 1335. 	   }  1336.  1337. 	otmp = (struct obj *) 0; 1338. 1339. 	if (taking_off == 0L) { 1340. 	 You("finish disrobing."); 1341. 	 return 0; 1342. 	} else if (taking_off == 1L) { 1343. 	 todelay = 1; 1344. 	} else if (taking_off == WORN_ARMOR) { 1345. 	 otmp = uarm; 1346. 	} else if (taking_off == WORN_CLOAK) { 1347. 	 otmp = uarmc; 1348. 	} else if (taking_off == WORN_BOOTS) { 1349. 	 otmp = uarmf; 1350. 	} else if (taking_off == WORN_GLOVES) { 1351. 	 otmp = uarmg; 1352. 	} else if (taking_off == WORN_HELMET) { 1353. 	 otmp = uarmh; 1354. 	} else if (taking_off == WORN_SHIELD) { 1355. 	 otmp = uarms; 1356. #ifdef SHIRT 1357. 	} else if (taking_off == WORN_SHIRT) { 1358. 	 otmp = uarmu; 1359. #endif 1360. 	} else if (taking_off == WORN_AMUL) { 1361. 	 todelay = 1; 1362. 	} else if (taking_off == LEFT_RING) { 1363. 	 todelay = 1; 1364. 	} else if (taking_off == RIGHT_RING) { 1365. 	 todelay = 1; 1366. 	} else if (taking_off == WORN_BLINDF) { 1367. 	 todelay = 2; 1368. 	} else { 1369. 	 impossible("take_off: taking off %lx", taking_off); 1370. 	 return 0;	/* force done */ 1371. 	} 1372.  1373. 	if(otmp) todelay = objects[otmp->otyp].oc_delay; 1374. 	set_occupation(take_off, "disrobing", 0); 1375. 	return(1);		/* get busy */ 1376. } 1377.  1378. int 1379. doddoremarm { 1380. 1381. 	if(taking_off || takeoff_mask) { 1382. 1383. 	    You("continue disrobing."); 1384. 	   set_occupation(take_off, "disrobing", 0); 1385. 	   return(take_off); 1386. 	} 1387.  1388. 	(void) ggetobj("take off", select_off, 0); 1389. 	if(takeoff_mask) return(take_off); 1390. 	else		 return(0); 1391. } 1392.  1393. void 1394. adj_abon(otmp, delta) 1395. register struct obj *otmp; 1396. register schar delta; 1397. { 1398. 	if (uarmg && otmp->otyp == GAUNTLETS_OF_DEXTERITY) { 1399. 		ABON(A_DEX) += (delta); 1400. 		flags.botl = 1; 1401. 	} 1402. 	if (uarmh && otmp->otyp == HELM_OF_BRILLIANCE) { 1403. 		ABON(A_INT) += (delta); 1404. 		ABON(A_WIS) += (delta); 1405. 		flags.botl = 1; 1406. 	} 1407. }