Doppelgangers mimic top ten list members.

I saw this in the YANI archive, and I think it's fairly interesting.
Doppelgangers are known for commiting identity theft, but in NetHack
they function as just another shapeshifter. This commit makes them
a bit more interesting, I think.

Original YANI by aosdict and Andrio.
This commit is contained in:
Kestrel Gregorich-Trevor
2023-04-06 13:13:56 -05:00
committed by PatR
parent ad01b23090
commit 8e43b684e8
3 changed files with 25 additions and 1 deletions

View File

@@ -2882,6 +2882,7 @@ extern void topten(int, time_t);
extern void prscore(int, char **);
extern struct toptenentry *get_rnd_toptenentry(void);
extern struct obj *tt_oname(struct obj *);
extern int tt_doppel(struct monst *);
/* ### track.c ### */

View File

@@ -4605,7 +4605,7 @@ select_newcham_form(struct monst* mon)
if (!rn2(7)) {
mndx = pick_nasty(mons[PM_JABBERWOCK].difficulty - 1);
} else if (rn2(3)) { /* role monsters */
mndx = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST);
mndx = tt_doppel(mon);
} else if (!rn2(3)) { /* quest guardians */
mndx = rn1(PM_APPRENTICE - PM_STUDENT + 1, PM_STUDENT);
/* avoid own role's guardian */

View File

@@ -1432,6 +1432,29 @@ tt_oname(struct obj *otmp)
return otmp;
}
/* Randomly select a topten entry to mimic */
int
tt_doppel(struct monst *mon) {
struct toptenentry *tt = get_rnd_toptenentry();
int ret;
if (!tt)
ret = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST);
else {
if (tt->plgend[0] == 'F')
mon->female = 1;
else if (tt->plgend[0] == 'M')
mon->female = 0;
ret = classmon(tt->plrole);
/* Only take on a name if the player can see
the doppelganger, otherwise we end up with
named monsters spoiling the fun - Kes */
if (canseemon(mon))
christen_monst(mon, tt->name);
}
return ret;
}
#ifdef NO_SCAN_BRACK
/* Lattice scanf isn't up to reading the scorefile. What */
/* follows deals with that; I admit it's ugly. (KL) */