tracking peak maximum HP and energy

Keep track of the highest value that u.uhpmax and u.uenmax have
attained, in new u.uhppeak and u.uenpeak.  They aren't used for
anything yet.  u.mhmax (max HP while polymorphed) isn't interesting
enough to track.

Not save and bones compatible so increments EDITLEVEL.
This commit is contained in:
PatR
2021-12-04 05:19:45 -08:00
parent 657e205ae8
commit 936be565d9
13 changed files with 49 additions and 13 deletions
+1
View File
@@ -1270,6 +1270,7 @@ decaying globs of {ooze,pudding,slime} shrink over time based on their total
weight, eventually to nothing; for combined globs it can take a long weight, eventually to nothing; for combined globs it can take a long
time, and while doing so they no longer give the tainted corpse food time, and while doing so they no longer give the tainted corpse food
poisoning effect when eaten poisoning effect when eaten
track peak maximum HP and peak maximum energy/power; no noticeable effect
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+1 -1
View File
@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones * Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files. * and save files.
*/ */
#define EDITLEVEL 45 #define EDITLEVEL 46
/* /*
* Development status possibilities. * Development status possibilities.
+7 -4
View File
@@ -400,7 +400,8 @@ struct you {
int umonster; /* hero's "real" monster num */ int umonster; /* hero's "real" monster num */
int umonnum; /* current monster number */ int umonnum; /* current monster number */
int mh, mhmax, mtimedone; /* for polymorph-self */ int mh, mhmax, /* current and max hit points when polyd */
mtimedone; /* no. of turns until polymorph times out */
struct attribs macurr, /* for monster attribs */ struct attribs macurr, /* for monster attribs */
mamax; /* for monster attribs */ mamax; /* for monster attribs */
int ulycn; /* lycanthrope type */ int ulycn; /* lycanthrope type */
@@ -450,8 +451,10 @@ struct you {
uchar uspellprot; /* protection by SPE_PROTECTION */ uchar uspellprot; /* protection by SPE_PROTECTION */
uchar usptime; /* #moves until uspellprot-- */ uchar usptime; /* #moves until uspellprot-- */
uchar uspmtime; /* #moves between uspellprot-- */ uchar uspmtime; /* #moves between uspellprot-- */
int uhp, uhpmax; /* hit points, aka health */ int uhp, uhpmax, /* hit points, aka health */
int uen, uenmax; /* magical energy - M. Stephenson */ uhppeak; /* highest value of uhpmax so far */
int uen, uenmax, /* magical energy, aka spell power */
uenpeak; /* highest value of uenmax so far */
xchar uhpinc[MAXULEV], /* increases to uhpmax for each level gain */ xchar uhpinc[MAXULEV], /* increases to uhpmax for each level gain */
ueninc[MAXULEV]; /* increases to uenmax for each level gain */ ueninc[MAXULEV]; /* increases to uenmax for each level gain */
int ugangr; /* if the gods are angry at you */ int ugangr; /* if the gods are angry at you */
@@ -459,7 +462,7 @@ struct you {
int ublessed, ublesscnt; /* blessing/duration from #pray */ int ublessed, ublesscnt; /* blessing/duration from #pray */
long umoney0; long umoney0;
long uspare1; long uspare1;
long uexp, urexp; long uexp, urexp; /* exper pts for gaining levels and for score */
long ucleansed; /* to record moves when player was cleansed */ long ucleansed; /* to record moves when player was cleansed */
long usleep; /* sleeping; monstermove you last started */ long usleep; /* sleeping; monstermove you last started */
int uinvault; int uinvault;
+2
View File
@@ -1000,6 +1000,8 @@ Mb_hit(struct monst *magr, /* attacker */
mdef->mhp = 1; /* cancelled clay golems will die */ mdef->mhp = 1; /* cancelled clay golems will die */
if (youattack && attacktype(mdef->data, AT_MAGC)) { if (youattack && attacktype(mdef->data, AT_MAGC)) {
u.uenmax++; u.uenmax++;
if (u.uenmax > u.uenpeak)
u.uenpeak = u.uenmax;
u.uen++; u.uen++;
g.context.botl = TRUE; g.context.botl = TRUE;
You("absorb magical energy!"); You("absorb magical energy!");
+8 -2
View File
@@ -937,8 +937,11 @@ eye_of_newt_buzz(void)
u.uen += rnd(3); u.uen += rnd(3);
if (u.uen > u.uenmax) { if (u.uen > u.uenmax) {
if (!rn2(3)) if (!rn2(3)) {
u.uenmax++; u.uenmax++;
if (u.uenmax > u.uenpeak)
u.uenpeak = u.uenmax;
}
u.uen = u.uenmax; u.uen = u.uenmax;
} }
if (old_uen != u.uen) { if (old_uen != u.uen) {
@@ -2247,8 +2250,11 @@ fpostfx(struct obj *otmp)
} else { } else {
u.uhp += otmp->cursed ? -rnd(20) : rnd(20); u.uhp += otmp->cursed ? -rnd(20) : rnd(20);
if (u.uhp > u.uhpmax) { if (u.uhp > u.uhpmax) {
if (!rn2(17)) if (!rn2(17)) {
u.uhpmax++; u.uhpmax++;
if (u.uhpmax > u.uhppeak)
u.uhppeak = u.uhpmax;
}
u.uhp = u.uhpmax; u.uhp = u.uhpmax;
} else if (u.uhp <= 0) { } else if (u.uhp <= 0) {
g.killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
+4
View File
@@ -289,11 +289,15 @@ pluslvl(boolean incr) /* true iff via incremental experience growth */
} }
hpinc = newhp(); hpinc = newhp();
u.uhpmax += hpinc; u.uhpmax += hpinc;
if (u.uhpmax > u.uhppeak)
u.uhppeak = u.uhpmax;
u.uhp += hpinc; u.uhp += hpinc;
/* increase spell power/energy points */ /* increase spell power/energy points */
eninc = newpw(); eninc = newpw();
u.uenmax += eninc; u.uenmax += eninc;
if (u.uenmax > u.uenpeak)
u.uenpeak = u.uenmax;
u.uen += eninc; u.uen += eninc;
/* increase level (unless already maxxed) */ /* increase level (unless already maxxed) */
+2
View File
@@ -1953,6 +1953,8 @@ doseduce(struct monst *mon)
You_feel("raised to your full potential."); You_feel("raised to your full potential.");
exercise(A_CON, TRUE); exercise(A_CON, TRUE);
u.uen = (u.uenmax += rnd(5)); u.uen = (u.uenmax += rnd(5));
if (u.uenmax > u.uenpeak)
u.uenpeak = u.uenmax;
break; break;
case 1: case 1:
You_feel("good enough to do it again."); You_feel("good enough to do it again.");
+8 -2
View File
@@ -1174,7 +1174,9 @@ peffect_gain_energy(struct obj *otmp)
if (otmp->cursed) if (otmp->cursed)
num = -num; /* subtract instead of add when cursed */ num = -num; /* subtract instead of add when cursed */
u.uenmax += num; u.uenmax += num;
if (u.uenmax <= 0) if (u.uenmax > u.uenpeak)
u.uenpeak = u.uenmax;
else if (u.uenmax <= 0)
u.uenmax = 0; u.uenmax = 0;
u.uen += 3 * num; u.uen += 3 * num;
if (u.uen > u.uenmax) if (u.uen > u.uenmax)
@@ -1356,8 +1358,11 @@ healup(int nhp, int nxtra, boolean curesick, boolean cureblind)
u.mh = (u.mhmax += nxtra); u.mh = (u.mhmax += nxtra);
} else { } else {
u.uhp += nhp; u.uhp += nhp;
if (u.uhp > u.uhpmax) if (u.uhp > u.uhpmax) {
u.uhp = (u.uhpmax += nxtra); u.uhp = (u.uhpmax += nxtra);
if (u.uhpmax > u.uhppeak)
u.uhppeak = u.uhpmax;
}
} }
} }
if (cureblind) { if (cureblind) {
@@ -1966,6 +1971,7 @@ potionbreathe(struct obj *obj)
break; break;
/* /*
case POT_GAIN_LEVEL: case POT_GAIN_LEVEL:
case POT_GAIN_ENERGY:
case POT_LEVITATION: case POT_LEVITATION:
case POT_FRUIT_JUICE: case POT_FRUIT_JUICE:
case POT_MONSTER_DETECTION: case POT_MONSTER_DETECTION:
+4
View File
@@ -387,6 +387,8 @@ fix_worst_trouble(int trouble)
u.uhpmax += rnd(5); u.uhpmax += rnd(5);
if (u.uhpmax <= 5) if (u.uhpmax <= 5)
u.uhpmax = 5 + 1; u.uhpmax = 5 + 1;
if (u.uhpmax > u.uhppeak)
u.uhppeak = u.uhpmax;
u.uhp = u.uhpmax; u.uhp = u.uhpmax;
g.context.botl = 1; g.context.botl = 1;
break; break;
@@ -1087,6 +1089,8 @@ pleased(aligntyp g_align)
pluslvl(FALSE); pluslvl(FALSE);
} else { } else {
u.uhpmax += 5; u.uhpmax += 5;
if (u.uhpmax > u.uhppeak)
u.uhppeak = u.uhpmax;
if (Upolyd) if (Upolyd)
u.mhmax += 5; u.mhmax += 5;
} }
+4 -1
View File
@@ -185,8 +185,11 @@ dosit(void)
u.mhmax += 4; u.mhmax += 4;
u.mh = u.mhmax; u.mh = u.mhmax;
} }
if (u.uhp >= (u.uhpmax - 5)) if (u.uhp >= (u.uhpmax - 5)) {
u.uhpmax += 4; u.uhpmax += 4;
if (u.uhpmax > u.uhppeak)
u.uhppeak = u.uhpmax;
}
u.uhp = u.uhpmax; u.uhp = u.uhpmax;
u.ucreamed = 0; u.ucreamed = 0;
make_blinded(0L, TRUE); make_blinded(0L, TRUE);
+2
View File
@@ -1959,6 +1959,8 @@ trapeffect_magic_trap(
losehp(rnd(10), "magical explosion", KILLED_BY_AN); losehp(rnd(10), "magical explosion", KILLED_BY_AN);
Your("body absorbs some of the magical energy!"); Your("body absorbs some of the magical energy!");
u.uen = (u.uenmax += 2); u.uen = (u.uenmax += 2);
if (u.uenmax > u.uenpeak)
u.uenpeak = u.uenmax;
return 0; return 0;
} else { } else {
domagictrap(); domagictrap();
+2 -2
View File
@@ -661,8 +661,8 @@ u_init(void)
set_uasmon(); set_uasmon();
u.ulevel = 0; /* set up some of the initial attributes */ u.ulevel = 0; /* set up some of the initial attributes */
u.uhp = u.uhpmax = newhp(); u.uhp = u.uhpmax = u.uhppeak = newhp();
u.uen = u.uenmax = newpw(); u.uen = u.uenmax = u.uenpeak = newpw();
u.uspellprot = 0; u.uspellprot = 0;
adjabil(0, 1); adjabil(0, 1);
u.ulevel = u.ulevelmax = 1; u.ulevel = u.ulevelmax = 1;
+4 -1
View File
@@ -3662,8 +3662,11 @@ mhitm_ad_heal(struct monst *magr, struct attack *mattk, struct monst *mdef,
u.uhp += rnd(7); u.uhp += rnd(7);
if (!rn2(7)) { if (!rn2(7)) {
/* hard upper limit via nurse care: 25 * ulevel */ /* hard upper limit via nurse care: 25 * ulevel */
if (u.uhpmax < 5 * u.ulevel + d(2 * u.ulevel, 10)) if (u.uhpmax < 5 * u.ulevel + d(2 * u.ulevel, 10)) {
u.uhpmax++; u.uhpmax++;
if (u.uhpmax > u.uhppeak)
u.uhppeak = u.uhpmax;
}
if (!rn2(13)) if (!rn2(13))
goaway = TRUE; goaway = TRUE;
} }