From 408a36bc5f2483fa1bc02c82fa8e77a4e3e3c5ae Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Wed, 31 Oct 2007 09:02:31 +0000 Subject: [PATCH] shapechanger's inventory (trunk only) Newsgroup discussion points out that a chameleon which starts out in nymph form also starts out with nymph's inventory (50% chance each for mirror and potion of object detection). That's not right; shapechanging shouldn't manufacture items. Also, the post-3.4.3 code to initialize vampires was overly complicated in order to preserve chameleon behavior, but the old chameleon initialization which used rndmonst() instead of selecting a preferred shape was just that way by accident (says the person who implemented preferred shapes however long ago and completely overlooked that at the time...). This is tricky to test; ^G these days forces a created shapechanger to start out in its natural form. That's a bit odd to begin with (a side- effect of transforming requests for uniques and other special monsters into doggelgangers), but downright strange when monpolycontrol is enabled; a prompt to pick monster shape is issued, then the player's choice gets overridden. I'm not sure which aspect, if any, of all this should be changed to fix a wizard mode quirk. --- doc/fixes35.0 | 1 + src/makemon.c | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 02e98a029..70dfff8a9 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -379,6 +379,7 @@ hallucination provides partial protection against gaze attacks attempting to read "dull" spellbook might cause hero to fall asleep dipping prompt is more precise using F to attack wall/boulder/statue while wielding pick digs/breaks target +shapechangers shouldn't receive starting inventory of their initial shape Platform- and/or Interface-Specific New Features diff --git a/src/makemon.c b/src/makemon.c index 58e33278d..5fe0e23b9 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1042,22 +1042,22 @@ register int mmflags; if ((mcham = pm_to_cham(mndx)) != NON_PM) { /* this is a shapechanger after all */ if (Protection_from_shape_changers) { - ; /* stuck in its natural form (NON_PM) */ - } else { - /* General shapechangers start out with random form - (this explicitly picks something from the normal - selection for current difficulty level rather - than from among shapechanger's preferred forms). - Vampires are the exception. */ - struct permonst *tmpcham = rndmonst(); - mtmp->cham = mcham; - if (is_vampshifter(mtmp)){ - int chamidx = select_newcham_form(mtmp); - if (chamidx != NON_PM) - tmpcham = &mons[chamidx]; - } - if (mtmp->cham != PM_VLAD_THE_IMPALER) - (void) newcham(mtmp,tmpcham,FALSE, FALSE); + ; /* stuck in its natural form (NON_PM) */ + } else { + /* Note: shapechanger's initial form used to be + chosen with rndmonst(), yielding a monster + which was approriate to the level's difficulty + but ignored the changer's usual type selection + so would be inppropriate for vampshifters. */ + mtmp->cham = mcham; /* remember base form */ + if (mcham != PM_VLAD_THE_IMPALER && + /* select initial shape */ + (mcham = select_newcham_form(mtmp)) != NON_PM) { + /* take on initial shape; if successful, + avoid giving that shape's usual inventory */ + if (newcham(mtmp, &mons[mcham], FALSE, FALSE)) + allow_minvent = FALSE; + } } } else if (mndx == PM_WIZARD_OF_YENDOR) { mtmp->iswiz = TRUE;