From: nhmall Date: Wed, 1 Jun 2022 16:31:32 +0000 (-0400) Subject: bear trap vanishes when poly'd hero fails to eat X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=caeac77239cd5a3c05b69878ed999dbb36863587;p=nethack bear trap vanishes when poly'd hero fails to eat Closes #781 --- diff --git a/src/eat.c b/src/eat.c index 9a1f15531..b2e15c76c 100644 --- a/src/eat.c +++ b/src/eat.c @@ -3433,10 +3433,20 @@ floorfood( Sprintf(qbuf, "There is a bear trap here (%s); eat it?", u_in_beartrap ? "holding you" : "armed"); if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') { + struct obj *beartrap; + deltrap(ttmp); if (u_in_beartrap) reset_utrap(TRUE); - return mksobj(BEARTRAP, TRUE, FALSE); + beartrap = mksobj(BEARTRAP, TRUE, FALSE); + Sprintf(qbuf,"You only manage to %s the bear trap.", + u_in_beartrap ? "free yourself from" : "disarm"); + if (check_capacity(qbuf) && beartrap) { + obj_extract_self(beartrap); + dropy(beartrap); /* put it on the floor */ + return (struct obj *) 0; + } + return beartrap; } else if (c == 'q') { return (struct obj *) 0; }