wizard mode polyself to "priest"

When polymorphing while already polymorphed, picking your own role
will rehumanize (wizard mode only; restores old characteristics and
experience level, unlike becoming a new man which can change those
and even be fatal if level drops below 1).  But it didn't work if
you were a priest or priestess because name_to_mon() yields aligned
cleric monster rather than cleric role.
This commit is contained in:
PatR
2021-12-08 16:08:57 -08:00
parent 5ce53f4d17
commit a80969f280
2 changed files with 13 additions and 2 deletions

View File

@@ -397,7 +397,7 @@ newman(void)
void
polyself(int psflags)
{
char buf[BUFSZ] = DUMMY;
char buf[BUFSZ];
int old_light, new_light, mntmp, class, tryct, gvariant = NEUTRAL;
boolean forcecontrol = (psflags == 1),
monsterpoly = (psflags == 2),
@@ -434,6 +434,7 @@ polyself(int psflags)
goto do_vampyr;
if (controllable_poly || forcecontrol) {
buf[0] = '\0';
tryct = 5;
do {
mntmp = NON_PM;
@@ -467,7 +468,14 @@ polyself(int psflags)
pline("I've never heard of such monsters.");
else
You_cant("polymorph into any of those.");
} else if (wizard && Upolyd && mntmp == u.umonster) {
} else if (wizard && Upolyd
&& (mntmp == u.umonster
/* "priest" and "priestess" match the monster
rather than the role; override that unless
the text explicitly contains "aligned" */
|| (u.umonster == PM_CLERIC
&& mntmp == PM_ALIGNED_CLERIC
&& !strstri(buf, "aligned")))) {
/* in wizard mode, picking own role while poly'd reverts to
normal without newman()'s chance of level or sex change */
rehumanize();