From a80969f28038403620c4822b308a4586dda696c4 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 8 Dec 2021 16:08:57 -0800 Subject: [PATCH] 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. --- doc/fixes37.0 | 3 +++ src/polyself.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index ec27be6e5..175c0ee9b 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -920,6 +920,9 @@ unpaid shop-owned glob that shrank to nothing had weight 0 which triggered billing, the empty weight was shown to player if 'wizweight' was On if 'showrace' was On and invisible hero couldn't see invisible so didn't see self, the color of wharever could be seen underneath changed to white +in wizard mode, a poly'd priest/priestess attempting to polymorph into priest + or priestess in order to rehumanize became a new man or woman instead + because "priest" matched "aligned cleric" rather than the role monster curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/polyself.c b/src/polyself.c index e3c8925b0..38f9624c5 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -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();