void rehumanize(void) { /* You can't revert back while unchanging */ if (Unchanging && (u.mh < 1)) { killer_format = NO_KILLER_PREFIX; killer = "killed while stuck in creature form"; done(DIED); } if (emits_light(youmonst.data)) del_light_source(level, LS_MONSTER, &youmonst); polyman("You return to %s form!", urace.adj); if (u.uhp < 1) { char kbuf[256]; sprintf(kbuf, "reverting to unhealthy %s form", urace.adj); killer_format = KILLED_BY; killer = kbuf; done(DIED); } if (!uarmg) selftouch("No longer petrify-resistant, you"); nomul(0, NULL); iflags.botl = 1; vision_full_recalc = 1; encumber_msg(); }
void rehumanize (void) { /* You can't revert back while unchanging */ if (Unchanging && (u.mh < 1)) { killer = killed_by_const(KM_WHILE_STUCK_IN_CREATURE_FORM); done(DIED); } if (emits_light(youmonst.data)) del_light_source(LS_MONSTER, (void *)&youmonst); polyman("return to %s form!", urace.adj); if (u.uhp < 1) { char kbuf[256]; sprintf(kbuf, "reverting to unhealthy %s form", urace.adj); fprintf(stderr, "TODO killer = %s\n", kbuf); done(DIED); } if (!uarmg) selftouch("No longer petrify-resistant, you"); nomul(0); vision_full_recalc = 1; (void) encumber_msg(); }
static void newman(void) { int tmp, oldlvl; tmp = u.uhpmax; oldlvl = u.ulevel; u.ulevel = u.ulevel + rn1(5, -2); if (u.ulevel > 127 || u.ulevel < 1) { /* level went below 0? */ u.ulevel = oldlvl; /* restore old level in case they lifesave */ goto dead; } if (u.ulevel > MAXULEV) u.ulevel = MAXULEV; /* If your level goes down, your peak level goes down by the same amount so that you can't simply use blessed full healing to undo the decrease. But if your level goes up, your peak level does *not* undergo the same adjustment; you might end up losing out on the chance to regain some levels previously lost to other causes. */ if (u.ulevel < oldlvl) u.ulevelmax -= (oldlvl - u.ulevel); if (u.ulevelmax < u.ulevel) u.ulevelmax = u.ulevel; if (!rn2(10)) change_sex(); adjabil(oldlvl, (int)u.ulevel); reset_rndmonst(NON_PM); /* new monster generation criteria */ /* random experience points for the new experience level */ u.uexp = rndexp(FALSE); /* u.uhpmax * u.ulevel / oldlvl: proportionate hit points to new level * -10 and +10: don't apply proportionate HP to 10 of a starting * character's hit points (since a starting character's hit points * are not on the same scale with hit points obtained through level * gain) * 9 - rn2(19): random change of -9 to +9 hit points */ u.uhpmax = ((u.uhpmax - 10) * (long)u.ulevel / oldlvl + 10) + (9 - rn2(19)); u.uhp = u.uhp * (long)u.uhpmax/tmp; tmp = u.uenmax; u.uenmax = u.uenmax * (long)u.ulevel / oldlvl + 9 - rn2(19); if (u.uenmax < 0) u.uenmax = 0; u.uen = (tmp ? u.uen * (long)u.uenmax / tmp : u.uenmax); redist_attr(); u.uhunger = rn1(500,500); if (Sick) make_sick(0L, NULL, FALSE, SICK_ALL); Stoned = 0; delayed_killer = 0; if (u.uhp <= 0 || u.uhpmax <= 0) { if (Polymorph_control) { if (u.uhp <= 0) u.uhp = 1; if (u.uhpmax <= 0) u.uhpmax = 1; } else { dead: /* we come directly here if their experience level went to 0 or less */ pline("Your new form doesn't seem healthy enough to survive."); killer_format = KILLED_BY_AN; killer="unsuccessful polymorph"; done(DIED); newuhs(FALSE); return; /* lifesaved */ } } newuhs(FALSE); polyman("You feel like a new %s!", (flags.female && urace.individual.f) ? urace.individual.f : (urace.individual.m) ? urace.individual.m : urace.noun); if (Slimed) { pline("Your body transforms, but there is still slime on you."); Slimed = 10L; } iflags.botl = 1; see_monsters(); encumber_msg(); }