fix issue #949 - dropping welded iron ball

If punished and the attached iron ball was both cursed and wielded,
falling while going down stairs would drop it instead of leaving it
welded to hero's hand. ( Didn't happen for iron ball that wasn't
chained to hero's leg.)

I thought that this was going to be a one or two line fix but ball
and chain stuff is never that simple.

Fixes #949
This commit is contained in:
PatR
2022-12-15 13:48:59 -08:00
parent 995fae39b5
commit df7e575500
4 changed files with 30 additions and 7 deletions

View File

@@ -595,6 +595,19 @@ canletgo(struct obj *obj, const char *word)
Norep("You cannot %s %s you are wearing.", word, something);
return FALSE;
}
if (obj == uwep && welded(uwep)) {
/* no weldmsg(), so uwep->bknown might become set silently
if word is "" */
if (*word) {
const char *hand = body_part(HAND);
if (bimanual(uwep))
hand = makeplural(hand);
Norep("You cannot %s %s welded to your %s.", word, something,
hand);
}
return FALSE;
}
if (obj->otyp == LOADSTONE && obj->cursed) {
/* getobj() kludge sets corpsenm to user's specified count
when refusing to split a stack of cursed loadstones */
@@ -1612,7 +1625,8 @@ goto_level(
You("fall down the %s.", ga.at_ladder ? "ladder" : "stairs");
if (Punished) {
drag_down();
ballrelease(FALSE);
if (!welded(uball))
ballrelease(FALSE);
}
/* falling off steed has its own losehp() call */
if (u.usteed)
@@ -1632,7 +1646,7 @@ goto_level(
} else { /* trap door or level_tele or In_endgame */
u_on_rndspot((up ? 1 : 0) | (was_in_W_tower ? 2 : 0));
if (falling) {
if (Punished)
if (Punished && !welded(uball))
ballfall();
selftouch("Falling, you");
do_fall_dmg = TRUE;