MCPcopy Index your code
hub / github.com/NetHack/NetHack / ndemon

Function ndemon

src/minion.c:443–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441}
442
443int
444ndemon(aligntyp atyp) /* A_NONE is used for 'any alignment' */
445{
446 struct permonst *ptr;
447
448 /*
449 * 3.6.2: [fixed #H2204, 22-Dec-2010, eight years later...]
450 * pick a correctly aligned demon in one try. This used to
451 * use mkclass() to choose a random demon type and keep trying
452 * (up to 20 times) until it got one with the desired alignment.
453 * mkclass_aligned() skips wrongly aligned potential candidates.
454 * [The only neutral demons are djinni and mail daemon and
455 * mkclass() won't pick them, but call it anyway in case either
456 * aspect of that changes someday.]
457 */
458#if 0
459 if (atyp == A_NEUTRAL)
460 return NON_PM;
461#endif
462 ptr = mkclass_aligned(S_DEMON, 0, atyp);
463 return (ptr && is_ndemon(ptr)) ? monsndx(ptr) : NON_PM;
464}
465
466/* guardian angel has been affected by conflict so is abandoning hero */
467void

Callers 5

morguemonFunction · 0.85
demonpetFunction · 0.85
msummonFunction · 0.85
summon_minionFunction · 0.85
dlordFunction · 0.85

Calls 1

mkclass_alignedFunction · 0.85

Tested by

no test coverage detected