1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.do_wear.c - version 1.0.3 */
6 extern char *nomovemsg;
7 extern char quitchars[];
10 off_msg(otmp) register struct obj *otmp; {
11 pline("You were wearing %s.", doname(otmp));
15 register struct obj *otmp;
16 if(!uarm && !uarmh && !uarms && !uarmg) {
17 pline("Not wearing any armor.");
20 otmp = (!uarmh && !uarms && !uarmg) ? uarm :
21 (!uarms && !uarm && !uarmg) ? uarmh :
22 (!uarmh && !uarm && !uarmg) ? uarms :
23 (!uarmh && !uarm && !uarms) ? uarmg :
24 getobj("[", "take off");
26 if(!(otmp->owornmask & (W_ARMOR - W_ARM2))) {
27 pline("You can't take that off.");
30 if( otmp == uarmg && uwep && uwep->cursed ) { /* myers@uwmacc */
31 pline("You seem not able to take off the gloves while holding your weapon.");
34 (void) armoroff(otmp);
39 if(!uleft && !uright){
40 pline("Not wearing any ring.");
47 if(uleft && uright) while(1) {
50 pline("What ring, Right or Left? [ rl?]");
51 if(index(quitchars, (answer = readchar())))
62 /* might look at morc here %% */
71 dorr(otmp) register struct obj *otmp; {
72 if(cursed(otmp)) return(0);
78 cursed(otmp) register struct obj *otmp; {
80 pline("You can't. It appears to be cursed.");
86 armoroff(otmp) register struct obj *otmp; {
87 register int delay = -objects[otmp->otyp].oc_delay;
88 if(cursed(otmp)) return(0);
89 setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
94 nomovemsg = "You finished taking off your helmet.";
97 nomovemsg = "You finished taking off your gloves";
100 nomovemsg = "You finished taking off your suit.";
109 register struct obj *otmp;
111 register int err = 0;
114 otmp = getobj("[", "wear");
116 if(otmp->owornmask & W_ARMOR) {
117 pline("You are already wearing that!");
120 if(otmp->otyp == HELMET){
122 pline("You are already wearing a helmet.");
126 } else if(otmp->otyp == SHIELD){
127 if(uarms) pline("You are already wearing a shield."), err++;
128 if(uwep && uwep->otyp == TWO_HANDED_SWORD)
129 pline("You cannot wear a shield and wield a two-handed sword."), err++;
130 if(!err) mask = W_ARMS;
131 } else if(otmp->otyp == PAIR_OF_GLOVES) {
133 pline("You are already wearing gloves.");
136 if(uwep && uwep->cursed) {
137 pline("You cannot wear gloves over your weapon.");
143 if(otmp->otyp != ELVEN_CLOAK || uarm2) {
144 pline("You are already wearing some armor.");
148 if(!err) mask = W_ARM;
150 if(otmp == uwep && uwep->cursed) {
152 pline("%s is welded to your hand.", Doname(uwep));
157 setuwep((struct obj *) 0);
158 delay = -objects[otmp->otyp].oc_delay;
161 nomovemsg = "You finished your dressing manoeuvre.";
168 register struct obj *otmp;
173 pline("There are no more ring-fingers to fill.");
176 otmp = getobj("=", "wear");
178 if(otmp->owornmask & W_RING) {
179 pline("You are already wearing that!");
182 if(otmp == uleft || otmp == uright) {
183 pline("You are already wearing that.");
186 if(otmp == uwep && uwep->cursed) {
187 pline("%s is welded to your hand.", Doname(uwep));
190 if(uleft) mask = RIGHT_RING;
191 else if(uright) mask = LEFT_RING;
195 pline("What ring-finger, Right or Left? ");
196 if(index(quitchars, (answer = readchar())))
211 setuwep((struct obj *) 0);
212 oldprop = u.uprops[PROP(otmp->otyp)].p_flgs;
213 u.uprops[PROP(otmp->otyp)].p_flgs |= mask;
216 if(!oldprop) float_up();
218 case RIN_PROTECTION_FROM_SHAPE_CHANGERS:
221 case RIN_GAIN_STRENGTH:
223 u.ustrmax += otmp->spe;
224 if(u.ustr > 118) u.ustr = 118;
225 if(u.ustrmax > 118) u.ustrmax = 118;
228 case RIN_INCREASE_DAMAGE:
229 u.udaminc += otmp->spe;
237 register struct obj *obj;
240 mask = obj->owornmask & W_RING;
241 setworn((struct obj *) 0, obj->owornmask);
242 if(!(u.uprops[PROP(obj->otyp)].p_flgs & mask))
243 impossible("Strange... I didnt know you had that ring.");
244 u.uprops[PROP(obj->otyp)].p_flgs &= ~mask;
246 case RIN_FIRE_RESISTANCE:
247 /* Bad luck if the player is in hell... --jgm */
248 if (!Fire_resistance && dlevel >= 30) {
249 pline("The flames of Hell burn you to a crisp.");
250 killer = "stupidity in hell";
255 if(!Levitation) { /* no longer floating */
259 case RIN_GAIN_STRENGTH:
261 u.ustrmax -= obj->spe;
262 if(u.ustr > 118) u.ustr = 118;
263 if(u.ustrmax > 118) u.ustrmax = 118;
266 case RIN_INCREASE_DAMAGE:
267 u.udaminc -= obj->spe;
273 register int uac = 10;
274 if(uarm) uac -= ARM_BONUS(uarm);
275 if(uarm2) uac -= ARM_BONUS(uarm2);
276 if(uarmh) uac -= ARM_BONUS(uarmh);
277 if(uarms) uac -= ARM_BONUS(uarms);
278 if(uarmg) uac -= ARM_BONUS(uarmg);
279 if(uleft && uleft->otyp == RIN_PROTECTION) uac -= uleft->spe;
280 if(uright && uright->otyp == RIN_PROTECTION) uac -= uright->spe;
288 register struct obj *otmp;
290 if(!uarmg) if(uleft || uright) {
291 /* Note: at present also cursed rings fall off */
292 pline("Your %s off your fingers.",
293 (uleft && uright) ? "rings slip" : "ring slips");
295 if((otmp = uleft) != Null(obj)){
299 if((otmp = uright) != Null(obj)){
304 if((otmp = uwep) != Null(obj)){
305 /* Note: at present also cursed weapons fall */
306 setuwep((struct obj *) 0);
308 pline("Your weapon %sslips from your hands.",
315 register struct obj *otmph = uarm;
316 if(uarmh && (!otmph || !rn2(4))) otmph = uarmh;
317 if(uarmg && (!otmph || !rn2(4))) otmph = uarmg;
318 if(uarms && (!otmph || !rn2(4))) otmph = uarms;
323 register struct obj *otmph = some_armor();
325 if(otmph->rustfree ||
326 otmph->otyp == ELVEN_CLOAK ||
327 otmph->otyp == LEATHER_ARMOR ||
328 otmph->otyp == STUDDED_LEATHER_ARMOR) {
329 pline("Your %s not affected!",
330 aobjnam(otmph, "are"));
333 pline("Your %s!", aobjnam(otmph, "corrode"));