1 /* $NetBSD: hack.do_wear.c,v 1.4 1997/10/19 16:57:48 christos Exp $ */
4 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
9 __RCSID("$NetBSD: hack.do_wear.c,v 1.4 1997/10/19 16:57:48 christos Exp $");
19 pline("You were wearing %s.", doname(otmp
));
26 if (!uarm
&& !uarmh
&& !uarms
&& !uarmg
) {
27 pline("Not wearing any armor.");
30 otmp
= (!uarmh
&& !uarms
&& !uarmg
) ? uarm
:
31 (!uarms
&& !uarm
&& !uarmg
) ? uarmh
:
32 (!uarmh
&& !uarm
&& !uarmg
) ? uarms
:
33 (!uarmh
&& !uarm
&& !uarms
) ? uarmg
:
34 getobj("[", "take off");
37 if (!(otmp
->owornmask
& (W_ARMOR
- W_ARM2
))) {
38 pline("You can't take that off.");
41 if (otmp
== uarmg
&& uwep
&& uwep
->cursed
) { /* myers@uwmacc */
42 pline("You seem not able to take off the gloves while holding your weapon.");
45 (void) armoroff(otmp
);
52 if (!uleft
&& !uright
) {
53 pline("Not wearing any ring.");
57 return (dorr(uright
));
64 pline("What ring, Right or Left? [ rl?]");
65 if (strchr(quitchars
, (answer
= readchar())))
73 return (dorr(uright
));
76 /* might look at morc here %% */
99 pline("You can't. It appears to be cursed.");
109 int delay
= -objects
[otmp
->otyp
].oc_delay
;
112 setworn((struct obj
*) 0, otmp
->owornmask
& W_ARMOR
);
115 switch (otmp
->otyp
) {
117 nomovemsg
= "You finished taking off your helmet.";
120 nomovemsg
= "You finished taking off your gloves";
123 nomovemsg
= "You finished taking off your suit.";
139 otmp
= getobj("[", "wear");
142 if (otmp
->owornmask
& W_ARMOR
) {
143 pline("You are already wearing that!");
146 if (otmp
->otyp
== HELMET
) {
148 pline("You are already wearing a helmet.");
152 } else if (otmp
->otyp
== SHIELD
) {
154 pline("You are already wearing a shield."), err
++;
155 if (uwep
&& uwep
->otyp
== TWO_HANDED_SWORD
)
156 pline("You cannot wear a shield and wield a two-handed sword."), err
++;
159 } else if (otmp
->otyp
== PAIR_OF_GLOVES
) {
161 pline("You are already wearing gloves.");
163 } else if (uwep
&& uwep
->cursed
) {
164 pline("You cannot wear gloves over your weapon.");
170 if (otmp
->otyp
!= ELVEN_CLOAK
|| uarm2
) {
171 pline("You are already wearing some armor.");
178 if (otmp
== uwep
&& uwep
->cursed
) {
180 pline("%s is welded to your hand.", Doname(uwep
));
186 setuwep((struct obj
*) 0);
187 delay
= -objects
[otmp
->otyp
].oc_delay
;
190 nomovemsg
= "You finished your dressing manoeuvre.";
203 if (uleft
&& uright
) {
204 pline("There are no more ring-fingers to fill.");
207 otmp
= getobj("=", "wear");
210 if (otmp
->owornmask
& W_RING
) {
211 pline("You are already wearing that!");
214 if (otmp
== uleft
|| otmp
== uright
) {
215 pline("You are already wearing that.");
218 if (otmp
== uwep
&& uwep
->cursed
) {
219 pline("%s is welded to your hand.", Doname(uwep
));
230 pline("What ring-finger, Right or Left? ");
231 if (strchr(quitchars
, (answer
= readchar())))
246 setuwep((struct obj
*) 0);
247 oldprop
= u
.uprops
[PROP(otmp
->otyp
)].p_flgs
;
248 u
.uprops
[PROP(otmp
->otyp
)].p_flgs
|= mask
;
249 switch (otmp
->otyp
) {
254 case RIN_PROTECTION_FROM_SHAPE_CHANGERS
:
257 case RIN_GAIN_STRENGTH
:
259 u
.ustrmax
+= otmp
->spe
;
266 case RIN_INCREASE_DAMAGE
:
267 u
.udaminc
+= otmp
->spe
;
279 mask
= obj
->owornmask
& W_RING
;
280 setworn((struct obj
*) 0, obj
->owornmask
);
281 if (!(u
.uprops
[PROP(obj
->otyp
)].p_flgs
& mask
))
282 impossible("Strange... I didnt know you had that ring.");
283 u
.uprops
[PROP(obj
->otyp
)].p_flgs
&= ~mask
;
285 case RIN_FIRE_RESISTANCE
:
286 /* Bad luck if the player is in hell... --jgm */
287 if (!Fire_resistance
&& dlevel
>= 30) {
288 pline("The flames of Hell burn you to a crisp.");
289 killer
= "stupidity in hell";
294 if (!Levitation
) { /* no longer floating */
298 case RIN_GAIN_STRENGTH
:
300 u
.ustrmax
-= obj
->spe
;
307 case RIN_INCREASE_DAMAGE
:
308 u
.udaminc
-= obj
->spe
;
318 uac
-= ARM_BONUS(uarm
);
320 uac
-= ARM_BONUS(uarm2
);
322 uac
-= ARM_BONUS(uarmh
);
324 uac
-= ARM_BONUS(uarms
);
326 uac
-= ARM_BONUS(uarmg
);
327 if (uleft
&& uleft
->otyp
== RIN_PROTECTION
)
329 if (uright
&& uright
->otyp
== RIN_PROTECTION
)
343 if (uleft
|| uright
) {
344 /* Note: at present also cursed rings fall off */
345 pline("Your %s off your fingers.",
346 (uleft
&& uright
) ? "rings slip" : "ring slips");
348 if ((otmp
= uleft
) != Null(obj
)) {
352 if ((otmp
= uright
) != Null(obj
)) {
357 if ((otmp
= uwep
) != Null(obj
)) {
358 /* Note: at present also cursed weapons fall */
359 setuwep((struct obj
*) 0);
361 pline("Your weapon %sslips from your hands.",
369 struct obj
*otmph
= uarm
;
370 if (uarmh
&& (!otmph
|| !rn2(4)))
372 if (uarmg
&& (!otmph
|| !rn2(4)))
374 if (uarms
&& (!otmph
|| !rn2(4)))
382 struct obj
*otmph
= some_armor();
384 if (otmph
->rustfree
||
385 otmph
->otyp
== ELVEN_CLOAK
||
386 otmph
->otyp
== LEATHER_ARMOR
||
387 otmph
->otyp
== STUDDED_LEATHER_ARMOR
) {
388 pline("Your %s not affected!",
389 aobjnam(otmph
, "are"));
392 pline("Your %s!", aobjnam(otmph
, "corrode"));