2009-08-12 11:28:40 +04:00
|
|
|
/* $NetBSD: hack.do_wear.c,v 1.7 2009/08/12 07:28:40 dholland Exp $ */
|
1997-10-19 20:56:41 +04:00
|
|
|
|
1993-08-02 21:16:36 +04:00
|
|
|
/*
|
2003-04-02 22:36:33 +04:00
|
|
|
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
|
|
|
|
* Amsterdam
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met:
|
|
|
|
*
|
|
|
|
* - Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* - Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* - Neither the name of the Stichting Centrum voor Wiskunde en
|
|
|
|
* Informatica, nor the names of its contributors may be used to endorse or
|
|
|
|
* promote products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
|
|
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
|
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
|
|
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
|
|
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1993-08-02 21:16:36 +04:00
|
|
|
*/
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
#include <sys/cdefs.h>
|
1993-08-02 21:16:36 +04:00
|
|
|
#ifndef lint
|
2009-08-12 11:28:40 +04:00
|
|
|
__RCSID("$NetBSD: hack.do_wear.c,v 1.7 2009/08/12 07:28:40 dholland Exp $");
|
1997-10-19 20:56:41 +04:00
|
|
|
#endif /* not lint */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
#include "hack.h"
|
1997-10-19 20:56:41 +04:00
|
|
|
#include "extern.h"
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2009-08-12 11:28:40 +04:00
|
|
|
static int dorr(struct obj *);
|
|
|
|
static int cursed(struct obj *);
|
|
|
|
|
|
|
|
static void
|
2009-06-07 22:30:39 +04:00
|
|
|
off_msg(struct obj *otmp)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You were wearing %s.", doname(otmp));
|
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
int
|
2009-06-07 22:30:39 +04:00
|
|
|
doremarm(void)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
struct obj *otmp;
|
|
|
|
if (!uarm && !uarmh && !uarms && !uarmg) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("Not wearing any armor.");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
otmp = (!uarmh && !uarms && !uarmg) ? uarm :
|
|
|
|
(!uarms && !uarm && !uarmg) ? uarmh :
|
|
|
|
(!uarmh && !uarm && !uarmg) ? uarms :
|
|
|
|
(!uarmh && !uarm && !uarms) ? uarmg :
|
|
|
|
getobj("[", "take off");
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!otmp)
|
|
|
|
return (0);
|
|
|
|
if (!(otmp->owornmask & (W_ARMOR - W_ARM2))) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You can't take that off.");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (otmp == uarmg && uwep && uwep->cursed) { /* myers@uwmacc */
|
|
|
|
pline("You seem not able to take off the gloves while holding your weapon.");
|
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
(void) armoroff(otmp);
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
int
|
2009-06-07 22:30:39 +04:00
|
|
|
doremring(void)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
if (!uleft && !uright) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("Not wearing any ring.");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!uleft)
|
|
|
|
return (dorr(uright));
|
|
|
|
if (!uright)
|
|
|
|
return (dorr(uleft));
|
|
|
|
if (uleft && uright)
|
|
|
|
while (1) {
|
|
|
|
char answer;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
pline("What ring, Right or Left? [ rl?]");
|
|
|
|
if (strchr(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 %% */
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
/* NOTREACHED */
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:28:40 +04:00
|
|
|
static int
|
2009-06-07 22:30:39 +04:00
|
|
|
dorr(struct obj *otmp)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
if (cursed(otmp))
|
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
ringoff(otmp);
|
|
|
|
off_msg(otmp);
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:28:40 +04:00
|
|
|
static int
|
2009-06-07 22:30:39 +04:00
|
|
|
cursed(struct obj *otmp)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
if (otmp->cursed) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You can't. It appears to be cursed.");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
int
|
2009-06-07 22:30:39 +04:00
|
|
|
armoroff(struct obj *otmp)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
int delay = -objects[otmp->otyp].oc_delay;
|
|
|
|
if (cursed(otmp))
|
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (delay) {
|
1993-03-21 12:45:37 +03:00
|
|
|
nomul(delay);
|
1997-10-19 20:56:41 +04:00
|
|
|
switch (otmp->otyp) {
|
1993-03-21 12:45:37 +03:00
|
|
|
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);
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
int
|
2009-06-07 22:30:39 +04:00
|
|
|
doweararm(void)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
struct obj *otmp;
|
|
|
|
int delay;
|
|
|
|
int err = 0;
|
|
|
|
long mask = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
otmp = getobj("[", "wear");
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!otmp)
|
|
|
|
return (0);
|
|
|
|
if (otmp->owornmask & W_ARMOR) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You are already wearing that!");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (otmp->otyp == HELMET) {
|
|
|
|
if (uarmh) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You are already wearing a helmet.");
|
|
|
|
err++;
|
|
|
|
} else
|
|
|
|
mask = W_ARMH;
|
1997-10-19 20:56:41 +04:00
|
|
|
} else if (otmp->otyp == SHIELD) {
|
|
|
|
if (uarms)
|
|
|
|
pline("You are already wearing a shield."), err++;
|
|
|
|
if (uwep && uwep->otyp == TWO_HANDED_SWORD)
|
|
|
|
pline("You cannot wear a shield and wield a two-handed sword."), err++;
|
|
|
|
if (!err)
|
|
|
|
mask = W_ARMS;
|
|
|
|
} else if (otmp->otyp == PAIR_OF_GLOVES) {
|
|
|
|
if (uarmg) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You are already wearing gloves.");
|
|
|
|
err++;
|
1997-10-19 20:56:41 +04:00
|
|
|
} else if (uwep && uwep->cursed) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You cannot wear gloves over your weapon.");
|
|
|
|
err++;
|
|
|
|
} else
|
|
|
|
mask = W_ARMG;
|
|
|
|
} else {
|
1997-10-19 20:56:41 +04:00
|
|
|
if (uarm) {
|
|
|
|
if (otmp->otyp != ELVEN_CLOAK || uarm2) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You are already wearing some armor.");
|
|
|
|
err++;
|
|
|
|
}
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!err)
|
|
|
|
mask = W_ARM;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (otmp == uwep && uwep->cursed) {
|
|
|
|
if (!err++)
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("%s is welded to your hand.", Doname(uwep));
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (err)
|
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
setworn(otmp, mask);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (otmp == uwep)
|
1993-03-21 12:45:37 +03:00
|
|
|
setuwep((struct obj *) 0);
|
|
|
|
delay = -objects[otmp->otyp].oc_delay;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (delay) {
|
1993-03-21 12:45:37 +03:00
|
|
|
nomul(delay);
|
|
|
|
nomovemsg = "You finished your dressing manoeuvre.";
|
|
|
|
}
|
|
|
|
otmp->known = 1;
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
int
|
2009-06-07 22:30:39 +04:00
|
|
|
dowearring(void)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
struct obj *otmp;
|
|
|
|
long mask = 0;
|
|
|
|
long oldprop;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
if (uleft && uright) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("There are no more ring-fingers to fill.");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
otmp = getobj("=", "wear");
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!otmp)
|
|
|
|
return (0);
|
|
|
|
if (otmp->owornmask & W_RING) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You are already wearing that!");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (otmp == uleft || otmp == uright) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You are already wearing that.");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (otmp == uwep && uwep->cursed) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("%s is welded to your hand.", Doname(uwep));
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (uleft)
|
|
|
|
mask = RIGHT_RING;
|
|
|
|
else if (uright)
|
|
|
|
mask = LEFT_RING;
|
|
|
|
else
|
|
|
|
do {
|
|
|
|
char answer;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
pline("What ring-finger, Right or Left? ");
|
|
|
|
if (strchr(quitchars, (answer = readchar())))
|
|
|
|
return (0);
|
|
|
|
switch (answer) {
|
|
|
|
case 'l':
|
|
|
|
case 'L':
|
|
|
|
mask = LEFT_RING;
|
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
case 'R':
|
|
|
|
mask = RIGHT_RING;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (!mask);
|
1993-03-21 12:45:37 +03:00
|
|
|
setworn(otmp, mask);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (otmp == uwep)
|
1993-03-21 12:45:37 +03:00
|
|
|
setuwep((struct obj *) 0);
|
|
|
|
oldprop = u.uprops[PROP(otmp->otyp)].p_flgs;
|
|
|
|
u.uprops[PROP(otmp->otyp)].p_flgs |= mask;
|
1997-10-19 20:56:41 +04:00
|
|
|
switch (otmp->otyp) {
|
1993-03-21 12:45:37 +03:00
|
|
|
case RIN_LEVITATION:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!oldprop)
|
|
|
|
float_up();
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case RIN_PROTECTION_FROM_SHAPE_CHANGERS:
|
|
|
|
rescham();
|
|
|
|
break;
|
|
|
|
case RIN_GAIN_STRENGTH:
|
|
|
|
u.ustr += otmp->spe;
|
|
|
|
u.ustrmax += otmp->spe;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.ustr > 118)
|
|
|
|
u.ustr = 118;
|
|
|
|
if (u.ustrmax > 118)
|
|
|
|
u.ustrmax = 118;
|
1993-03-21 12:45:37 +03:00
|
|
|
flags.botl = 1;
|
|
|
|
break;
|
|
|
|
case RIN_INCREASE_DAMAGE:
|
|
|
|
u.udaminc += otmp->spe;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
prinv(otmp);
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
2009-06-07 22:30:39 +04:00
|
|
|
ringoff(struct obj *obj)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1997-10-19 20:56:41 +04:00
|
|
|
long mask;
|
1993-03-21 12:45:37 +03:00
|
|
|
mask = obj->owornmask & W_RING;
|
|
|
|
setworn((struct obj *) 0, obj->owornmask);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!(u.uprops[PROP(obj->otyp)].p_flgs & mask))
|
1993-03-21 12:45:37 +03:00
|
|
|
impossible("Strange... I didnt know you had that ring.");
|
|
|
|
u.uprops[PROP(obj->otyp)].p_flgs &= ~mask;
|
1997-10-19 20:56:41 +04:00
|
|
|
switch (obj->otyp) {
|
1993-03-21 12:45:37 +03:00
|
|
|
case RIN_FIRE_RESISTANCE:
|
|
|
|
/* Bad luck if the player is in hell... --jgm */
|
|
|
|
if (!Fire_resistance && dlevel >= 30) {
|
|
|
|
pline("The flames of Hell burn you to a crisp.");
|
|
|
|
killer = "stupidity in hell";
|
|
|
|
done("burned");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RIN_LEVITATION:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!Levitation) { /* no longer floating */
|
1993-03-21 12:45:37 +03:00
|
|
|
float_down();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RIN_GAIN_STRENGTH:
|
|
|
|
u.ustr -= obj->spe;
|
|
|
|
u.ustrmax -= obj->spe;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.ustr > 118)
|
|
|
|
u.ustr = 118;
|
|
|
|
if (u.ustrmax > 118)
|
|
|
|
u.ustrmax = 118;
|
1993-03-21 12:45:37 +03:00
|
|
|
flags.botl = 1;
|
|
|
|
break;
|
|
|
|
case RIN_INCREASE_DAMAGE:
|
|
|
|
u.udaminc -= obj->spe;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
2009-06-07 22:30:39 +04:00
|
|
|
find_ac(void)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
int uac = 10;
|
|
|
|
if (uarm)
|
|
|
|
uac -= ARM_BONUS(uarm);
|
|
|
|
if (uarm2)
|
|
|
|
uac -= ARM_BONUS(uarm2);
|
|
|
|
if (uarmh)
|
|
|
|
uac -= ARM_BONUS(uarmh);
|
|
|
|
if (uarms)
|
|
|
|
uac -= ARM_BONUS(uarms);
|
|
|
|
if (uarmg)
|
|
|
|
uac -= ARM_BONUS(uarmg);
|
|
|
|
if (uleft && uleft->otyp == RIN_PROTECTION)
|
|
|
|
uac -= uleft->spe;
|
|
|
|
if (uright && uright->otyp == RIN_PROTECTION)
|
|
|
|
uac -= uright->spe;
|
|
|
|
if (uac != u.uac) {
|
1993-03-21 12:45:37 +03:00
|
|
|
u.uac = uac;
|
|
|
|
flags.botl = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
2009-06-07 22:30:39 +04:00
|
|
|
glibr(void)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
struct obj *otmp;
|
|
|
|
int xfl = 0;
|
|
|
|
if (!uarmg)
|
|
|
|
if (uleft || uright) {
|
|
|
|
/* Note: at present also cursed rings fall off */
|
|
|
|
pline("Your %s off your fingers.",
|
|
|
|
(uleft && uright) ? "rings slip" : "ring slips");
|
|
|
|
xfl++;
|
|
|
|
if ((otmp = uleft) != Null(obj)) {
|
|
|
|
ringoff(uleft);
|
|
|
|
dropx(otmp);
|
|
|
|
}
|
|
|
|
if ((otmp = uright) != Null(obj)) {
|
|
|
|
ringoff(uright);
|
|
|
|
dropx(otmp);
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if ((otmp = uwep) != Null(obj)) {
|
1993-03-21 12:45:37 +03:00
|
|
|
/* Note: at present also cursed weapons fall */
|
|
|
|
setuwep((struct obj *) 0);
|
|
|
|
dropx(otmp);
|
|
|
|
pline("Your weapon %sslips from your hands.",
|
1997-10-19 20:56:41 +04:00
|
|
|
xfl ? "also " : "");
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
struct obj *
|
2009-06-07 22:30:39 +04:00
|
|
|
some_armor(void)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
struct obj *otmph = uarm;
|
|
|
|
if (uarmh && (!otmph || !rn2(4)))
|
|
|
|
otmph = uarmh;
|
|
|
|
if (uarmg && (!otmph || !rn2(4)))
|
|
|
|
otmph = uarmg;
|
|
|
|
if (uarms && (!otmph || !rn2(4)))
|
|
|
|
otmph = uarms;
|
|
|
|
return (otmph);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
2009-06-07 22:30:39 +04:00
|
|
|
corrode_armor(void)
|
1997-10-19 20:56:41 +04:00
|
|
|
{
|
|
|
|
struct obj *otmph = some_armor();
|
|
|
|
if (otmph) {
|
|
|
|
if (otmph->rustfree ||
|
|
|
|
otmph->otyp == ELVEN_CLOAK ||
|
|
|
|
otmph->otyp == LEATHER_ARMOR ||
|
|
|
|
otmph->otyp == STUDDED_LEATHER_ARMOR) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("Your %s not affected!",
|
1997-10-19 20:56:41 +04:00
|
|
|
aobjnam(otmph, "are"));
|
1993-03-21 12:45:37 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
pline("Your %s!", aobjnam(otmph, "corrode"));
|
|
|
|
otmph->spe--;
|
|
|
|
}
|
|
|
|
}
|