| 4253 | } |
| 4254 | |
| 4255 | void |
| 4256 | losehp(int n, const char *knam, schar k_format) |
| 4257 | { |
| 4258 | #if 0 /* code below is prepared to handle negative 'loss' so don't add this |
| 4259 | * until we've verified that no callers intentionally rely on that */ |
| 4260 | if (n <= 0) { |
| 4261 | impossible("hero losing %d hit points due to \"%s\"?", n, knam); |
| 4262 | return; |
| 4263 | } |
| 4264 | #endif |
| 4265 | disp.botl = TRUE; /* u.uhp or u.mh is changing */ |
| 4266 | end_running(TRUE); |
| 4267 | if (Upolyd) { |
| 4268 | u.mh -= n; |
| 4269 | showdamage(n); |
| 4270 | if (u.mhmax < u.mh) |
| 4271 | u.mhmax = u.mh; |
| 4272 | if (u.mh < 1) |
| 4273 | rehumanize(); |
| 4274 | else if (n > 0 && u.mh * 10 < u.mhmax && Unchanging) |
| 4275 | maybe_wail(); |
| 4276 | return; |
| 4277 | } |
| 4278 | |
| 4279 | u.uhp -= n; |
| 4280 | showdamage(n); |
| 4281 | if (u.uhp > u.uhpmax) |
| 4282 | u.uhpmax = u.uhp; /* perhaps n was negative */ |
| 4283 | if (u.uhp < 1) { |
| 4284 | svk.killer.format = k_format; |
| 4285 | if (svk.killer.name != knam) /* the thing that killed you */ |
| 4286 | Strcpy(svk.killer.name, knam ? knam : ""); |
| 4287 | urgent_pline("You die..."); |
| 4288 | done(DIED); |
| 4289 | } else if (n > 0 && u.uhp * 10 < u.uhpmax) { |
| 4290 | maybe_wail(); |
| 4291 | } |
| 4292 | } |
| 4293 | |
| 4294 | int |
| 4295 | weight_cap(void) |
no test coverage detected