(try to) make a mntmp monster out of the player; return 1 if successful */
| 732 | |
| 733 | /* (try to) make a mntmp monster out of the player; return 1 if successful */ |
| 734 | int |
| 735 | polymon(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) { |
no test coverage detected