* 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
| 3369 | * this code was also used for the scroll/spell in explore mode. |
| 3370 | */ |
| 3371 | boolean |
| 3372 | create_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*/ |
no test coverage detected