"vampdance" patch for avoiding unlimited HP and Pw gain (trunk only)
<email deleted> sent a report with
subject "Vampire-dancing can give you unlimited maxhp/maxmp" about how you
can manipulate your hit points and spell energy by using equipment to
lower Con and Wis prior to deliberately losing a level, then switching to
alternate gear to raise them prior to gaining the trivial 1 XP needed to
regain the lost level. With Stormbringer (to toss up so that it falls on
your head) or spell of drain level (to cast at yourself), you can do this
level toggling as much as you like since it doesn't consume any resources
in the process. All you is a supply of non-threatening monsters to kill
for the regaining half.
In March he sent "vampire-dancing (patch)" which didn't include a
patch but did give a URL ( http://nethack.angband.pl/vampdance.patch )
for one. That contained his suggested fix: recording the hit points and
energy points given each time you gain a level and then using those exact
amounts when you lose the corresponding level. It's still possible to
manipulate HP and Pw by losing multiple levels after you've boosted Con
and Wis to ascension ready status (you'll lose the original values but can
expect to get better ones when gaining levels back), but can only gain a
modest improvement and repeating it doesn't augment the effectiveness.
Plus it's much harder to regain multiple levels than it is to get just one.
His patch had a couple of bugs which I've fixed. I suppose that there
could be additional potential problems but the idea and its implementation
are both pretty straightforward. (This doesn't address the other recently
reported situation of using polymorph into "new man" while at level one to
multiply HP and Pw.)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 */
|
||||
|
||||
57
src/exper.c
57
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;
|
||||
|
||||
Reference in New Issue
Block a user