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:
@@ -1000,6 +1000,8 @@ Mb_hit(struct monst *magr, /* attacker */
|
||||
mdef->mhp = 1; /* cancelled clay golems will die */
|
||||
if (youattack && attacktype(mdef->data, AT_MAGC)) {
|
||||
u.uenmax++;
|
||||
if (u.uenmax > u.uenpeak)
|
||||
u.uenpeak = u.uenmax;
|
||||
u.uen++;
|
||||
g.context.botl = TRUE;
|
||||
You("absorb magical energy!");
|
||||
|
||||
10
src/eat.c
10
src/eat.c
@@ -937,8 +937,11 @@ eye_of_newt_buzz(void)
|
||||
|
||||
u.uen += rnd(3);
|
||||
if (u.uen > u.uenmax) {
|
||||
if (!rn2(3))
|
||||
if (!rn2(3)) {
|
||||
u.uenmax++;
|
||||
if (u.uenmax > u.uenpeak)
|
||||
u.uenpeak = u.uenmax;
|
||||
}
|
||||
u.uen = u.uenmax;
|
||||
}
|
||||
if (old_uen != u.uen) {
|
||||
@@ -2247,8 +2250,11 @@ fpostfx(struct obj *otmp)
|
||||
} else {
|
||||
u.uhp += otmp->cursed ? -rnd(20) : rnd(20);
|
||||
if (u.uhp > u.uhpmax) {
|
||||
if (!rn2(17))
|
||||
if (!rn2(17)) {
|
||||
u.uhpmax++;
|
||||
if (u.uhpmax > u.uhppeak)
|
||||
u.uhppeak = u.uhpmax;
|
||||
}
|
||||
u.uhp = u.uhpmax;
|
||||
} else if (u.uhp <= 0) {
|
||||
g.killer.format = KILLED_BY_AN;
|
||||
|
||||
@@ -289,11 +289,15 @@ pluslvl(boolean incr) /* true iff via incremental experience growth */
|
||||
}
|
||||
hpinc = newhp();
|
||||
u.uhpmax += hpinc;
|
||||
if (u.uhpmax > u.uhppeak)
|
||||
u.uhppeak = u.uhpmax;
|
||||
u.uhp += hpinc;
|
||||
|
||||
/* increase spell power/energy points */
|
||||
eninc = newpw();
|
||||
u.uenmax += eninc;
|
||||
if (u.uenmax > u.uenpeak)
|
||||
u.uenpeak = u.uenmax;
|
||||
u.uen += eninc;
|
||||
|
||||
/* increase level (unless already maxxed) */
|
||||
|
||||
@@ -1953,6 +1953,8 @@ doseduce(struct monst *mon)
|
||||
You_feel("raised to your full potential.");
|
||||
exercise(A_CON, TRUE);
|
||||
u.uen = (u.uenmax += rnd(5));
|
||||
if (u.uenmax > u.uenpeak)
|
||||
u.uenpeak = u.uenmax;
|
||||
break;
|
||||
case 1:
|
||||
You_feel("good enough to do it again.");
|
||||
|
||||
10
src/potion.c
10
src/potion.c
@@ -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:
|
||||
|
||||
@@ -387,6 +387,8 @@ fix_worst_trouble(int trouble)
|
||||
u.uhpmax += rnd(5);
|
||||
if (u.uhpmax <= 5)
|
||||
u.uhpmax = 5 + 1;
|
||||
if (u.uhpmax > u.uhppeak)
|
||||
u.uhppeak = u.uhpmax;
|
||||
u.uhp = u.uhpmax;
|
||||
g.context.botl = 1;
|
||||
break;
|
||||
@@ -1087,6 +1089,8 @@ pleased(aligntyp g_align)
|
||||
pluslvl(FALSE);
|
||||
} else {
|
||||
u.uhpmax += 5;
|
||||
if (u.uhpmax > u.uhppeak)
|
||||
u.uhppeak = u.uhpmax;
|
||||
if (Upolyd)
|
||||
u.mhmax += 5;
|
||||
}
|
||||
|
||||
@@ -185,8 +185,11 @@ dosit(void)
|
||||
u.mhmax += 4;
|
||||
u.mh = u.mhmax;
|
||||
}
|
||||
if (u.uhp >= (u.uhpmax - 5))
|
||||
if (u.uhp >= (u.uhpmax - 5)) {
|
||||
u.uhpmax += 4;
|
||||
if (u.uhpmax > u.uhppeak)
|
||||
u.uhppeak = u.uhpmax;
|
||||
}
|
||||
u.uhp = u.uhpmax;
|
||||
u.ucreamed = 0;
|
||||
make_blinded(0L, TRUE);
|
||||
|
||||
@@ -1959,6 +1959,8 @@ trapeffect_magic_trap(
|
||||
losehp(rnd(10), "magical explosion", KILLED_BY_AN);
|
||||
Your("body absorbs some of the magical energy!");
|
||||
u.uen = (u.uenmax += 2);
|
||||
if (u.uenmax > u.uenpeak)
|
||||
u.uenpeak = u.uenmax;
|
||||
return 0;
|
||||
} else {
|
||||
domagictrap();
|
||||
|
||||
@@ -661,8 +661,8 @@ u_init(void)
|
||||
set_uasmon();
|
||||
|
||||
u.ulevel = 0; /* set up some of the initial attributes */
|
||||
u.uhp = u.uhpmax = newhp();
|
||||
u.uen = u.uenmax = newpw();
|
||||
u.uhp = u.uhpmax = u.uhppeak = newhp();
|
||||
u.uen = u.uenmax = u.uenpeak = newpw();
|
||||
u.uspellprot = 0;
|
||||
adjabil(0, 1);
|
||||
u.ulevel = u.ulevelmax = 1;
|
||||
|
||||
@@ -3662,8 +3662,11 @@ mhitm_ad_heal(struct monst *magr, struct attack *mattk, struct monst *mdef,
|
||||
u.uhp += rnd(7);
|
||||
if (!rn2(7)) {
|
||||
/* 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++;
|
||||
if (u.uhpmax > u.uhppeak)
|
||||
u.uhppeak = u.uhpmax;
|
||||
}
|
||||
if (!rn2(13))
|
||||
goaway = TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user