life-saving bits (trunk only)
A couple of things noticed when looking at the death-by-brainlessness
code. The 3.4.3 code ran a loop while life-saving was keeping the hero
alive, which would work if someone added other sources of life-saving than
the amulet but not if they added some form which didn't get used up when
it kicked in. Post-3.4.3, the dev code eliminated the loop but was no
longer guarding against additional forms of life-saving. This attempts to
clear the relevant field once any form of life-saving takes effect (for
brainlessness). It's not perfect since someone could change `Lifesaved'
to look at something other than the hero's properties, but at least it
still avoids the risk of getting stuck in a loop if someone makes a really
bad customization.
Also, make life-saving use min(2*level,10) instead of flat 10 for
amulet or 8*level for explore/wizard survival when it saves someone whose
max HP have been clobbered somehow. Other places assume that 1 HP per
level is the lowest the hero will have; saved-life gives a modest bit more.
Lastly, some post-3.4.3 code to make ghosts/shades immune to brain
sucking was using mon_nam() to start a sentence; Monnam() is needed there.
This commit is contained in:
@@ -471,7 +471,7 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
|
||||
if (noncorporeal(pd)) {
|
||||
if (visflag)
|
||||
pline("%s brain is unharmed.",
|
||||
(mdef == &youmonst) ? "Your" : s_suffix(mon_nam(mdef)));
|
||||
(mdef == &youmonst) ? "Your" : s_suffix(Monnam(mdef)));
|
||||
return MM_MISS; /* side-effects can't occur */
|
||||
} else if (magr == &youmonst) {
|
||||
You("eat %s brain!", s_suffix(mon_nam(mdef)));
|
||||
@@ -555,6 +555,9 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
|
||||
done(DIED);
|
||||
/* amulet of life saving has now been used up */
|
||||
pline("Unfortunately your brain is still gone.");
|
||||
/* sanity check against adding other forms of life-saving */
|
||||
u.uprops[LIFESAVED].extrinsic =
|
||||
u.uprops[LIFESAVED].intrinsic = 0L;
|
||||
} else {
|
||||
Your("last thought fades away.");
|
||||
}
|
||||
|
||||
@@ -422,8 +422,11 @@ STATIC_OVL void
|
||||
savelife(how)
|
||||
int how;
|
||||
{
|
||||
u.uswldtim = 0;
|
||||
int uhpmin = max(2 * u.ulevel, 10);
|
||||
|
||||
if (u.uhpmax < uhpmin) u.uhpmax = uhpmin;
|
||||
u.uhp = u.uhpmax;
|
||||
u.uswldtim = 0;
|
||||
if (u.uhunger < 500) {
|
||||
u.uhunger = 500;
|
||||
newuhs(FALSE);
|
||||
@@ -611,7 +614,6 @@ int how;
|
||||
if (uamul) useup(uamul);
|
||||
|
||||
(void) adjattrib(A_CON, -1, TRUE);
|
||||
if(u.uhpmax <= 0) u.uhpmax = 10; /* arbitrary */
|
||||
savelife(how);
|
||||
if (how == GENOCIDED)
|
||||
pline("Unfortunately you are still genocided...");
|
||||
@@ -629,7 +631,6 @@ int how;
|
||||
if(yn("Die?") == 'y') goto die;
|
||||
pline("OK, so you don't %s.",
|
||||
(how == CHOKING) ? "choke" : "die");
|
||||
if(u.uhpmax <= 0) u.uhpmax = u.ulevel * 8; /* arbitrary */
|
||||
savelife(how);
|
||||
killer.name[0] = 0;
|
||||
killer.format = 0;
|
||||
|
||||
Reference in New Issue
Block a user