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

Function create_particular

src/read.c:3371–3408  ·  view source on GitHub ↗

* Make a new monster with the type controlled by the user. * * Note: when creating a monster by class letter, specifying the * "strange object" (']') symbol produces a random monster rather * than a mimic. This behavior quirk is useful so don't "fix" it * (use 'm'--or "mimic"--to create a random mimic). * * Used in wizard mode only (for ^G command and for scroll or spell * of create mons

Source from the content-addressed store, hash-verified

3369 * this code was also used for the scroll/spell in explore mode.
3370 */
3371boolean
3372create_particular(void)
3373{
3374#define CP_TRYLIM 5
3375 struct _create_particular_data d;
3376 char *bufp, buf[BUFSZ], prompt[QBUFSZ];
3377 int tryct = CP_TRYLIM, altmsg = 0;
3378
3379 buf[0] = '\0'; /* for EDIT_GETLIN */
3380 Strcpy(prompt, "Create what kind of monster?");
3381 do {
3382 getlin(prompt, buf);
3383 bufp = mungspaces(buf);
3384 if (*bufp == '\033')
3385 return FALSE;
3386
3387 if (create_particular_parse(bufp, &d))
3388 break;
3389
3390 /* no good; try again... */
3391 if (*bufp || altmsg || tryct < 2) {
3392 pline("I've never heard of such monsters.");
3393 } else {
3394 pline("Try again (type * for random, ESC to cancel).");
3395 ++altmsg;
3396 }
3397 /* when a second try is needed, expand the prompt */
3398 if (tryct == CP_TRYLIM)
3399 Strcat(prompt, " [type name or symbol]");
3400 } while (--tryct > 0);
3401
3402 if (!tryct)
3403 pline1(thats_enough_tries);
3404 else
3405 return create_particular_creation(&d);
3406
3407 return FALSE;
3408}
3409
3410/*read.c*/

Callers 2

wiz_genesisFunction · 0.85
create_crittersFunction · 0.85

Calls 5

getlinFunction · 0.85
mungspacesFunction · 0.85
create_particular_parseFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected