home *** CD-ROM | disk | FTP | other *** search
- /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
- /* do_wear.c - version 1.0.3 */
-
- #include <stdio.h>
- #include "hack.h"
- extern char *nomovemsg;
- extern char quitchars[];
-
- off_msg(otmp) register struct obj *otmp; {
- pline("You were wearing %s.", doname(otmp));
- }
-
- doremarm() {
- register struct obj *otmp;
- if(!uarm && !uarmh && !uarms && !uarmg) {
- pline("Not wearing any armor.");
- return(0);
- }
- otmp = (!uarmh && !uarms && !uarmg) ? uarm :
- (!uarms && !uarm && !uarmg) ? uarmh :
- (!uarmh && !uarm && !uarmg) ? uarms :
- (!uarmh && !uarm && !uarms) ? uarmg :
- getobj("[", "take off");
- if(!otmp) return(0);
- if(!(otmp->owornmask & (W_ARMOR - W_ARM2))) {
- pline("You can't take that off.");
- return(0);
- }
- if( otmp == uarmg && uwep && uwep->cursed ) { /* myers@uwmacc */
- pline("You seem not able to take off the gloves while holding your weapon.");
- return(0);
- }
- (void) armoroff(otmp);
- return(1);
- }
-
- doremring() {
- if(!uleft && !uright){
- pline("Not wearing any ring.");
- return(0);
- }
- if(!uleft)
- return(dorr(uright));
- if(!uright)
- return(dorr(uleft));
- if(uleft && uright) while(1) {
- char answer;
-
- pline("What ring, Right or Left? [ rl?]");
- if(index(quitchars, (answer = readchar())))
- return(0);
- switch(answer) {
- case 'l':
- case 'L':
- return(dorr(uleft));
- case 'r':
- case 'R':
- return(dorr(uright));
- case '?':
- (void) doprring();
- /* might look at morc here %% */
- }
- }
- /* NOTREACHED */
- #ifdef lint
- return(0);
- #endif lint
- }
-
- dorr(otmp) register struct obj *otmp; {
- if(cursed(otmp)) return(0);
- ringoff(otmp);
- off_msg(otmp);
- return(1);
- }
-
- cursed(otmp) register struct obj *otmp; {
- if(otmp->cursed){
- pline("You can't. It appears to be cursed.");
- return(1);
- }
- return(0);
- }
-
- armoroff(otmp) register struct obj *otmp; {
- register int delay = -objects[otmp->otyp].oc_delay;
- if(cursed(otmp)) return(0);
- setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
- if(delay) {
- nomul(delay);
- switch(otmp->otyp) {
- case HELMET:
- nomovemsg = "You finished taking off your helmet.";
- break;
- case PAIR_OF_GLOVES:
- nomovemsg = "You finished taking off your gloves";
- break;
- default:
- nomovemsg = "You finished taking off your suit.";
- }
- } else {
- off_msg(otmp);
- }
- return(1);
- }
-