MCPcopy Create free account
hub / github.com/NetHack/NetHack / tt_doppel

Function tt_doppel

src/topten.c:1444–1464  ·  view source on GitHub ↗

Randomly select a topten entry to mimic */

Source from the content-addressed store, hash-verified

1442
1443/* Randomly select a topten entry to mimic */
1444int
1445tt_doppel(struct monst *mon) {
1446 struct toptenentry *tt = rn2(13) ? get_rnd_toptenentry() : NULL;
1447 int ret;
1448
1449 if (!tt)
1450 ret = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST);
1451 else {
1452 if (tt->plgend[0] == 'F')
1453 mon->female = 1;
1454 else if (tt->plgend[0] == 'M')
1455 mon->female = 0;
1456 ret = classmon(tt->plrole);
1457 /* Only take on a name if the player can see
1458 the doppelganger, otherwise we end up with
1459 named monsters spoiling the fun - Kes */
1460 if (canseemon(mon))
1461 christen_monst(mon, tt->name);
1462 }
1463 return ret;
1464}
1465
1466#ifdef NO_SCAN_BRACK
1467/* Lattice scanf isn't up to reading the scorefile. What */

Callers 1

select_newcham_formFunction · 0.85

Calls 5

rn2Function · 0.85
get_rnd_toptenentryFunction · 0.85
classmonFunction · 0.85
canseemonFunction · 0.85
christen_monstFunction · 0.85

Tested by

no test coverage detected