wands vs no-hands
Hero shouldn't be able to zap wands when polymorphed into a form which lacks hands. The other tweaks to dozap() shouldn't produce any change in behavior.
This commit is contained in:
31
src/zap.c
31
src/zap.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 zap.c $NHDT-Date: 1573688696 2019/11/13 23:44:56 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.316 $ */
|
||||
/* NetHack 3.6 zap.c $NHDT-Date: 1580322890 2020/01/29 18:34:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.330 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -2200,7 +2200,7 @@ struct obj *otmp;
|
||||
pline("%s suddenly explodes!", The(xname(otmp)));
|
||||
dmg = d(otmp->spe + 2, 6);
|
||||
losehp(Maybe_Half_Phys(dmg), "exploding wand", KILLED_BY_AN);
|
||||
useup(otmp);
|
||||
useupall(otmp);
|
||||
}
|
||||
|
||||
static NEARDATA const char zap_syms[] = { WAND_CLASS, 0 };
|
||||
@@ -2209,9 +2209,13 @@ static NEARDATA const char zap_syms[] = { WAND_CLASS, 0 };
|
||||
int
|
||||
dozap()
|
||||
{
|
||||
register struct obj *obj;
|
||||
int damage;
|
||||
struct obj *obj;
|
||||
int damage, need_dir;
|
||||
|
||||
if (nohands(g.youmonst.data)) {
|
||||
You("aren't able to zap anything in your current form.");
|
||||
return 0;
|
||||
}
|
||||
if (check_capacity((char *) 0))
|
||||
return 0;
|
||||
obj = getobj(zap_syms, "zap");
|
||||
@@ -2220,19 +2224,20 @@ dozap()
|
||||
|
||||
check_unpaid(obj);
|
||||
|
||||
/* zappable addition done by GAN 11/03/86 */
|
||||
if (!zappable(obj))
|
||||
need_dir = objects[obj->otyp].oc_dir != NODIR;
|
||||
if (!zappable(obj)) {
|
||||
pline1(nothing_happens);
|
||||
else if (obj->cursed && !rn2(WAND_BACKFIRE_CHANCE)) {
|
||||
} else if (obj->cursed && !rn2(WAND_BACKFIRE_CHANCE)) {
|
||||
backfire(obj); /* the wand blows up in your face! */
|
||||
exercise(A_STR, FALSE);
|
||||
/* 'obj' is gone; skip update_inventory() because
|
||||
backfire() -> useupall() -> freeinv() did it */
|
||||
return 1;
|
||||
} else if (!(objects[obj->otyp].oc_dir == NODIR) && !getdir((char *) 0)) {
|
||||
} else if (need_dir && !getdir((char *) 0)) {
|
||||
if (!Blind)
|
||||
pline("%s glows and fades.", The(xname(obj)));
|
||||
/* make him pay for knowing !NODIR */
|
||||
} else if (!u.dx && !u.dy && !u.dz
|
||||
&& !(objects[obj->otyp].oc_dir == NODIR)) {
|
||||
} else if (need_dir && !u.dx && !u.dy && !u.dz) {
|
||||
if ((damage = zapyourself(obj, TRUE)) != 0) {
|
||||
char buf[BUFSZ];
|
||||
|
||||
@@ -2253,9 +2258,9 @@ dozap()
|
||||
}
|
||||
if (obj && obj->spe < 0) {
|
||||
pline("%s to dust.", Tobjnam(obj, "turn"));
|
||||
useup(obj);
|
||||
}
|
||||
update_inventory(); /* maybe used a charge */
|
||||
useupall(obj); /* calls freeinv() -> update_inventory() */
|
||||
} else
|
||||
update_inventory(); /* maybe used a charge */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user