* The player is trying to extract something from his/her instrument. */
| 500 | * The player is trying to extract something from his/her instrument. |
| 501 | */ |
| 502 | staticfn int |
| 503 | do_improvisation(struct obj *instr) |
| 504 | { |
| 505 | int damage, mode, do_spec = !(Stunned || Confusion); |
| 506 | struct obj itmp; |
| 507 | boolean mundane = FALSE, same_old_song = FALSE; |
| 508 | static char my_goto_song[] = {'C', '\0'}, |
| 509 | *improvisation = my_goto_song; |
| 510 | |
| 511 | itmp = *instr; |
| 512 | itmp.oextra = (struct oextra *) 0; /* ok on this copy as instr maintains |
| 513 | * the ptr to free at some point if |
| 514 | * there is one */ |
| 515 | |
| 516 | /* if won't yield special effect, make sound of mundane counterpart */ |
| 517 | if (!do_spec || instr->spe <= 0) |
| 518 | while (objects[itmp.otyp].oc_magic) { |
| 519 | itmp.otyp -= 1; |
| 520 | mundane = TRUE; |
| 521 | } |
| 522 | |
| 523 | #define PLAY_NORMAL 0x00 |
| 524 | #define PLAY_STUNNED 0x01 |
| 525 | #define PLAY_CONFUSED 0x02 |
| 526 | #define PLAY_HALLU 0x04 |
| 527 | mode = PLAY_NORMAL; |
| 528 | if (Stunned) |
| 529 | mode |= PLAY_STUNNED; |
| 530 | if (Confusion) |
| 531 | mode |= PLAY_CONFUSED; |
| 532 | if (Hallucination) |
| 533 | mode |= PLAY_HALLU; |
| 534 | |
| 535 | if (!rn2(2)) { |
| 536 | /* |
| 537 | * TEMPORARY? for multiple impairments, don't always |
| 538 | * give the generic "it's far from music" message. |
| 539 | */ |
| 540 | /* remove if STUNNED+CONFUSED ever gets its own message below */ |
| 541 | if (mode == (PLAY_STUNNED | PLAY_CONFUSED)) |
| 542 | mode = !rn2(2) ? PLAY_STUNNED : PLAY_CONFUSED; |
| 543 | /* likewise for stunned and/or confused combined with hallucination */ |
| 544 | if (mode & PLAY_HALLU) |
| 545 | mode = PLAY_HALLU; |
| 546 | } |
| 547 | |
| 548 | /* 3.6.3: most of these gave "You produce <blah>" and then many of |
| 549 | the instrument-specific messages below which immediately follow |
| 550 | also gave "You produce <something>." That looked strange so we |
| 551 | now use a different verb here */ |
| 552 | switch (mode) { |
| 553 | case PLAY_NORMAL: |
| 554 | You("start playing %s.", yname(instr)); |
| 555 | break; |
| 556 | case PLAY_STUNNED: |
| 557 | if (!Deaf) |
| 558 | You("radiate an obnoxious droning sound."); |
| 559 | else |
no test coverage detected