2 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
6 static char rcsid
[] = "$Id: hack.do_wear.c,v 1.2 1993/08/02 17:17:06 mycroft Exp $";
11 extern char *nomovemsg
;
12 extern char quitchars
[];
13 extern char *Doname();
15 off_msg(otmp
) register struct obj
*otmp
; {
16 pline("You were wearing %s.", doname(otmp
));
20 register struct obj
*otmp
;
21 if(!uarm
&& !uarmh
&& !uarms
&& !uarmg
) {
22 pline("Not wearing any armor.");
25 otmp
= (!uarmh
&& !uarms
&& !uarmg
) ? uarm
:
26 (!uarms
&& !uarm
&& !uarmg
) ? uarmh
:
27 (!uarmh
&& !uarm
&& !uarmg
) ? uarms
:
28 (!uarmh
&& !uarm
&& !uarms
) ? uarmg
:
29 getobj("[", "take off");
31 if(!(otmp
->owornmask
& (W_ARMOR
- W_ARM2
))) {
32 pline("You can't take that off.");
35 if( otmp
== uarmg
&& uwep
&& uwep
->cursed
) { /* myers@uwmacc */
36 pline("You seem not able to take off the gloves while holding your weapon.");
39 (void) armoroff(otmp
);
44 if(!uleft
&& !uright
){
45 pline("Not wearing any ring.");
52 if(uleft
&& uright
) while(1) {
55 pline("What ring, Right or Left? [ rl?]");
56 if(index(quitchars
, (answer
= readchar())))
67 /* might look at morc here %% */
76 dorr(otmp
) register struct obj
*otmp
; {
77 if(cursed(otmp
)) return(0);
83 cursed(otmp
) register struct obj
*otmp
; {
85 pline("You can't. It appears to be cursed.");
91 armoroff(otmp
) register struct obj
*otmp
; {
92 register int delay
= -objects
[otmp
->otyp
].oc_delay
;
93 if(cursed(otmp
)) return(0);
94 setworn((struct obj
*) 0, otmp
->owornmask
& W_ARMOR
);
99 nomovemsg
= "You finished taking off your helmet.";
102 nomovemsg
= "You finished taking off your gloves";
105 nomovemsg
= "You finished taking off your suit.";
114 register struct obj
*otmp
;
116 register int err
= 0;
119 otmp
= getobj("[", "wear");
121 if(otmp
->owornmask
& W_ARMOR
) {
122 pline("You are already wearing that!");
125 if(otmp
->otyp
== HELMET
){
127 pline("You are already wearing a helmet.");
131 } else if(otmp
->otyp
== SHIELD
){
132 if(uarms
) pline("You are already wearing a shield."), err
++;
133 if(uwep
&& uwep
->otyp
== TWO_HANDED_SWORD
)
134 pline("You cannot wear a shield and wield a two-handed sword."), err
++;
135 if(!err
) mask
= W_ARMS
;
136 } else if(otmp
->otyp
== PAIR_OF_GLOVES
) {
138 pline("You are already wearing gloves.");
141 if(uwep
&& uwep
->cursed
) {
142 pline("You cannot wear gloves over your weapon.");
148 if(otmp
->otyp
!= ELVEN_CLOAK
|| uarm2
) {
149 pline("You are already wearing some armor.");
153 if(!err
) mask
= W_ARM
;
155 if(otmp
== uwep
&& uwep
->cursed
) {
157 pline("%s is welded to your hand.", Doname(uwep
));
162 setuwep((struct obj
*) 0);
163 delay
= -objects
[otmp
->otyp
].oc_delay
;
166 nomovemsg
= "You finished your dressing manoeuvre.";
173 register struct obj
*otmp
;
178 pline("There are no more ring-fingers to fill.");
181 otmp
= getobj("=", "wear");
183 if(otmp
->owornmask
& W_RING
) {
184 pline("You are already wearing that!");
187 if(otmp
== uleft
|| otmp
== uright
) {
188 pline("You are already wearing that.");
191 if(otmp
== uwep
&& uwep
->cursed
) {
192 pline("%s is welded to your hand.", Doname(uwep
));
195 if(uleft
) mask
= RIGHT_RING
;
196 else if(uright
) mask
= LEFT_RING
;
200 pline("What ring-finger, Right or Left? ");
201 if(index(quitchars
, (answer
= readchar())))
216 setuwep((struct obj
*) 0);
217 oldprop
= u
.uprops
[PROP(otmp
->otyp
)].p_flgs
;
218 u
.uprops
[PROP(otmp
->otyp
)].p_flgs
|= mask
;
221 if(!oldprop
) float_up();
223 case RIN_PROTECTION_FROM_SHAPE_CHANGERS
:
226 case RIN_GAIN_STRENGTH
:
228 u
.ustrmax
+= otmp
->spe
;
229 if(u
.ustr
> 118) u
.ustr
= 118;
230 if(u
.ustrmax
> 118) u
.ustrmax
= 118;
233 case RIN_INCREASE_DAMAGE
:
234 u
.udaminc
+= otmp
->spe
;
242 register struct obj
*obj
;
245 mask
= obj
->owornmask
& W_RING
;
246 setworn((struct obj
*) 0, obj
->owornmask
);
247 if(!(u
.uprops
[PROP(obj
->otyp
)].p_flgs
& mask
))
248 impossible("Strange... I didnt know you had that ring.");
249 u
.uprops
[PROP(obj
->otyp
)].p_flgs
&= ~mask
;
251 case RIN_FIRE_RESISTANCE
:
252 /* Bad luck if the player is in hell... --jgm */
253 if (!Fire_resistance
&& dlevel
>= 30) {
254 pline("The flames of Hell burn you to a crisp.");
255 killer
= "stupidity in hell";
260 if(!Levitation
) { /* no longer floating */
264 case RIN_GAIN_STRENGTH
:
266 u
.ustrmax
-= obj
->spe
;
267 if(u
.ustr
> 118) u
.ustr
= 118;
268 if(u
.ustrmax
> 118) u
.ustrmax
= 118;
271 case RIN_INCREASE_DAMAGE
:
272 u
.udaminc
-= obj
->spe
;
278 register int uac
= 10;
279 if(uarm
) uac
-= ARM_BONUS(uarm
);
280 if(uarm2
) uac
-= ARM_BONUS(uarm2
);
281 if(uarmh
) uac
-= ARM_BONUS(uarmh
);
282 if(uarms
) uac
-= ARM_BONUS(uarms
);
283 if(uarmg
) uac
-= ARM_BONUS(uarmg
);
284 if(uleft
&& uleft
->otyp
== RIN_PROTECTION
) uac
-= uleft
->spe
;
285 if(uright
&& uright
->otyp
== RIN_PROTECTION
) uac
-= uright
->spe
;
293 register struct obj
*otmp
;
295 if(!uarmg
) if(uleft
|| uright
) {
296 /* Note: at present also cursed rings fall off */
297 pline("Your %s off your fingers.",
298 (uleft
&& uright
) ? "rings slip" : "ring slips");
300 if((otmp
= uleft
) != Null(obj
)){
304 if((otmp
= uright
) != Null(obj
)){
309 if((otmp
= uwep
) != Null(obj
)){
310 /* Note: at present also cursed weapons fall */
311 setuwep((struct obj
*) 0);
313 pline("Your weapon %sslips from your hands.",
320 register struct obj
*otmph
= uarm
;
321 if(uarmh
&& (!otmph
|| !rn2(4))) otmph
= uarmh
;
322 if(uarmg
&& (!otmph
|| !rn2(4))) otmph
= uarmg
;
323 if(uarms
&& (!otmph
|| !rn2(4))) otmph
= uarms
;
328 register struct obj
*otmph
= some_armor();
330 if(otmph
->rustfree
||
331 otmph
->otyp
== ELVEN_CLOAK
||
332 otmph
->otyp
== LEATHER_ARMOR
||
333 otmph
->otyp
== STUDDED_LEATHER_ARMOR
) {
334 pline("Your %s not affected!",
335 aobjnam(otmph
, "are"));
338 pline("Your %s!", aobjnam(otmph
, "corrode"));