hallucination handling for priest/minion names: select a random god iff character is hallucinating */
| 2574 | /* hallucination handling for priest/minion names: select a random god |
| 2575 | iff character is hallucinating */ |
| 2576 | const char * |
| 2577 | halu_gname(aligntyp alignment) |
| 2578 | { |
| 2579 | const char *gnam = NULL; |
| 2580 | int which; |
| 2581 | |
| 2582 | if (!Hallucination) |
| 2583 | return align_gname(alignment); |
| 2584 | |
| 2585 | /* Some roles (Priest) don't have a pantheon unless we're playing as |
| 2586 | that role, so keep trying until we get a role which does have one. |
| 2587 | [If playing a Priest, the current pantheon will be twice as likely |
| 2588 | to get picked as any of the others. That's not significant enough |
| 2589 | to bother dealing with.] */ |
| 2590 | do |
| 2591 | which = randrole(TRUE); |
| 2592 | while (!roles[which].lgod); |
| 2593 | |
| 2594 | switch (rn2_on_display_rng(9)) { |
| 2595 | case 0: |
| 2596 | case 1: |
| 2597 | gnam = roles[which].lgod; |
| 2598 | break; |
| 2599 | case 2: |
| 2600 | case 3: |
| 2601 | gnam = roles[which].ngod; |
| 2602 | break; |
| 2603 | case 4: |
| 2604 | case 5: |
| 2605 | gnam = roles[which].cgod; |
| 2606 | break; |
| 2607 | case 6: |
| 2608 | case 7: |
| 2609 | gnam = hallu_gods[rn2_on_display_rng(SIZE(hallu_gods))]; |
| 2610 | break; |
| 2611 | case 8: |
| 2612 | gnam = Moloch; |
| 2613 | break; |
| 2614 | default: |
| 2615 | impossible("rn2 broken in halu_gname?!?"); |
| 2616 | } |
| 2617 | if (!gnam) { |
| 2618 | impossible("No random god name?"); |
| 2619 | gnam = "your Friend the Computer"; /* Paranoia */ |
| 2620 | } |
| 2621 | if (*gnam == '_') |
| 2622 | ++gnam; |
| 2623 | return gnam; |
| 2624 | } |
| 2625 | |
| 2626 | /* deity's title */ |
| 2627 | const char * |
no test coverage detected