MCPcopy Create free account
hub / github.com/NetHack/NetHack / adjuhploss

Function adjuhploss

src/attrib.c:1181–1194  ·  view source on GitHub ↗

called after setuhpmax() when damage is pending; if uhpmax (or mhmax) has been reduced, it might have caused uhp (or mh) to be reduced too; if so, recalculate pending loss to account for that */

Source from the content-addressed store, hash-verified

1179 if uhpmax (or mhmax) has been reduced, it might have caused uhp (or mh)
1180 to be reduced too; if so, recalculate pending loss to account for that */
1181int
1182adjuhploss(
1183 int loss, /* pending hp loss */
1184 int olduhp) /* does double duty as oldmh when Upolyd */
1185{
1186 if (!Upolyd) {
1187 if (u.uhp < olduhp)
1188 loss -= (olduhp - u.uhp);
1189 } else {
1190 if (u.mh < olduhp)
1191 loss -= (olduhp - u.mh);
1192 }
1193 return max(loss, 1);
1194}
1195
1196/* return the current effective value of a specific characteristic
1197 (the 'a' in 'acurr()' comes from outdated use of "attribute" for the

Callers 2

touch_of_deathFunction · 0.85
poisonedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected