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

@@ -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) */