Skip to content

Commit

Permalink
fix github issue #159 - eating nurse corpses
Browse files Browse the repository at this point in the history
Fixes #159

The nurse monster definition is flagged to be able to convery poison
resistance when a corpse or tin is eaten, but the post-corpse code
for nurse healed HP and cured blindness then skipped the intrinsic
handling.
  • Loading branch information
PatR committed Nov 13, 2018
1 parent 8e907a0 commit a97d0b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/fixes36.2
Expand Up @@ -196,6 +196,7 @@ avoid potential buffer overflow if object with very long name knocks other
#wizintrinsic for 'warn_of_mon' didn't set any type of monster (now grid bugs)
clairvoyance would show trap instead of a monster on/in that trap, which was
intentional, but when clairvoyance finished the monster wasn't shown
nurse corpse/tin chance to convey poison resistance when eaten was not honored


Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
Expand Down
19 changes: 13 additions & 6 deletions src/eat.c
Expand Up @@ -943,10 +943,11 @@ register struct permonst *ptr;
/* called after completely consuming a corpse */
STATIC_OVL void
cpostfx(pm)
register int pm;
int pm;
{
register int tmp = 0;
int tmp = 0;
int catch_lycanthropy = NON_PM;
boolean check_intrinsics = FALSE;

/* in case `afternmv' didn't get called for previously mimicking
gold, clean up now to avoid `eatmbuf' memory leak */
Expand All @@ -958,6 +959,7 @@ register int pm;
/* MRKR: "eye of newt" may give small magical energy boost */
if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
int old_uen = u.uen;

u.uen += rnd(3);
if (u.uen > u.uenmax) {
if (!rn2(3))
Expand Down Expand Up @@ -989,6 +991,7 @@ register int pm;
u.uhp = u.uhpmax;
make_blinded(0L, !u.ucreamed);
context.botl = 1;
check_intrinsics = TRUE; /* might also convey poison resistance */
break;
case PM_STALKER:
if (!Invis) {
Expand Down Expand Up @@ -1090,7 +1093,13 @@ register int pm;
pline("For some reason, that tasted bland.");
}
/*FALLTHRU*/
default: {
default:
check_intrinsics = TRUE;
break;
}

/* possibly convey an intrinsic */
if (check_intrinsics) {
struct permonst *ptr = &mons[pm];
boolean conveys_STR = is_giant(ptr);
int i, count;
Expand Down Expand Up @@ -1137,9 +1146,7 @@ register int pm;
gainstr((struct obj *) 0, 0, TRUE);
else if (tmp > 0)
givit(tmp, ptr);
break;
} /* default case */
} /* switch */
} /* check_intrinsics */

if (catch_lycanthropy >= LOW_PM) {
set_ulycn(catch_lycanthropy);
Expand Down

0 comments on commit a97d0b7

Please sign in to comment.