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.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user