MCPcopy Index your code
hub / github.com/NetHack/NetHack / rehumanize

Function rehumanize

src/polyself.c:1366–1418  ·  view source on GitHub ↗

return to original form, usually either due to polymorph timing out or dying from loss of hit points while being polymorphed */

Source from the content-addressed store, hash-verified

1364/* return to original form, usually either due to polymorph timing out
1365 or dying from loss of hit points while being polymorphed */
1366void
1367rehumanize(void)
1368{
1369 boolean was_flying = (Flying != 0);
1370
1371 /* You can't revert back while unchanging */
1372 if (Unchanging) {
1373 if (u.mh < 1) {
1374 svk.killer.format = NO_KILLER_PREFIX;
1375 Strcpy(svk.killer.name, "killed while stuck in creature form");
1376 done(DIED);
1377 /* can get to here if declining to die in explore or wizard
1378 mode; since we're wearing an amulet of unchanging we can't
1379 be wearing an amulet of life-saving */
1380 return; /* don't rehumanize after all */
1381 } else if (uamul && uamul->otyp == AMULET_OF_UNCHANGING) {
1382 Your("%s %s!", simpleonames(uamul), otense(uamul, "fail"));
1383 observe_object(uamul);
1384 makeknown(AMULET_OF_UNCHANGING);
1385 }
1386 }
1387
1388 /*
1389 * Right now, dying while being a shifted vampire (bat, cloud, wolf)
1390 * reverts to human rather than to vampire.
1391 */
1392
1393 if (emits_light(gy.youmonst.data))
1394 del_light_source(LS_MONSTER, monst_to_any(&gy.youmonst));
1395 polyman("You return to %s form!", gu.urace.adj);
1396
1397 if (u.uhp < 1) {
1398 /* can only happen if some bit of code reduces u.uhp
1399 instead of u.mh while poly'd */
1400 Your("old form was not healthy enough to survive.");
1401 Sprintf(svk.killer.name, "reverting to unhealthy %s form",
1402 gu.urace.adj);
1403 svk.killer.format = KILLED_BY;
1404 done(DIED);
1405 }
1406 nomul(0);
1407
1408 disp.botl = TRUE;
1409 gv.vision_full_recalc = 1;
1410 encumber_msg();
1411 update_inventory();
1412 if (was_flying && !Flying && u.usteed)
1413 You("and %s return gently to the %s.",
1414 mon_nam(u.usteed), surface(u.ux, u.uy));
1415 retouch_equipment(2);
1416 if (!uarmg)
1417 selftouch(no_longer_petrify_resistant);
1418}
1419
1420int
1421dobreathe(void)

Callers 15

regen_hpFunction · 0.85
losexpFunction · 0.85
mhitm_ad_rustFunction · 0.85
mhitm_ad_dcayFunction · 0.85
mhitm_ad_fireFunction · 0.85
mhitm_ad_cursFunction · 0.85
hmonasFunction · 0.85
touch_of_deathFunction · 0.85
you_unwereFunction · 0.85
domove_fight_emptyFunction · 0.85
losehpFunction · 0.85
nh_timeoutFunction · 0.85

Calls 15

doneFunction · 0.85
YourFunction · 0.85
simpleonamesFunction · 0.85
otenseFunction · 0.85
observe_objectFunction · 0.85
del_light_sourceFunction · 0.85
monst_to_anyFunction · 0.85
polymanFunction · 0.85
nomulFunction · 0.85
encumber_msgFunction · 0.85
update_inventoryFunction · 0.85
YouFunction · 0.85

Tested by

no test coverage detected