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

Function create_critters

src/makemon.c:1555–1590  ·  view source on GitHub ↗

used for wand/scroll/spell of create monster */ returns TRUE iff you know monsters have been created */

Source from the content-addressed store, hash-verified

1553/* used for wand/scroll/spell of create monster */
1554/* returns TRUE iff you know monsters have been created */
1555boolean
1556create_critters(
1557 int cnt,
1558 struct permonst *mptr, /* usually null; used for confused reading */
1559 boolean neverask)
1560{
1561 coord c;
1562 coordxy x, y;
1563 struct monst *mon;
1564 boolean known = FALSE;
1565 boolean ask = (wizard && !neverask);
1566
1567 while (cnt--) {
1568 if (ask) {
1569 if (create_particular()) {
1570 known = TRUE;
1571 continue;
1572 } else
1573 ask = FALSE; /* ESC will shut off prompting */
1574 }
1575 x = u.ux, y = u.uy;
1576 /* if in water, try to encourage an aquatic monster
1577 by finding and then specifying another wet location */
1578 if (!mptr && u.uinwater && enexto(&c, x, y, &mons[PM_GIANT_EEL]))
1579 x = c.x, y = c.y;
1580
1581 if ((mon = makemon(mptr, x, y, NO_MM_FLAGS)) == 0)
1582 continue; /* try again [should probably stop instead] */
1583
1584 if ((canseemon(mon) && (M_AP_TYPE(mon) == M_AP_NOTHING
1585 || M_AP_TYPE(mon) == M_AP_MONSTER))
1586 || sensemon(mon))
1587 known = TRUE;
1588 }
1589 return known;
1590}
1591
1592staticfn boolean
1593uncommon(int mndx)

Callers 2

zapnodirFunction · 0.85
seffect_create_monsterFunction · 0.85

Calls 5

create_particularFunction · 0.85
enextoFunction · 0.85
makemonFunction · 0.85
canseemonFunction · 0.85
sensemonFunction · 0.85

Tested by

no test coverage detected