1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.do_wear.c - version 1.0.3 */
3 /* $FreeBSD: src/games/hack/hack.do_wear.c,v 1.3 1999/11/16 02:57:03 billf Exp $ */
4 /* $DragonFly: src/games/hack/hack.do_wear.c,v 1.4 2005/05/22 03:37:05 y0netan1 Exp $ */
8 extern char quitchars[];
11 off_msg(otmp) struct obj *otmp; {
12 pline("You were wearing %s.", doname(otmp));
17 if(!uarm && !uarmh && !uarms && !uarmg) {
18 pline("Not wearing any armor.");
21 otmp = (!uarmh && !uarms && !uarmg) ? uarm :
22 (!uarms && !uarm && !uarmg) ? uarmh :
23 (!uarmh && !uarm && !uarmg) ? uarms :
24 (!uarmh && !uarm && !uarms) ? uarmg :
25 getobj("[", "take off");
27 if(!(otmp->owornmask & (W_ARMOR - W_ARM2))) {
28 pline("You can't take that off.");
31 if( otmp == uarmg && uwep && uwep->cursed ) { /* myers@uwmacc */
32 pline("You seem not able to take off the gloves while holding your weapon.");
35 (void) armoroff(otmp);
40 if(!uleft && !uright){
41 pline("Not wearing any ring.");
48 if(uleft && uright) while(1) {
51 pline("What ring, Right or Left? [ rl?]");
52 if(index(quitchars, (answer = readchar())))
63 /* might look at morc here %% */
72 dorr(otmp) struct obj *otmp; {
73 if(cursed(otmp)) return(0);
79 cursed(otmp) struct obj *otmp; {
81 pline("You can't. It appears to be cursed.");
87 armoroff(otmp) struct obj *otmp; {
88 int delay = -objects[otmp->otyp].oc_delay;
89 if(cursed(otmp)) return(0);
90 setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
95 nomovemsg = "You finished taking off your helmet.";
98 nomovemsg = "You finished taking off your gloves";
101 nomovemsg = "You finished taking off your suit.";
115 otmp = getobj("[", "wear");
117 if(otmp->owornmask & W_ARMOR) {
118 pline("You are already wearing that!");
121 if(otmp->otyp == HELMET){
123 pline("You are already wearing a helmet.");
127 } else if(otmp->otyp == SHIELD){
128 if(uarms) pline("You are already wearing a shield."), err++;
129 if(uwep && uwep->otyp == TWO_HANDED_SWORD)
130 pline("You cannot wear a shield and wield a two-handed sword."), err++;
131 if(!err) mask = W_ARMS;
132 } else if(otmp->otyp == PAIR_OF_GLOVES) {
134 pline("You are already wearing gloves.");
137 if(uwep && uwep->cursed) {
138 pline("You cannot wear gloves over your weapon.");
144 if(otmp->otyp != ELVEN_CLOAK || uarm2) {
145 pline("You are already wearing some armor.");
149 if(!err) mask = W_ARM;
151 if(otmp == uwep && uwep->cursed) {
153 pline("%s is welded to your hand.", Doname(uwep));
158 setuwep((struct obj *) 0);
159 delay = -objects[otmp->otyp].oc_delay;
162 nomovemsg = "You finished your dressing manoeuvre.";
174 pline("There are no more ring-fingers to fill.");
177 otmp = getobj("=", "wear");
179 if(otmp->owornmask & W_RING) {
180 pline("You are already wearing that!");
183 if(otmp == uleft || otmp == uright) {
184 pline("You are already wearing that.");
187 if(otmp == uwep && uwep->cursed) {
188 pline("%s is welded to your hand.", Doname(uwep));
191 if(uleft) mask = RIGHT_RING;
192 else if(uright) mask = LEFT_RING;
196 pline("What ring-finger, Right or Left? ");
197 if(index(quitchars, (answer = readchar())))
212 setuwep((struct obj *) 0);
213 oldprop = u.uprops[PROP(otmp->otyp)].p_flgs;
214 u.uprops[PROP(otmp->otyp)].p_flgs |= mask;
217 if(!oldprop) float_up();
219 case RIN_PROTECTION_FROM_SHAPE_CHANGERS:
222 case RIN_GAIN_STRENGTH:
224 u.ustrmax += otmp->spe;
225 if(u.ustr > 118) u.ustr = 118;
226 if(u.ustrmax > 118) u.ustrmax = 118;
229 case RIN_INCREASE_DAMAGE:
230 u.udaminc += otmp->spe;
241 mask = obj->owornmask & W_RING;
242 setworn((struct obj *) 0, obj->owornmask);
243 if(!(u.uprops[PROP(obj->otyp)].p_flgs & mask))
244 impossible("Strange... I didnt know you had that ring.");
245 u.uprops[PROP(obj->otyp)].p_flgs &= ~mask;
247 case RIN_FIRE_RESISTANCE:
248 /* Bad luck if the player is in hell... --jgm */
249 if (!Fire_resistance && dlevel >= 30) {
250 pline("The flames of Hell burn you to a crisp.");
251 killer = "stupidity in hell";
256 if(!Levitation) { /* no longer floating */
260 case RIN_GAIN_STRENGTH:
262 u.ustrmax -= obj->spe;
263 if(u.ustr > 118) u.ustr = 118;
264 if(u.ustrmax > 118) u.ustrmax = 118;
267 case RIN_INCREASE_DAMAGE:
268 u.udaminc -= obj->spe;
275 if(uarm) uac -= ARM_BONUS(uarm);
276 if(uarm2) uac -= ARM_BONUS(uarm2);
277 if(uarmh) uac -= ARM_BONUS(uarmh);
278 if(uarms) uac -= ARM_BONUS(uarms);
279 if(uarmg) uac -= ARM_BONUS(uarmg);
280 if(uleft && uleft->otyp == RIN_PROTECTION) uac -= uleft->spe;
281 if(uright && uright->otyp == RIN_PROTECTION) uac -= uright->spe;
291 if(!uarmg) if(uleft || uright) {
292 /* Note: at present also cursed rings fall off */
293 pline("Your %s off your fingers.",
294 (uleft && uright) ? "rings slip" : "ring slips");
296 if((otmp = uleft) != Null(obj)){
300 if((otmp = uright) != Null(obj)){
305 if((otmp = uwep) != Null(obj)){
306 /* Note: at present also cursed weapons fall */
307 setuwep((struct obj *) 0);
309 pline("Your weapon %sslips from your hands.",
316 struct obj *otmph = uarm;
317 if(uarmh && (!otmph || !rn2(4))) otmph = uarmh;
318 if(uarmg && (!otmph || !rn2(4))) otmph = uarmg;
319 if(uarms && (!otmph || !rn2(4))) otmph = uarms;
324 struct obj *otmph = some_armor();
326 if(otmph->rustfree ||
327 otmph->otyp == ELVEN_CLOAK ||
328 otmph->otyp == LEATHER_ARMOR ||
329 otmph->otyp == STUDDED_LEATHER_ARMOR) {
330 pline("Your %s not affected!",
331 aobjnam(otmph, "are"));
334 pline("Your %s!", aobjnam(otmph, "corrode"));