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

Function setuhpmax

src/attrib.c:1156–1176  ·  view source on GitHub ↗

update u.uhpmax or u.mhmax and values of other things that depend upon whichever of them is relevant */

Source from the content-addressed store, hash-verified

1154/* update u.uhpmax or u.mhmax and values of other things that depend upon
1155 whichever of them is relevant */
1156void
1157setuhpmax(int newmax, boolean even_when_polyd)
1158{
1159 if (!Upolyd || even_when_polyd) {
1160 if (newmax != u.uhpmax) {
1161 u.uhpmax = newmax;
1162 if (u.uhpmax > u.uhppeak)
1163 u.uhppeak = u.uhpmax;
1164 disp.botl = TRUE;
1165 }
1166 if (u.uhp > u.uhpmax)
1167 u.uhp = u.uhpmax, disp.botl = TRUE;
1168 } else { /* Upolyd */
1169 if (newmax != u.mhmax) {
1170 u.mhmax = newmax;
1171 disp.botl = TRUE;
1172 }
1173 if (u.mh > u.mhmax)
1174 u.mh = u.mhmax, disp.botl = TRUE;
1175 }
1176}
1177
1178/* called after setuhpmax() when damage is pending;
1179 if uhpmax (or mhmax) has been reduced, it might have caused uhp (or mh)

Callers 10

savelifeFunction · 0.85
losexpFunction · 0.85
pluslvlFunction · 0.85
touch_of_deathFunction · 0.85
fix_worst_troubleFunction · 0.85
losestrFunction · 0.85
poisonedFunction · 0.85
newmanFunction · 0.85
fpostfxFunction · 0.85
dofiretrapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected