Unify HP loss and passing out from overexertion
This commit is contained in:
@@ -896,6 +896,7 @@ E int NDECL(wiz_debug_cmd_traveldisplay);
|
||||
#endif
|
||||
E boolean NDECL(u_rooted);
|
||||
E void NDECL(domove);
|
||||
E void NDECL(overexert_hp);
|
||||
E boolean NDECL(overexertion);
|
||||
E void NDECL(invocation_message);
|
||||
E void NDECL(switch_terrain);
|
||||
|
||||
@@ -215,17 +215,7 @@ boolean resuming;
|
||||
if (wtcap > MOD_ENCUMBER && u.umoved) {
|
||||
if (!(wtcap < EXT_ENCUMBER ? g.moves % 30
|
||||
: g.moves % 10)) {
|
||||
if (Upolyd && u.mh > 1) {
|
||||
u.mh--;
|
||||
g.context.botl = TRUE;
|
||||
} else if (!Upolyd && u.uhp > 1) {
|
||||
u.uhp--;
|
||||
g.context.botl = TRUE;
|
||||
} else {
|
||||
You("pass out from exertion!");
|
||||
exercise(A_CON, FALSE);
|
||||
fall_asleep(-10, FALSE);
|
||||
}
|
||||
overexert_hp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
26
src/hack.c
26
src/hack.c
@@ -2061,6 +2061,22 @@ int x1, y1, x2, y2;
|
||||
}
|
||||
}
|
||||
|
||||
/* HP loss or passing out from overexerting yourself */
|
||||
void
|
||||
overexert_hp()
|
||||
{
|
||||
int *hp = (!Upolyd ? &u.uhp : &u.mh);
|
||||
|
||||
if (*hp > 1) {
|
||||
*hp -= 1;
|
||||
g.context.botl = TRUE;
|
||||
} else {
|
||||
You("pass out from exertion!");
|
||||
exercise(A_CON, FALSE);
|
||||
fall_asleep(-10, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* combat increases metabolism */
|
||||
boolean
|
||||
overexertion()
|
||||
@@ -2070,15 +2086,7 @@ overexertion()
|
||||
execute if you decline to attack a peaceful monster */
|
||||
gethungry();
|
||||
if ((g.moves % 3L) != 0L && near_capacity() >= HVY_ENCUMBER) {
|
||||
int *hp = (!Upolyd ? &u.uhp : &u.mh);
|
||||
|
||||
if (*hp > 1) {
|
||||
*hp -= 1;
|
||||
} else {
|
||||
You("pass out from exertion!");
|
||||
exercise(A_CON, FALSE);
|
||||
fall_asleep(-10, FALSE);
|
||||
}
|
||||
overexert_hp();
|
||||
}
|
||||
return (boolean) (g.multi < 0); /* might have fainted (forced to sleep) */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user