level drain while polymorphed (trunk only)

Noticed when incorporating the "vampire dancing" patch:  losing a level
while polymorphed would subtract from your normal hit points but didn't
affect your monster hit points.  Now they'll lose d8 from max and current,
similar to the amount they increase when gaining a level.

     This also addresses an issue from the newsgroup a few weeks back:
someone mentioned an assumption that Stormbringer drained an amount other
than d8 for monsters who use some other formula for their hit points.  It
wasn't true, but now it will be (approximately).  Most monsters with unusual
hit points aren't subject to level drain, so it shouldn't have much impact.
This commit is contained in:
nethack.rankin
2005-09-22 06:02:08 +00:00
parent 7ec0d054a4
commit 7828cb3687
6 changed files with 42 additions and 6 deletions

View File

@@ -190,6 +190,14 @@ const char *drainer; /* cause of death, if drain should be fatal */
if (u.uexp > 0)
u.uexp = newuexp(u.ulevel) - 1;
if (Upolyd) {
num = monhp_per_lvl(&youmonst);
u.mhmax -= num;
u.mh -= num;
if (u.mh <= 0) rehumanize();
}
context.botl = 1;
}
@@ -217,7 +225,7 @@ boolean incr; /* true iff via incremental experience growth */
/* increase hit points (when polymorphed, do monster form first
in order to retain normal human/whatever increase for later) */
if (Upolyd) {
hpinc = rnd(8);
hpinc = monhp_per_lvl(&youmonst);
u.mhmax += hpinc;
u.mh += hpinc;
}