Saving grace
Once per game, if receiving a killing blow from above 90% HP, allow the hero to survive with 1 HP.
This commit is contained in:
@@ -1115,6 +1115,7 @@ give feedback when some types of damage are avoided due to MC (aka negation)
|
|||||||
feedback if a named, shape-shifted vampire reverted to original shape rather
|
feedback if a named, shape-shifted vampire reverted to original shape rather
|
||||||
than dying when engulfed could say "Dracula turns into Dracula"
|
than dying when engulfed could say "Dracula turns into Dracula"
|
||||||
adjust archeologist and valkyrie starting intrinsics
|
adjust archeologist and valkyrie starting intrinsics
|
||||||
|
once per game if receiving killing blow from near-full hp, leave 1 hp
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||||
|
|||||||
@@ -987,6 +987,7 @@ extern int monster_nearby(void);
|
|||||||
extern void end_running(boolean);
|
extern void end_running(boolean);
|
||||||
extern void nomul(int);
|
extern void nomul(int);
|
||||||
extern void unmul(const char *);
|
extern void unmul(const char *);
|
||||||
|
extern int saving_grace(int);
|
||||||
extern void losehp(int, const char *, schar);
|
extern void losehp(int, const char *, schar);
|
||||||
extern int weight_cap(void);
|
extern int weight_cap(void);
|
||||||
extern int inv_weight(void);
|
extern int inv_weight(void);
|
||||||
|
|||||||
@@ -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 75
|
#define EDITLEVEL 76
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Development status possibilities.
|
* Development status possibilities.
|
||||||
|
|||||||
+1
-1
@@ -419,7 +419,7 @@ struct you {
|
|||||||
Bitfield(uinvulnerable, 1); /* you're invulnerable (praying) */
|
Bitfield(uinvulnerable, 1); /* you're invulnerable (praying) */
|
||||||
Bitfield(uburied, 1); /* you're buried */
|
Bitfield(uburied, 1); /* you're buried */
|
||||||
Bitfield(uedibility, 1); /* blessed food detect; sense unsafe food */
|
Bitfield(uedibility, 1); /* blessed food detect; sense unsafe food */
|
||||||
/* 1 free bit! */
|
Bitfield(usaving_grace, 1); /* prevents death once */
|
||||||
|
|
||||||
unsigned udg_cnt; /* how long you have been demigod */
|
unsigned udg_cnt; /* how long you have been demigod */
|
||||||
struct u_event uevent; /* certain events have happened */
|
struct u_event uevent; /* certain events have happened */
|
||||||
|
|||||||
+14
@@ -3711,6 +3711,19 @@ maybe_wail(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* once per game, if receiving a killing blow from above 90% HP,
|
||||||
|
allow the hero to survive with 1 HP */
|
||||||
|
int
|
||||||
|
saving_grace(int dmg)
|
||||||
|
{
|
||||||
|
if (!u.usaving_grace && (u.uhp <= dmg)
|
||||||
|
&& (u.uhp * 100 / u.uhpmax) > 90) {
|
||||||
|
dmg = u.uhp - 1;
|
||||||
|
u.usaving_grace = TRUE; /* used up */
|
||||||
|
}
|
||||||
|
return dmg;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
losehp(int n, const char *knam, schar k_format)
|
losehp(int n, const char *knam, schar k_format)
|
||||||
{
|
{
|
||||||
@@ -3734,6 +3747,7 @@ losehp(int n, const char *knam, schar k_format)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n = saving_grace(n);
|
||||||
u.uhp -= n;
|
u.uhp -= n;
|
||||||
if (u.uhp > u.uhpmax)
|
if (u.uhp > u.uhpmax)
|
||||||
u.uhpmax = u.uhp; /* perhaps n was negative */
|
u.uhpmax = u.uhp; /* perhaps n was negative */
|
||||||
|
|||||||
@@ -1753,6 +1753,7 @@ mdamageu(struct monst *mtmp, int n)
|
|||||||
if (u.mh < 1)
|
if (u.mh < 1)
|
||||||
rehumanize();
|
rehumanize();
|
||||||
} else {
|
} else {
|
||||||
|
n = saving_grace(n);
|
||||||
u.uhp -= n;
|
u.uhp -= n;
|
||||||
if (u.uhp < 1)
|
if (u.uhp < 1)
|
||||||
done_in_by(mtmp, DIED);
|
done_in_by(mtmp, DIED);
|
||||||
|
|||||||
Reference in New Issue
Block a user