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:
PatR
2020-01-29 10:35:02 -08:00
parent ea8248e3c6
commit 1641c864a2
2 changed files with 22 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.80 $ $NHDT-Date: 1580254093 2020/01/28 23:28:13 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.81 $ $NHDT-Date: 1580322890 2020/01/29 18:34:50 $
General Fixes and Modified Features
-----------------------------------
@@ -48,6 +48,7 @@ hero can no longer wear blindfold/towel/lenses when poly'd into headless form
revamp achievement tracking for exploring Mine's End and Sokoban (by acquiring
luckstone and bag of holding or amulet of reflection, respectively)
throttle long worm growth rate and HP accumulation
poly'd hero was able to zap wands without any hands
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
@@ -127,6 +128,8 @@ for end of game disclosure and dumplog, show 'achievements' (previously only
more grades of self-appearance than beautiful or handsome vs ugly
when 'color' if Off and 'use_inverse' is On, draw ice on the map in inverse
video if it uses the same character as room floor or as dark floor
new 'mention_decor' option; when On, describe dungeon features being stepped
on or floated/flown over even when they're not covered by objects
Platform- and/or Interface-Specific New Features

View File

@@ -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;
}