diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 41c949c29..7441ef10e 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -84,6 +84,7 @@ various actions--such as enchanting--performed on an unpaid shop object either force the hero to buy the item (when its value is lowered) or increase the current bill (when its value is raised) adjust health threshold where wounded hero will be healed by successful prayer +prevent lose-level+regain-level cycle from arbritrarily boosting HP and Pw Platform- and/or Interface-Specific Fixes diff --git a/include/patchlevel.h b/include/patchlevel.h index 28349708b..73b6d6e0f 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)patchlevel.h 3.5 2005/07/13 */ +/* SCCS Id: @(#)patchlevel.h 3.5 2005/09/12 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -13,7 +13,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 22 +#define EDITLEVEL 23 #define COPYRIGHT_BANNER_A \ "NetHack, Copyright 1985-2005" diff --git a/include/you.h b/include/you.h index c893b2837..43f1ea6a3 100644 --- a/include/you.h +++ b/include/you.h @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)you.h 3.5 2000/05/21 */ +/* SCCS Id: @(#)you.h 3.5 2005/09/12 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -333,6 +333,7 @@ struct you { uchar uspmtime; /* #moves between uspellprot-- */ int uhp,uhpmax; int uen, uenmax; /* magical energy - M. Stephenson */ + xchar uhpinc[MAXULEV], ueninc[MAXULEV]; /* increases from level gain */ int ugangr; /* if the gods are angry at you */ int ugifts; /* number of artifacts bestowed */ int ublessed, ublesscnt; /* blessing/duration from #pray */ diff --git a/src/exper.c b/src/exper.c index 92b87d3c2..9c5de9b57 100644 --- a/src/exper.c +++ b/src/exper.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)exper.c 3.5 2002/11/20 */ +/* SCCS Id: @(#)exper.c 3.5 2005/09/12 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -148,20 +148,14 @@ const char *drainer; /* cause of death, if drain should be fatal */ /* no drainer or lifesaved */ u.uexp = 0; } - num = newhp(); + num = (int) u.uhpinc[u.ulevel]; u.uhpmax -= num; if (u.uhpmax < 1) u.uhpmax = 1; u.uhp -= num; if (u.uhp < 1) u.uhp = 1; else if (u.uhp > u.uhpmax) u.uhp = u.uhpmax; - if (u.ulevel < urole.xlev) - num = rn1((int)ACURR(A_WIS)/2 + urole.enadv.lornd + urace.enadv.lornd, - urole.enadv.lofix + urace.enadv.lofix); - else - num = rn1((int)ACURR(A_WIS)/2 + urole.enadv.hirnd + urace.enadv.hirnd, - urole.enadv.hifix + urace.enadv.hifix); - num = enermod(num); /* M. Stephenson */ + num = (int) u.ueninc[u.ulevel]; u.uenmax -= num; if (u.uenmax < 0) u.uenmax = 0; u.uen -= num; @@ -190,27 +184,40 @@ void pluslvl(incr) boolean incr; /* true iff via incremental experience growth */ { /* (false for potion of gain level) */ - register int num; + int hpinc, eninc, enrnd, enfix; if (!incr) You_feel("more experienced."); - num = newhp(); - u.uhpmax += num; - u.uhp += num; + + /* increase hit points (when polymorphed, do monster form first + in order to retain normal human/whatever increase for later) */ if (Upolyd) { - num = rnd(8); - u.mhmax += num; - u.mh += num; + hpinc = rnd(8); + u.mhmax += hpinc; + u.mh += hpinc; } - if (u.ulevel < urole.xlev) - num = rn1((int)ACURR(A_WIS)/2 + urole.enadv.lornd + urace.enadv.lornd, - urole.enadv.lofix + urace.enadv.lofix); - else - num = rn1((int)ACURR(A_WIS)/2 + urole.enadv.hirnd + urace.enadv.hirnd, - urole.enadv.hifix + urace.enadv.hifix); - num = enermod(num); /* M. Stephenson */ - u.uenmax += num; - u.uen += num; + hpinc = newhp(); + u.uhpmax += hpinc; + u.uhp += hpinc; + + /* increase spell power/energy points */ + enrnd = (int)ACURR(A_WIS) / 2; + if (u.ulevel < urole.xlev) { + enrnd += urole.enadv.lornd + urace.enadv.lornd; + enfix = urole.enadv.lofix + urace.enadv.lofix; + } else { + enrnd += urole.enadv.hirnd + urace.enadv.hirnd; + enfix = urole.enadv.hifix + urace.enadv.hifix; + } + eninc = enermod(rn1(enrnd, enfix)); /* M. Stephenson */ + u.uenmax += eninc; + u.uen += eninc; + + /* increase level (unless already maxxed) */ if (u.ulevel < MAXULEV) { + /* remember hp and pw/en gains in case this level is later lost */ + u.uhpinc[u.ulevel] = (xchar) hpinc; + u.ueninc[u.ulevel] = (xchar) eninc; + /* increase experience points to reflect new level */ if (incr) { long tmp = newuexp(u.ulevel + 1); if (u.uexp >= tmp) u.uexp = tmp - 1;