escaping buried iron ball

Noticed while testing the look-at-self feedback for traps.  When
punished and the iron ball gets buried, hero becomes "tethered to a
buried object".  It is possible to simply walk away (like from a pit,
bear trap, web, stuck in floor by solidified lava or sinking into
molten lava) but that requires many tries.  Once the escape happens,
"you finally wrench the ball free" and are supposed to have it
reattached to a replacement chain.  However, buried_ball() wouldn't
look at buried objects if the trap countdown timer was 0 (which is
the case when finally wrenching free).  So hero got a new chain to
drag around but it had no heavy iron ball attached.

I didn't turn on sanity checking but that would have complained about
this.  Normal dragging didn't care but I wouldn't be surprised if
various actions that checked Punished and picked up the ball in order
to put it down again elsewhere would have had possibly serious trouble.
This commit is contained in:
PatR
2020-01-10 04:36:28 -08:00
parent f6c547f376
commit 3a6e2a9802
2 changed files with 11 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dig.c $NHDT-Date: 1547421446 2019/01/13 23:17:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.117 $ */
/* NetHack 3.6 dig.c $NHDT-Date: 1578659784 2020/01/10 12:36:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.135 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1741,7 +1741,10 @@ coord *cc;
* only lets hero get one step away from the buried ball?]
*/
if (u.utrap && u.utraptype == TT_BURIEDBALL)
/* u.utrap might have already been cleared, in which case the value
of u.utraptype is no longer meaningful; if u.utrap is still set
then u.utraptype needs to be for buried ball */
if (!u.utrap || u.utraptype == TT_BURIEDBALL) {
for (otmp = g.level.buriedobjlist; otmp; otmp = otmp->nobj) {
if (otmp->otyp != HEAVY_IRON_BALL)
continue;
@@ -1760,6 +1763,7 @@ coord *cc;
bdist = odist;
}
}
}
if (ball) {
/* found, but not at < cc->x, cc->y > */
cc->x = ball->ox;