]> granicus.if.org Git - nethack/commitdiff
Add new hallucinatory gods.
authorSean Hunt <scshunt@csclub.uwaterloo.ca>
Sun, 29 Mar 2015 23:10:46 +0000 (19:10 -0400)
committerSean Hunt <scshunt@csclub.uwaterloo.ca>
Sun, 29 Mar 2015 23:10:46 +0000 (19:10 -0400)
doc/fixes35.0
src/pray.c

index 03cb10a960613bfc97feaf40da212e394a49a384..50748076870eef7761dbe7821fb6b168081c90db 100644 (file)
@@ -1108,6 +1108,7 @@ allow reading many more items
 when you're hiding under something a zap downward should not hit that
        something, while a zap upward should
 show more explicit reason why player was helpless at death
+added new hallucinatory-only gods
 
 
 Platform- and/or Interface-Specific New Features
index bd95018c408943468f43ca21c83aa9f289e8c1c7..20e5d348d5fcc6c8b96c15153db1a366a4e0b902 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.5 pray.c  $NHDT-Date$  $NHDT-Branch$:$NHDT-Revision$ */
+/* NetHack 3.5 pray.c  $NHDT-Date: 1427670643 2015/03/29 23:10:43 $  $NHDT-Branch: master $:$NHDT-Revision: 1.69 $ */
 /* NetHack 3.5 pray.c  $Date: 2012/05/07 01:44:38 $  $Revision: 1.62 $ */
 /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1863,26 +1863,70 @@ aligntyp alignment;
     return gnam;
 }
 
+static const char *hallu_gods[] = {
+    "the Flying Spaghetti Monster",     /* Church of the FSM */
+    "Eris",     /* Discordianism */
+    "the Martians",     /* every science fiction ever */
+    "Xom",      /* Crawl */
+    "AnDoR dRaKoN",     /* ADOM */
+    "the Central Bank of Yendor",       /* economics */
+    "Tooth Fairy",      /* real world(?) */
+    "Om",       /* Discworld */
+    "Yawgmoth", /* Magic: the Gathering */
+    "Morgoth", /* LoTR */
+    "Cthulhu", /* Lovecraft */
+    "the Ori", /* Stargate */
+    "destiny", /* why not? */
+    "your Friend the Computer", /* Paranoia */
+};
+
 /* hallucination handling for priest/minion names: select a random god
    iff character is hallucinating */
 const char *
 halu_gname(alignment)
 aligntyp alignment;
 {
-    const char *gnam;
+    const char *gnam = NULL;
     int which;
 
-    if (!Hallucination) return align_gname(alignment);
-
-    which = randrole();
-    switch (rn2(3)) {
-     case 0:   gnam = roles[which].lgod; break;
-     case 1:   gnam = roles[which].ngod; break;
-     case 2:   gnam = roles[which].cgod; break;
-     default:  gnam = 0; break;                /* lint suppression */
+    if (!Hallucination)
+        return align_gname(alignment);
+
+    /* The priest may not have initialized god names. If this is the
+     * case, and we roll priest, we need to try again. */
+    do
+        which = randrole();
+    while (!roles[which].lgod);
+
+    switch (rn2(9)) {
+    case 0:
+    case 1:
+        gnam = roles[which].lgod;
+        break;
+    case 2:
+    case 3:
+        gnam = roles[which].ngod;
+        break;
+    case 4:
+    case 5:
+        gnam = roles[which].cgod;
+        break;
+    case 6:
+    case 7:
+        gnam = hallu_gods[rn2(sizeof hallu_gods / sizeof *hallu_gods)];
+        break;
+    case 8:
+        gnam = Moloch;
+        break;
+    default:
+        impossible("rn2 broken in halu_gname?!?");
     }
-    if (!gnam) gnam = Moloch;
-    if (*gnam == '_') ++gnam;
+    if (!gnam) {
+        impossible("No random god name?");
+        gnam = "your Friend the Computer"; /* Paranoia */
+    }
+    if (*gnam == '_')
+        ++gnam;
     return gnam;
 }