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

Function polymon

src/polyself.c:734–1071  ·  view source on GitHub ↗

(try to) make a mntmp monster out of the player; return 1 if successful */

Source from the content-addressed store, hash-verified

732
733/* (try to) make a mntmp monster out of the player; return 1 if successful */
734int
735polymon(int mntmp)
736{
737 char buf[BUFSZ], ustuckNam[BUFSZ];
738 boolean sticking = sticks(gy.youmonst.data) && u.ustuck && !u.uswallow,
739 was_blind = !!Blind, dochange = FALSE, was_expelled = FALSE,
740 was_hiding_under = u.uundetected && hides_under(gy.youmonst.data);
741 int mlvl, newMaxStr;
742
743 if (svm.mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */
744 You_feel("rather %s-ish.",
745 pmname(&mons[mntmp], flags.female ? FEMALE : MALE));
746 exercise(A_WIS, TRUE);
747 return 0;
748 }
749
750 /* KMH, conduct */
751 if (!u.uconduct.polyselfs++)
752 livelog_printf(LL_CONDUCT,
753 "changed form for the first time, becoming %s",
754 an(pmname(&mons[mntmp], flags.female ? FEMALE : MALE)));
755
756 /* exercise used to be at the very end but only Wis was affected
757 there since the polymorph was always in effect by then */
758 exercise(A_CON, FALSE);
759 exercise(A_WIS, TRUE);
760
761 if (!Upolyd) {
762 /* Human to monster; save human stats */
763 u.macurr = u.acurr;
764 u.mamax = u.amax;
765 u.mfemale = flags.female;
766 } else {
767 /* Monster to monster; restore human stats, to be
768 * immediately changed to provide stats for the new monster
769 */
770 u.acurr = u.macurr;
771 u.amax = u.mamax;
772 flags.female = u.mfemale;
773 }
774
775 /* if stuck mimicking gold, stop immediately */
776 if (gm.multi < 0 && U_AP_TYPE == M_AP_OBJECT
777 && gy.youmonst.data->mlet != S_MIMIC)
778 unmul("");
779 /* if becoming a non-mimic, stop mimicking anything */
780 if (mons[mntmp].mlet != S_MIMIC) {
781 /* as in polyman() */
782 gy.youmonst.m_ap_type = M_AP_NOTHING;
783 gy.youmonst.mappearance = 0;
784 }
785 if (is_male(&mons[mntmp])) {
786 if (flags.female)
787 dochange = TRUE;
788 } else if (is_female(&mons[mntmp])) {
789 if (!flags.female)
790 dochange = TRUE;
791 } else if (!is_neuter(&mons[mntmp]) && mntmp != u.ulycn) {

Callers 15

theft_petrifiesFunction · 0.85
do_stone_uFunction · 0.85
passiveFunction · 0.85
use_saddleFunction · 0.85
you_wereFunction · 0.85
slimed_to_deathFunction · 0.85
toss_upFunction · 0.85
polyselfFunction · 0.85
fatal_corpse_mistakeFunction · 0.85
cprefxFunction · 0.85
fpostfxFunction · 0.85
instapetrifyFunction · 0.85

Calls 15

sticksFunction · 0.85
You_feelFunction · 0.85
pmnameFunction · 0.85
exerciseFunction · 0.85
livelog_printfFunction · 0.85
anFunction · 0.85
unmulFunction · 0.85
rn2Function · 0.85
Some_MonnamFunction · 0.85
YouFunction · 0.85
poly_when_stonedFunction · 0.85
make_stonedFunction · 0.85

Tested by

no test coverage detected