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

View File

@@ -1174,7 +1174,9 @@ peffect_gain_energy(struct obj *otmp)
if (otmp->cursed)
num = -num; /* subtract instead of add when cursed */
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.uen += 3 * num;
if (u.uen > u.uenmax)
@@ -1356,8 +1358,11 @@ healup(int nhp, int nxtra, boolean curesick, boolean cureblind)
u.mh = (u.mhmax += nxtra);
} else {
u.uhp += nhp;
if (u.uhp > u.uhpmax)
if (u.uhp > u.uhpmax) {
u.uhp = (u.uhpmax += nxtra);
if (u.uhpmax > u.uhppeak)
u.uhppeak = u.uhpmax;
}
}
}
if (cureblind) {
@@ -1966,6 +1971,7 @@ potionbreathe(struct obj *obj)
break;
/*
case POT_GAIN_LEVEL:
case POT_GAIN_ENERGY:
case POT_LEVITATION:
case POT_FRUIT_JUICE:
case POT_MONSTER_DETECTION: