OSDN Git Service

update year to 2020
[jnethack/source.git] / src / pray.c
index f69136c..06d097b 100644 (file)
@@ -1,10 +1,10 @@
-/* NetHack 3.6 pray.c  $NHDT-Date: 1446854232 2015/11/06 23:57:12 $  $NHDT-Branch: master $:$NHDT-Revision: 1.87 $ */
+/* NetHack 3.6 pray.c  $NHDT-Date: 1573346192 2019/11/10 00:36:32 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.118 $ */
 /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
 /* NetHack may be freely redistributed.  See license for details. */
 
 /* JNetHack Copyright */
 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
-/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016            */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2020            */
 /* JNetHack may be freely redistributed.  See license for details. */
 
 #include "hack.h"
@@ -151,6 +151,31 @@ boolean only_if_injured; /* determines whether maxhp <= 5 matters */
     return (boolean) (curhp <= 5 || curhp * divisor <= maxhp);
 }
 
+/* return True if surrounded by impassible rock, regardless of the state
+   of your own location (for example, inside a doorless closet) */
+boolean
+stuck_in_wall()
+{
+    int i, j, x, y, count = 0;
+
+    if (Passes_walls)
+        return FALSE;
+    for (i = -1; i <= 1; i++) {
+        x = u.ux + i;
+        for (j = -1; j <= 1; j++) {
+            if (!i && !j)
+                continue;
+            y = u.uy + j;
+            if (!isok(x, y)
+                || (IS_ROCK(levl[x][y].typ)
+                    && (levl[x][y].typ != SDOOR && levl[x][y].typ != SCORR))
+                || (blocked_boulder(i, j) && !throws_rocks(youmonst.data)))
+                ++count;
+        }
+    }
+    return (count == 8) ? TRUE : FALSE;
+}
+
 /*
  * Return 0 if nothing particular seems wrong, positive numbers for
  * serious trouble, and negative numbers for comparative annoyances.
@@ -169,7 +194,7 @@ STATIC_OVL int
 in_trouble()
 {
     struct obj *otmp;
-    int i, j, count = 0;
+    int i;
 
     /*
      * major troubles
@@ -194,19 +219,8 @@ in_trouble()
         return TROUBLE_LYCANTHROPE;
     if (near_capacity() >= EXT_ENCUMBER && AMAX(A_STR) - ABASE(A_STR) > 3)
         return TROUBLE_COLLAPSING;
-
-    for (i = -1; i <= 1; i++)
-        for (j = -1; j <= 1; j++) {
-            if (!i && !j)
-                continue;
-            if (!isok(u.ux + i, u.uy + j)
-                || IS_ROCK(levl[u.ux + i][u.uy + j].typ)
-                || (blocked_boulder(i, j) && !throws_rocks(youmonst.data)))
-                count++;
-        }
-    if (count == 8 && !Passes_walls)
+    if (stuck_in_wall())
         return TROUBLE_STUCK_IN_WALL;
-
     if (Cursed_obj(uarmf, LEVITATION_BOOTS)
         || stuck_ring(uleft, RIN_LEVITATION)
         || stuck_ring(uright, RIN_LEVITATION))
@@ -244,6 +258,11 @@ in_trouble()
         && (!u.uswallow
             || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)))
         return TROUBLE_BLIND;
+    /* deafness isn't it's own trouble; healing magic cures deafness
+       when it cures blindness, so do the same with trouble repair */
+    if ((HDeaf & TIMEOUT) > 1L)
+        return TROUBLE_BLIND;
+
     for (i = 0; i < A_MAX; i++)
         if (ABASE(i) < AMAX(i))
             return TROUBLE_POISONED;
@@ -276,18 +295,21 @@ worst_cursed_item()
        with taking off a ring or putting on a shield */
     if (welded(uwep) && (uright || bimanual(uwep))) { /* weapon */
         otmp = uwep;
-        /* gloves come next, due to rings */
+    /* gloves come next, due to rings */
     } else if (uarmg && uarmg->cursed) { /* gloves */
         otmp = uarmg;
-        /* then shield due to two handed weapons and spells */
+    /* then shield due to two handed weapons and spells */
     } else if (uarms && uarms->cursed) { /* shield */
         otmp = uarms;
-        /* then cloak due to body armor */
+    /* then cloak due to body armor */
     } else if (uarmc && uarmc->cursed) { /* cloak */
         otmp = uarmc;
     } else if (uarm && uarm->cursed) { /* suit */
         otmp = uarm;
-    } else if (uarmh && uarmh->cursed) { /* helmet */
+    /* if worn helmet of opposite alignment is making you an adherent
+       of the current god, he/she/it won't uncurse that for you */
+    } else if (uarmh && uarmh->cursed /* helmet */
+               && uarmh->otyp != HELM_OF_OPPOSITE_ALIGNMENT) {
         otmp = uarmh;
     } else if (uarmf && uarmf->cursed) { /* boots */
         otmp = uarmf;
@@ -300,14 +322,14 @@ worst_cursed_item()
     } else if (uright && uright->cursed) { /* right ring */
         otmp = uright;
     } else if (ublindf && ublindf->cursed) { /* eyewear */
-        otmp = ublindf;                      /* must be non-blinding lenses */
-        /* if weapon wasn't handled above, do it now */
+        otmp = ublindf; /* must be non-blinding lenses */
+    /* if weapon wasn't handled above, do it now */
     } else if (welded(uwep)) { /* weapon */
         otmp = uwep;
-        /* active secondary weapon even though it isn't welded */
+    /* active secondary weapon even though it isn't welded */
     } else if (uswapwep && uswapwep->cursed && u.twoweap) {
         otmp = uswapwep;
-        /* all worn items ought to be handled by now */
+    /* all worn items ought to be handled by now */
     } else {
         for (otmp = invent; otmp; otmp = otmp->nobj) {
             if (!otmp->cursed)
@@ -367,14 +389,12 @@ int trouble;
         You("are back on solid ground.");
 */
         You("\8cÅ\82¢\92n\96Ê\82É\96ß\82Á\82½\81D");
-        /* teleport should always succeed, but if not,
-         * just untrap them.
-         */
+        /* teleport should always succeed, but if not, just untrap them */
         if (!safe_teleds(FALSE))
-            u.utrap = 0;
+            reset_utrap(TRUE);
         break;
     case TROUBLE_STARVING:
-        losestr(-1);
+        /* temporarily lost strength recovery now handled by init_uhunger() */
         /*FALLTHRU*/
     case TROUBLE_HUNGRY:
 /*JP
@@ -418,7 +438,7 @@ int trouble;
         break;
     case TROUBLE_COLLAPSING:
         /* override Fixed_abil; uncurse that if feasible */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         You_feel("%sstronger.",
                  (AMAX(A_STR) - ABASE(A_STR) > 6) ? "much " : "");
 #else
@@ -431,8 +451,7 @@ int trouble;
             if ((otmp = stuck_ring(uleft, RIN_SUSTAIN_ABILITY)) != 0) {
                 if (otmp == uleft)
                     what = leftglow;
-            } else if ((otmp = stuck_ring(uright, RIN_SUSTAIN_ABILITY))
-                       != 0) {
+            } else if ((otmp = stuck_ring(uright, RIN_SUSTAIN_ABILITY)) != 0) {
                 if (otmp == uright)
                     what = rightglow;
             }
@@ -441,12 +460,28 @@ int trouble;
         }
         break;
     case TROUBLE_STUCK_IN_WALL:
+        /* no control, but works on no-teleport levels */
+        if (safe_teleds(FALSE)) {
 /*JP
-        Your("surroundings change.");
+            Your("surroundings change.");
 */
-        Your("\8aÂ\8b«\82ª\95Ï\89»\82µ\82½\81D");
-        /* no control, but works on no-teleport levels */
-        (void) safe_teleds(FALSE);
+            Your("\8aÂ\8b«\82ª\95Ï\89»\82µ\82½\81D");
+        } else {
+            /* safe_teleds() couldn't find a safe place; perhaps the
+               level is completely full.  As a last resort, confer
+               intrinsic wall/rock-phazing.  Hero might get stuck
+               again fairly soon....
+               Without something like this, fix_all_troubles can get
+               stuck in an infinite loop trying to fix STUCK_IN_WALL
+               and repeatedly failing. */
+            set_itimeout(&HPasses_walls, (long) (d(4, 4) + 4)); /* 8..20 */
+            /* how else could you move between packed rocks or among
+               lattice forming "solid" rock? */
+/*JP
+            You_feel("much slimmer.");
+*/
+            You_feel("\82Æ\82Ä\82à\83X\83\8a\83\80\82É\82È\82Á\82½\8bC\82ª\82µ\82½\81D");
+        }
         break;
     case TROUBLE_CURSED_LEVITATION:
         if (Cursed_obj(uarmf, LEVITATION_BOOTS)) {
@@ -511,11 +546,20 @@ int trouble;
             what = rightglow;
         else if (otmp == uleft)
             what = leftglow;
   decurse:
+ decurse:
         if (!otmp) {
             impossible("fix_worst_trouble: nothing to uncurse.");
             return;
         }
+        if (otmp == uarmg && Glib) {
+            make_glib(0);
+/*JP
+            Your("%s are no longer slippery.", gloves_simple_name(uarmg));
+*/
+            Your("%s\82Í\82à\82¤\82Ê\82é\82Ê\82é\82Å\82Í\82È\82­\82È\82Á\82½\81D", gloves_simple_name(uarmg));
+            if (!otmp->cursed)
+                break;
+        }
         if (!Blind || (otmp == ublindf && Blindfolded_only)) {
 #if 0 /*JP*/
             pline("%s %s.",
@@ -527,7 +571,7 @@ int trouble;
                  jconj_adj(hcolor(NH_AMBER)));
 #endif
             iflags.last_msg = PLNMSG_OBJ_GLOWS;
-            otmp->bknown = TRUE;
+            otmp->bknown = !Hallucination; /* ok to skip set_bknown() */
         }
         uncurse(otmp);
         update_inventory();
@@ -552,22 +596,47 @@ int trouble;
         }
         (void) encumber_msg();
         break;
-    case TROUBLE_BLIND: {
+    case TROUBLE_BLIND: { /* handles deafness as well as blindness */
+        char msgbuf[BUFSZ];
 #if 0 /*JP*/
         const char *eyes = body_part(EYE);
+#endif
+        boolean cure_deaf = (HDeaf & TIMEOUT) ? TRUE : FALSE;
 
-        if (eyecount(youmonst.data) != 1)
-            eyes = makeplural(eyes);
-        Your("%s %s better.", eyes, vtense(eyes, "feel"));
+        msgbuf[0] = '\0';
+        if (Blinded) {
+#if 0 /*JP*/
+            if (eyecount(youmonst.data) != 1)
+                eyes = makeplural(eyes);
+#endif
+#if 0 /*JP:T*/
+            Sprintf(msgbuf, "Your %s %s better", eyes, vtense(eyes, "feel"));
 #else
-        pline("%s\82ª\89ñ\95\9c\82µ\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", body_part(EYE));
+            Sprintf(msgbuf, "%s\82ª\89ñ\95\9c\82µ\82½\82æ\82¤\82È\8bC\82ª\82µ\82½", body_part(EYE));
 #endif
-        u.ucreamed = 0;
-        make_blinded(0L, FALSE);
+            u.ucreamed = 0;
+            make_blinded(0L, FALSE);
+        }
+        if (cure_deaf) {
+            make_deaf(0L, FALSE);
+            if (!Deaf)
+#if 0 /*JP:T*/
+                Sprintf(eos(msgbuf), "%s can hear again",
+                        !*msgbuf ? "You" : " and you");
+#else
+                Sprintf(eos(msgbuf), "%s\82Ü\82½\95·\82±\82¦\82é\82æ\82¤\82É\82È\82Á\82½",
+                        !*msgbuf ? "" : "\81C\82»\82µ\82Ä");
+#endif
+        }
+        if (*msgbuf)
+/*JP
+            pline("%s.", msgbuf);
+*/
+            pline("%s\81D", msgbuf);
         break;
     }
     case TROUBLE_WOUNDED_LEGS:
-        heal_legs();
+        heal_legs(0);
         break;
     case TROUBLE_STUNNED:
         make_stunned(0L, TRUE);
@@ -589,16 +658,15 @@ int trouble;
             pline("%s %s.", Yobjnam2(otmp, "softly glow"), hcolor(NH_AMBER));
 */
             pline("%s\82Í%s\82â\82í\82ç\82©\82­\8bP\82¢\82½\81D", y_monnam(u.usteed), hcolor(NH_AMBER));
-            otmp->bknown = TRUE;
+            set_bknown(otmp, 1);
         }
         uncurse(otmp);
         break;
     }
 }
 
-/* "I am sometimes shocked by...  the nuns who never take a bath without
- * wearing a bathrobe all the time.  When asked why, since no man can see
- * them,
+/* "I am sometimes shocked by... the nuns who never take a bath without
+ * wearing a bathrobe all the time.  When asked why, since no man can see them,
  * they reply 'Oh, but you forget the good God'.  Apparently they conceive of
  * the Deity as a Peeping Tom, whose omnipotence enables Him to see through
  * bathroom walls, but who is foiled by bathrobes." --Bertrand Russell, 1943
@@ -625,8 +693,10 @@ aligntyp resp_god;
             pline("%s\82Í\83p\83\8a\83p\83\8a\82É\82È\82Á\82½\81I", Monnam(u.ustuck));
             /* Yup, you get experience.  It takes guts to successfully
              * pull off this trick on your god, anyway.
+             * Other credit/blame applies (luck or alignment adjustments),
+             * but not direct kill count (pacifist conduct).
              */
-            xkilled(u.ustuck, 0);
+            xkilled(u.ustuck, XKILL_NOMSG | XKILL_NOCONDUCT);
         } else
 /*JP
             pline("%s seems unaffected.", Monnam(u.ustuck));
@@ -674,7 +744,7 @@ aligntyp resp_god;
             pline("%s disintegrates into a pile of dust!", Monnam(u.ustuck));
 */
             pline("%s\82Í\82¿\82è\82Ì\8eR\82É\82È\82Á\82½\81I", Monnam(u.ustuck));
-            xkilled(u.ustuck, 2); /* no corpse */
+            xkilled(u.ustuck, XKILL_NOMSG | XKILL_NOCORPSE | XKILL_NOCONDUCT);
         } else
 /*JP
             pline("%s seems unaffected.", Monnam(u.ustuck));
@@ -700,9 +770,9 @@ aligntyp resp_god;
             (void) destroy_arm(uarm);
         if (uarmu && !uarm && !uarmc)
             (void) destroy_arm(uarmu);
-        if (!Disint_resistance)
+        if (!Disint_resistance) {
             fry_by_god(resp_god, TRUE);
-        else {
+        else {
 /*JP
             You("bask in its %s glow for a minute...", NH_BLACK);
 */
@@ -734,7 +804,7 @@ fry_by_god(resp_god, via_disintegration)
 aligntyp resp_god;
 boolean via_disintegration;
 {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     You("%s!", !via_disintegration ? "fry to a crisp"
                                    : "disintegrate into a pile of dust");
 #else
@@ -775,7 +845,7 @@ aligntyp resp_god;
     switch (rn2(maxanger)) {
     case 0:
     case 1:
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         You_feel("that %s is %s.", align_gname(resp_god),
                  Hallucination ? "bummed" : "displeased");
 #else
@@ -786,7 +856,7 @@ aligntyp resp_god;
     case 2:
     case 3:
         godvoice(resp_god, (char *) 0);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("\"Thou %s, %s.\"",
               (ugod_is_angry() && resp_god == u.ualign.type)
                   ? "hast strayed from the path"
@@ -825,7 +895,7 @@ aligntyp resp_god;
     case 7:
     case 8:
         godvoice(resp_god, (char *) 0);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         verbalize("Thou durst %s me?",
                   (on_altar() && (a_align(u.ux, u.uy) != resp_god))
                       ? "scorn"
@@ -836,12 +906,13 @@ aligntyp resp_god;
                   ? "\82ð\82³\82°\82·\82Ý\82µ\82©\81H"
                   : "\82É\8bF\82è\82ð\8b\81\82ß\82µ\82©\81H");
 #endif
-#if 0 /*JP*/
+        /* [why isn't this using verbalize()?] */
+#if 0 /*JP:T*/
         pline("\"Then die, %s!\"",
-              youmonst.data->mlet == S_HUMAN ? "mortal" : "creature");
+              (youmonst.data->mlet == S_HUMAN) ? "mortal" : "creature");
 #else
         pline("\81u\8e\80\82Ë\81C%s\82æ\81I\81v",
-              youmonst.data->mlet == S_HUMAN ? "\92è\96½\82Ì\82à\82Ì" : "\90\95¨");
+              (youmonst.data->mlet == S_HUMAN) ? "\92è\96½\82Ì\82à\82Ì" : "\90\95¨");
 #endif
         summon_minion(resp_god, FALSE);
         break;
@@ -864,7 +935,7 @@ const char *str;
         str = Something;
     if (u.uswallow) {
         /* barrier between you and the floor */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s %s into %s %s.", str, vtense(str, "drop"),
               s_suffix(mon_nam(u.ustuck)), mbodypart(u.ustuck, STOMACH));
 #else
@@ -872,7 +943,7 @@ const char *str;
               mon_nam(u.ustuck), mbodypart(u.ustuck, STOMACH));
 #endif
     } else {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s %s %s your %s!", str,
               Blind ? "lands" : vtense(str, "appear"),
               Levitation ? "beneath" : "at", makeplural(body_part(FOOT)));
@@ -901,6 +972,20 @@ gcrownu()
     HPoison_resistance |= FROMOUTSIDE;
     godvoice(u.ualign.type, (char *) 0);
 
+    class_gift = STRANGE_OBJECT;
+    /* 3.3.[01] had this in the A_NEUTRAL case,
+       preventing chaotic wizards from receiving a spellbook */
+    if (Role_if(PM_WIZARD)
+        && (!uwep || (uwep->oartifact != ART_VORPAL_BLADE
+                      && uwep->oartifact != ART_STORMBRINGER))
+        && !carrying(SPE_FINGER_OF_DEATH)) {
+        class_gift = SPE_FINGER_OF_DEATH;
+    } else if (Role_if(PM_MONK) && (!uwep || !uwep->oartifact)
+               && !carrying(SPE_RESTORE_ABILITY)) {
+        /* monks rarely wield a weapon */
+        class_gift = SPE_RESTORE_ABILITY;
+    }
+
     obj = ok_wep(uwep) ? uwep : 0;
     already_exists = in_hand = FALSE; /* lint suppression */
     switch (u.ualign.type) {
@@ -926,29 +1011,24 @@ gcrownu()
         in_hand = (uwep && uwep->oartifact == ART_STORMBRINGER);
         already_exists =
             exist_artifact(RUNESWORD, artiname(ART_STORMBRINGER));
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         verbalize("Thou art chosen to %s for My Glory!",
-                  already_exists && !in_hand ? "take lives" : "steal souls");
+                  ((already_exists && !in_hand)
+                   || class_gift != STRANGE_OBJECT) ? "take lives"
+                  : "steal souls");
 #else
         verbalize("\93ð\81C\89ä\82ª\89h\8cõ\82Ì\82½\82ß%s\8eÒ\82Æ\82µ\82Ä\91I\82Î\82ê\82ñ\81I",
-                  already_exists && !in_hand ?
-                              "\90\82«\82È\82ª\82ç\82¦\82ñ" : "\8d°\82ð\92D\82¢\82µ\82½\82ß\82é");
+                  ((already_exists && !in_hand)
+                   || class_gift != STRANGE_OBJECT) ? "\90\82«\82È\82ª\82ç\82¦\82ñ"
+                  : "\8d°\82ð\92D\82¢\82µ\82½\82ß\82é");
 #endif
         break;
     }
 
-    class_gift = STRANGE_OBJECT;
-    /* 3.3.[01] had this in the A_NEUTRAL case below,
-       preventing chaotic wizards from receiving a spellbook */
-    if (Role_if(PM_WIZARD)
-        && (!uwep || (uwep->oartifact != ART_VORPAL_BLADE
-                      && uwep->oartifact != ART_STORMBRINGER))
-        && !carrying(SPE_FINGER_OF_DEATH)) {
-        class_gift = SPE_FINGER_OF_DEATH;
-    make_splbk:
+    if (objects[class_gift].oc_class == SPBOOK_CLASS) {
         obj = mksobj(class_gift, TRUE, FALSE);
         bless(obj);
-        obj->bknown = TRUE;
+        obj->bknown = 1; /* ok to skip set_bknown() */
 /*JP
         at_your_feet("A spellbook");
 */
@@ -963,11 +1043,6 @@ gcrownu()
                     obj = uwep; /* to be blessed,&c */
                 break;
             }
-    } else if (Role_if(PM_MONK) && (!uwep || !uwep->oartifact)
-               && !carrying(SPE_RESTORE_ABILITY)) {
-        /* monks rarely wield a weapon */
-        class_gift = SPE_RESTORE_ABILITY;
-        goto make_splbk;
     }
 
     switch (u.ualign.type) {
@@ -1053,7 +1128,7 @@ gcrownu()
         bless(obj);
         obj->oeroded = obj->oeroded2 = 0;
         obj->oerodeproof = TRUE;
-        obj->bknown = obj->rknown = TRUE;
+        obj->bknown = obj->rknown = 1; /* ok to skip set_bknown() */
         if (obj->spe < 1)
             obj->spe = 1;
         /* acquire skill in this weapon */
@@ -1081,7 +1156,7 @@ aligntyp g_align;
     int trouble = in_trouble(); /* what's your worst difficulty? */
     int pat_on_head = 0, kick_on_butt;
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     You_feel("that %s is %s.", align_gname(g_align),
              (u.ualign.record >= DEVOUT)
                  ? Hallucination ? "pleased as punch" : "well-pleased"
@@ -1112,7 +1187,7 @@ aligntyp g_align;
      *  - fix all of your problems;
      *  - do you a gratuitous favor.
      *
-     * If you make it to the the last category, you roll randomly again
+     * If you make it to the last category, you roll randomly again
      * to see what they do for you.
      *
      * If your luck is at least 0, then you are guaranteed rescued from
@@ -1148,6 +1223,7 @@ aligntyp g_align;
         switch (min(action, 5)) {
         case 5:
             pat_on_head = 1;
+            /*FALLTHRU*/
         case 4:
             do
                 fix_worst_trouble(trouble);
@@ -1184,7 +1260,7 @@ aligntyp g_align;
 
                 *repair_buf = '\0';
                 if (uwep->oeroded || uwep->oeroded2)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     Sprintf(repair_buf, " and %s now as good as new",
                             otense(uwep, "are"));
 #else
@@ -1193,7 +1269,7 @@ aligntyp g_align;
 
                 if (uwep->cursed) {
                     if (!Blind) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         pline("%s %s%s.", Yobjnam2(uwep, "softly glow"),
                               hcolor(NH_AMBER), repair_buf);
 #else
@@ -1202,7 +1278,7 @@ aligntyp g_align;
 #endif
                         iflags.last_msg = PLNMSG_OBJ_GLOWS;
                     } else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         You_feel("the power of %s over %s.", u_gname(),
                                  yname(uwep));
 #else
@@ -1210,11 +1286,11 @@ aligntyp g_align;
                               xname(uwep));
 #endif
                     uncurse(uwep);
-                    uwep->bknown = TRUE;
+                    uwep->bknown = 1; /* ok to bypass set_bknown() */
                     *repair_buf = '\0';
                 } else if (!uwep->blessed) {
                     if (!Blind) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         pline("%s with %s aura%s.",
                               Yobjnam2(uwep, "softly glow"),
                               an(hcolor(NH_LIGHT_BLUE)), repair_buf);
@@ -1225,7 +1301,7 @@ aligntyp g_align;
 #endif
                         iflags.last_msg = PLNMSG_OBJ_GLOWS;
                     } else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         You_feel("the blessing of %s over %s.", u_gname(),
                                  yname(uwep));
 #else
@@ -1233,7 +1309,7 @@ aligntyp g_align;
                               xname(uwep));
 #endif
                     bless(uwep);
-                    uwep->bknown = TRUE;
+                    uwep->bknown = 1; /* ok to bypass set_bknown() */
                     *repair_buf = '\0';
                 }
 
@@ -1244,7 +1320,7 @@ aligntyp g_align;
                     /* only give this message if we didn't just bless
                        or uncurse (which has already given a message) */
                     if (*repair_buf)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         pline("%s as good as new!",
                               Yobjnam2(uwep, Blind ? "feel" : "look"));
 #else
@@ -1263,7 +1339,7 @@ aligntyp g_align;
             if (!u.uevent.uopened_dbridge && !u.uevent.gehennom_entered) {
                 if (u.uevent.uheard_tune < 1) {
                     godvoice(g_align, (char *) 0);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     verbalize("Hark, %s!", youmonst.data->mlet == S_HUMAN
                                                ? "mortal"
                                                : "creature");
@@ -1276,7 +1352,7 @@ aligntyp g_align;
 /*JP
                        "To enter the castle, thou must play the right tune!");
 */
-                        "\93ð\8fé\82É\93ü\82ç\82ñ\82Æ\97~\82·\82é\82È\82ç\82Î\81C\90³\82µ\82«\92²\82×\82ð\91t\82Å\82é\82×\82µ\81I");
+                       "\93ð\8fé\82É\93ü\82ç\82ñ\82Æ\97~\82·\82é\82È\82ç\82Î\81C\90³\82µ\82«\92²\82×\82ð\91t\82Å\82é\82×\82µ\81I");
                     u.uevent.uheard_tune++;
                     break;
                 } else if (u.uevent.uheard_tune < 2) {
@@ -1292,7 +1368,7 @@ aligntyp g_align;
                     break;
                 }
             }
-        /* Otherwise, falls into next case */
+            /*FALLTHRU*/
         case 2:
             if (!Blind)
 /*JP
@@ -1312,11 +1388,22 @@ aligntyp g_align;
             u.uhp = u.uhpmax;
             if (Upolyd)
                 u.mh = u.mhmax;
-            ABASE(A_STR) = AMAX(A_STR);
+            if (ABASE(A_STR) < AMAX(A_STR)) {
+                ABASE(A_STR) = AMAX(A_STR);
+                context.botl = 1; /* before potential message */
+                (void) encumber_msg();
+            }
             if (u.uhunger < 900)
                 init_uhunger();
+            /* luck couldn't have been negative at start of prayer because
+               the prayer would have failed, but might have been decremented
+               due to a timed event (delayed death of peaceful monster hit
+               by hero-created stinking cloud) during the praying interval */
             if (u.uluck < 0)
                 u.uluck = 0;
+            /* superfluous; if hero was blinded we'd be handling trouble
+               rather than issuing a pat-on-head */
+            u.ucreamed = 0;
             make_blinded(0L, TRUE);
             context.botl = 1;
             break;
@@ -1335,9 +1422,11 @@ aligntyp g_align;
 */
                 You("%s\83I\81[\83\89\82É\82Â\82Â\82Ü\82ê\82½\81D", an(hcolor(NH_LIGHT_BLUE)));
             for (otmp = invent; otmp; otmp = otmp->nobj) {
-                if (otmp->cursed) {
+                if (otmp->cursed
+                    && (otmp != uarmh /* [see worst_cursed_item()] */
+                        || uarmh->otyp != HELM_OF_OPPOSITE_ALIGNMENT)) {
                     if (!Blind) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         pline("%s %s.", Yobjnam2(otmp, "softly glow"),
                               hcolor(NH_AMBER));
 #else
@@ -1345,7 +1434,7 @@ aligntyp g_align;
                              jconj_adj(hcolor(NH_AMBER)));
 #endif
                         iflags.last_msg = PLNMSG_OBJ_GLOWS;
-                        otmp->bknown = TRUE;
+                        otmp->bknown = 1; /* ok to bypass set_bknown() */
                         ++any;
                     }
                     uncurse(otmp);
@@ -1410,7 +1499,8 @@ aligntyp g_align;
             if (u.ualign.record >= PIOUS && !u.uevent.uhand_of_elbereth) {
                 gcrownu();
                 break;
-            } /* else FALLTHRU */
+            }
+            /*FALLTHRU*/
         case 6: {
             struct obj *otmp;
             int sp_no, trycnt = u.ulevel + 1;
@@ -1475,13 +1565,13 @@ boolean bless_water;
             && (bless_water ? !otmp->blessed : !otmp->cursed)) {
             otmp->blessed = bless_water;
             otmp->cursed = !bless_water;
-            otmp->bknown = bc_known;
+            otmp->bknown = bc_known; /* ok to bypass set_bknown() */
             changed += otmp->quan;
         } else if (otmp->oclass == POTION_CLASS)
             other = TRUE;
     }
     if (!Blind && changed) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s potion%s on the altar glow%s %s for a moment.",
               ((other && changed > 1L) ? "Some of the"
                                        : (other ? "One of the" : "The")),
@@ -1576,7 +1666,7 @@ register struct obj *otmp;
 */
         Your("\8c£\8fã\95¨\82Í\8fÁ\82¦\82½\81I");
     else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Your("sacrifice is consumed in a %s!",
              u.ualign.type == A_LAWFUL ? "flash of light" : "burst of flame");
 #else
@@ -1613,10 +1703,7 @@ dosacrifice()
     highaltar = ((Is_astralevel(&u.uz) || Is_sanctum(&u.uz))
                  && (levl[u.ux][u.uy].altarmask & AM_SHRINE));
 
-/*JP
     otmp = floorfood("sacrifice", 1);
-*/
-    otmp = floorfood("\95ù\82°\82é", 1);
     if (!otmp)
         return 0;
     /*
@@ -1633,7 +1720,6 @@ dosacrifice()
     if (otmp->otyp == CORPSE) {
         register struct permonst *ptr = &mons[otmp->corpsenm];
         struct monst *mtmp;
-        extern const int monstr[];
 
         /* KMH, conduct */
         u.uconduct.gnostic++;
@@ -1646,7 +1732,7 @@ dosacrifice()
 
         if (otmp->corpsenm == PM_ACID_BLOB
             || (monstermoves <= peek_at_iced_corpse_age(otmp) + 50)) {
-            value = monstr[otmp->corpsenm] + 1;
+            value = mons[otmp->corpsenm].difficulty + 1;
             if (otmp->oeaten)
                 value = eaten_stat(value, otmp);
         }
@@ -1737,7 +1823,10 @@ dosacrifice()
 */
                     You("\8b°\95|\82Å\93®\82¯\82È\82­\82È\82Á\82½\81D");
                     nomul(-3);
+/*JP
                     multi_reason = "being terrified of a demon";
+*/
+                    multi_reason = "\88«\97ì\82É\8b°\95|\82µ\82Ä\82¢\82é\8e\9e\82É";
                     nomovemsg = 0;
                 } else
 /*JP
@@ -1781,7 +1870,7 @@ dosacrifice()
             if (unicalign == altaralign) {
                 /* When same as altar, always a very bad action.
                  */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("Such an action is an insult to %s!",
                       (unicalign == A_CHAOTIC) ? "chaos"
                          : unicalign ? "law" : "balance");
@@ -1826,14 +1915,14 @@ dosacrifice()
 
     if (otmp->otyp == AMULET_OF_YENDOR) {
         if (!highaltar) {
       too_soon:
+ too_soon:
             if (altaralign == A_NONE && Inhell)
                 /* hero has left Moloch's Sanctum so is in the process
                    of getting away with the Amulet (outside of Gehennom,
                    fall through to the "ashamed" feedback) */
                 gods_upset(A_NONE);
             else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 You_feel("%s.",
                          Hallucination
                             ? "homesick"
@@ -1871,7 +1960,7 @@ dosacrifice()
                 if (u.ualign.record > -99)
                     u.ualign.record = -99;
                 /*[apparently shrug/snarl can be sensed without being seen]*/
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s shrugs and retains dominion over %s,", Moloch,
                       u_gname());
 #else
@@ -1884,7 +1973,7 @@ dosacrifice()
                 pline("\82»\82µ\82Ä\96³\8e\9c\94ß\82É\82 \82È\82½\82Ì\96½\82ð\92D\82Á\82½\81D");
 /*JP
 */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 Sprintf(killer.name, "%s indifference", s_suffix(Moloch));
 #else
                 Sprintf(killer.name, "\97â\92W\82È%s", Moloch);
@@ -1904,7 +1993,7 @@ dosacrifice()
                 /* And the opposing team picks you up and
                    carries you off on their shoulders */
                 adjalign(-99);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s accepts your gift, and gains dominion over %s...",
                       a_gname(), u_gname());
 #else
@@ -1928,18 +2017,18 @@ dosacrifice()
 /*JP
                "An invisible choir sings, and you are bathed in radiance...");
 */
-                "\82Ç\82±\82©\82ç\82Æ\82à\82È\82­\90¹\89Ì\91à\82Ì\89Ì\82ª\95·\82±\82¦\81C\82 \82È\82½\82Í\8cõ\82É\95ï\82Ü\82ê\82½\81D\81D\81D");
+               "\82Ç\82±\82©\82ç\82Æ\82à\82È\82­\90¹\89Ì\91à\82Ì\89Ì\82ª\95·\82±\82¦\81C\82 \82È\82½\82Í\8cõ\82É\95ï\82Ü\82ê\82½\81D\81D\81D");
 /*JP
-                godvoice(altaralign, "Congratulations, mortal!");
+                godvoice(altaralign, "Mortal, thou hast done well!");
 */
-                godvoice(altaralign, "\82æ\82­\82â\82Á\82½\81I\92è\96½\82Ì\8eÒ\82æ\81I");
+                godvoice(altaralign, "\92è\96½\82Ì\8eÒ\82æ\81C\82æ\82­\82â\82Á\82½\81I");
                 display_nhwindow(WIN_MESSAGE, FALSE);
                 verbalize(
 /*JP
           "In return for thy service, I grant thee the gift of Immortality!");
 */
-          "\93ð\82Ì\88Ì\8bÆ\82É\91Î\82µ\81C\95s\8e\80\82Ì\91Ì\82ð\95ù\82°\82æ\82¤\82¼\81I");
-#if 0 /*JP*/
+          "\93ð\82Ì\88Ì\8bÆ\82É\91Î\82µ\81C\95s\8e\80\82Ì\91Ì\82ð\8eö\82¯\82æ\82¤\82¼\81I");
+#if 0 /*JP:T*/
                 You("ascend to the status of Demigod%s...",
                     flags.female ? "dess" : "");
 #else
@@ -1959,7 +2048,7 @@ dosacrifice()
 */
         You("\8bß\82­\82É\97\8b\82ª\97\8e\82¿\82½\89¹\82ð\95·\82¢\82½\81D");
         if (!otmp->known) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             You("realize you have made a %s.",
                 Hallucination ? "boo-boo" : "mistake");
 #else
@@ -1972,7 +2061,7 @@ dosacrifice()
         } else {
             /* don't you dare try to fool the gods */
             if (Deaf)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("Oh, no."); /* didn't hear thunderclap */
 #else
                 pline("\82È\82ñ\82Ä\82±\82Á\82½\81D"); /* didn't hear thunderclap */
@@ -1990,7 +2079,7 @@ dosacrifice()
     }
 
     if (altaralign != u.ualign.type && highaltar) {
   desecrate_high_altar:
+ desecrate_high_altar:
         /*
          * REAL BAD NEWS!!! High altars cannot be converted.  Even an attempt
          * gets the god who owns it truly pissed off.
@@ -2059,7 +2148,7 @@ dosacrifice()
                 return 1;
             } else {
                 consume_offering(otmp);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 You("sense a conflict between %s and %s.", u_gname(),
                     a_gname());
 #else
@@ -2081,7 +2170,7 @@ dosacrifice()
                         levl[u.ux][u.uy].altarmask
                         | (Align2amask(u.ualign.type));
                     if (!Blind)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         pline_The("altar glows %s.",
                                   hcolor((u.ualign.type == A_LAWFUL)
                                             ? NH_WHITE
@@ -2129,7 +2218,7 @@ dosacrifice()
                 u.ugangr = 0;
             if (u.ugangr != saved_anger) {
                 if (u.ugangr) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     pline("%s seems %s.", u_gname(),
                           Hallucination ? "groovy" : "slightly mollified");
 #else
@@ -2140,7 +2229,7 @@ dosacrifice()
                     if ((int) u.uluck < 0)
                         change_luck(1);
                 } else {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     pline("%s seems %s.", u_gname(),
                           Hallucination ? "cosmic (not a new fact)"
                                         : "mollified");
@@ -2251,7 +2340,7 @@ dosacrifice()
                 u.uluck = 0;
             if (u.uluck != saved_luck) {
                 if (Blind)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     You("think %s brushed your %s.", something,
                         body_part(FOOT));
 #else
@@ -2259,7 +2348,7 @@ dosacrifice()
                           body_part(FOOT));
 #endif
                 else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     You(Hallucination
                     ? "see crabgrass at your %s.  A funny thing in a dungeon."
                             : "glimpse a four-leaf clover at your %s.",
@@ -2287,7 +2376,7 @@ boolean praying; /* false means no messages should be given */
 
     if (is_demon(youmonst.data) && (p_aligntyp != A_CHAOTIC)) {
         if (praying)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline_The("very idea of praying to a %s god is repugnant to you.",
                       p_aligntyp ? "lawful" : "neutral");
 #else
@@ -2366,7 +2455,10 @@ dopray()
         }
     }
     nomul(-3);
+/*JP
     multi_reason = "praying";
+*/
+    multi_reason = "\8bF\82Á\82Ä\82¢\82é\8e\9e\82É";
 /*JP
     nomovemsg = "You finish your prayer.";
 */
@@ -2393,7 +2485,7 @@ prayer_done() /* M. Stephenson (1.0.3b) */
 
     u.uinvulnerable = FALSE;
     if (p_type == -1) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         godvoice(alignment,
                  (alignment == A_LAWFUL)
                     ? "Vile creature, thou durst call upon me?"
@@ -2419,11 +2511,13 @@ prayer_done() /* M. Stephenson (1.0.3b) */
         return 1;
     }
     if (Inhell) {
-/*JP
-        pline("Since you are in Gehennom, %s won't help you.",
-*/
-        pline("\83Q\83w\83i\82É%s\82Ì\97Í\82Í\93Í\82©\82È\82¢\81D",
+#if 0 /*JP:T*/
+        pline("Since you are in Gehennom, %s can't help you.",
               align_gname(alignment));
+#else
+        pline("\82 \82È\82½\82Í\83Q\83w\83i\82É\82¢\82é\82Ì\82Å\81C%s\82Í\82 \82È\82½\82ð\8f\95\82¯\82ç\82ê\82È\82¢\81D",
+              align_gname(alignment));
+#endif
         /* haltingly aligned is least likely to anger */
         if (u.ualign.record <= 0 || rnl(u.ualign.record))
             angrygods(u.ualign.type);
@@ -2463,6 +2557,7 @@ doturn()
 {
     /* Knights & Priest(esse)s only please */
     struct monst *mtmp, *mtmp2;
+    const char *Gname;
     int once, range, xlev;
 
     if (!Role_if(PM_PRIEST) && !Role_if(PM_KNIGHT)) {
@@ -2488,42 +2583,68 @@ doturn()
         return 0;
     }
     u.uconduct.gnostic++;
+    Gname = halu_gname(u.ualign.type);
 
+    /* [What about needing free hands (does #turn involve any gesturing)?] */
+    if (!can_chant(&youmonst)) {
+        /* "evilness": "demons and undead" is too verbose and too precise */
+#if 0 /*JP*/
+        You("are %s upon %s to turn aside evilness.",
+            Strangled ? "not able to call" : "incapable of calling", Gname);
+#else
+        You("\88«\82ð\91Þ\82¯\82é\82½\82ß\82É%s\82ð\8cÄ\82Ñ\8fo\82·%s\82È\82¢\81D",
+            Gname, Strangled ? "\82±\82Æ\82ª\82Å\82«" : "\94\\97Í\82ª");
+#endif
+        /* violates agnosticism due to intent; conduct tracking is not
+           supposed to affect play but we make an exception here:  use a
+           move if this is the first time agnostic conduct has been broken */
+        return (u.uconduct.gnostic == 1);
+    }
     if ((u.ualign.type != A_CHAOTIC
          && (is_demon(youmonst.data) || is_undead(youmonst.data)))
         || u.ugangr > 6) { /* "Die, mortal!" */
 /*JP
-        pline("For some reason, %s seems to ignore you.", u_gname());
+        pline("For some reason, %s seems to ignore you.", Gname);
 */
-        pline("\82È\82º\82©\81C%s\82Í\82 \82È\82½\82ð\96³\8e\8b\82µ\82½\82æ\82¤\82¾\81D", u_gname());
+        pline("\82È\82º\82©\81C%s\82Í\82 \82È\82½\82ð\96³\8e\8b\82µ\82½\82æ\82¤\82¾\81D", Gname);
         aggravate();
         exercise(A_WIS, FALSE);
-        return 0;
+        return 1;
     }
     if (Inhell) {
-/*JP
-        pline("Since you are in Gehennom, %s won't help you.", u_gname());
-*/
-        pline("\83Q\83w\83i\82É%s\82Ì\97Í\82Í\93Í\82©\82È\82¢\81D", u_gname());
+#if 0 /*JP*/
+        pline("Since you are in Gehennom, %s %s help you.",
+              /* not actually calling upon Moloch but use alternate
+                 phrasing anyway if hallucinatory feedback says it's him */
+              Gname, !strcmp(Gname, Moloch) ? "won't" : "can't");
+#else
+        pline("\82 \82È\82½\82Í\83Q\83w\83i\82É\82¢\82é\82Ì\82Å\81C%s\82Í\82 \82È\82½\82ð\8f\95\82¯%s\82È\82¢\81D",
+              /* not actually calling upon Moloch but use alternate
+                 phrasing anyway if hallucinatory feedback says it's him */
+              Gname, !strcmp(Gname, Moloch) ? "" : "\82ç\82ê");
+#endif
         aggravate();
-        return 0;
+        return 1;
     }
 /*JP
-    pline("Calling upon %s, you chant an arcane formula.", u_gname());
+    pline("Calling upon %s, you chant an arcane formula.", Gname);
 */
-    pline("%s\82É\8bF\82è\82ð\8b\81\82ß\82é\82Æ\81C\82 \82È\82½\82Í\95s\89Â\8ev\8bc\82È\8c¾\97t\82Ì\90¹\89Ì\82ð\95·\82¢\82½\81D", u_gname());
+    pline("%s\82É\8bF\82è\82ð\8b\81\82ß\82é\82Æ\81C\82 \82È\82½\82Í\95s\89Â\8ev\8bc\82È\8c¾\97t\82Ì\90¹\89Ì\82ð\95·\82¢\82½\81D", Gname);
     exercise(A_WIS, TRUE);
 
     /* note: does not perform unturn_dead() on victims' inventories */
-    range = BOLT_LIM + (u.ulevel / 5); /* 5 to 11 */
+    range = BOLT_LIM + (u.ulevel / 5); /* 8 to 14 */
     range *= range;
     once = 0;
     for (mtmp = fmon; mtmp; mtmp = mtmp2) {
         mtmp2 = mtmp->nmon;
-
         if (DEADMONSTER(mtmp))
             continue;
-        if (!cansee(mtmp->mx, mtmp->my) || distu(mtmp->mx, mtmp->my) > range)
+        /* 3.6.3: used to use cansee() here but the purpose is to prevent
+           #turn operating through walls, not to require that the hero be
+           able to see the target location */
+        if (!couldsee(mtmp->mx, mtmp->my)
+            || distu(mtmp->mx, mtmp->my) > range)
             continue;
 
         if (!mtmp->mpeaceful
@@ -2545,15 +2666,20 @@ doturn()
                 /* this is intentional, lichs are tougher
                    than zombies. */
                 case S_LICH:
-                    xlev += 2; /*FALLTHRU*/
+                    xlev += 2;
+                    /*FALLTHRU*/
                 case S_GHOST:
-                    xlev += 2; /*FALLTHRU*/
+                    xlev += 2;
+                    /*FALLTHRU*/
                 case S_VAMPIRE:
-                    xlev += 2; /*FALLTHRU*/
+                    xlev += 2;
+                    /*FALLTHRU*/
                 case S_WRAITH:
-                    xlev += 2; /*FALLTHRU*/
+                    xlev += 2;
+                    /*FALLTHRU*/
                 case S_MUMMY:
-                    xlev += 2; /*FALLTHRU*/
+                    xlev += 2;
+                    /*FALLTHRU*/
                 case S_ZOMBIE:
                     if (u.ulevel >= xlev && !resist(mtmp, '\0', 0, NOTELL)) {
                         if (u.ualign.type == A_CHAOTIC) {
@@ -2572,8 +2698,27 @@ doturn()
             }
         }
     }
-    nomul(-5);
+
+    /*
+     *  There is no detrimental effect on self for successful #turn
+     *  while in demon or undead form.  That can only be done while
+     *  chaotic oneself (see "For some reason" above) and chaotic
+     *  turning only makes targets peaceful.
+     *
+     *  Paralysis duration probably ought to be based on the strengh
+     *  of turned creatures rather than on turner's level.
+     *  Why doesn't this honor Free_action?  [Because being able to
+     *  repeat #turn every turn would be too powerful.  Maybe instead
+     *  of nomul(-N) we should add the equivalent of mon->mspec_used
+     *  for the hero and refuse to #turn when it's non-zero?  Or have
+     *  both and u.uspec_used only matters when Free_action prevents
+     *  the brief paralysis?]
+     */
+    nomul(-(5 - ((u.ulevel - 1) / 6))); /* -5 .. -1 */
+/*JP
     multi_reason = "trying to turn the monsters";
+*/
+    multi_reason = "\89ö\95¨\82ð\93y\82É\96ß\82»\82¤\82Æ\82µ\82Ä\82¢\82é\8e\9e\82É";
     nomovemsg = You_can_move_again;
     return 1;
 }
@@ -2635,7 +2780,7 @@ aligntyp alignment;
 }
 
 static const char *hallu_gods[] = {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     "the Flying Spaghetti Monster", /* Church of the FSM */
     "Eris",                         /* Discordianism */
     "the Martians",                 /* every science fiction ever */
@@ -2680,13 +2825,16 @@ aligntyp alignment;
     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. */
+    /* Some roles (Priest) don't have a pantheon unless we're playing as
+       that role, so keep trying until we get a role which does have one.
+       [If playing a Priest, the current pantheon will be twice as likely
+       to get picked as any of the others.  That's not significant enough
+       to bother dealing with.] */
     do
-        which = randrole();
+        which = randrole(TRUE);
     while (!roles[which].lgod);
 
-    switch (rn2(9)) {
+    switch (rn2_on_display_rng(9)) {
     case 0:
     case 1:
         gnam = roles[which].lgod;
@@ -2701,7 +2849,7 @@ aligntyp alignment;
         break;
     case 6:
     case 7:
-        gnam = hallu_gods[rn2(sizeof hallu_gods / sizeof *hallu_gods)];
+        gnam = hallu_gods[rn2_on_display_rng(SIZE(hallu_gods))];
         break;
     case 8:
         gnam = Moloch;
@@ -2711,7 +2859,7 @@ aligntyp alignment;
     }
     if (!gnam) {
         impossible("No random god name?");
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         gnam = "your Friend the Computer"; /* Paranoia */
 #else
         gnam = "\90e\88¤\82È\82é\83R\83\93\83s\83\85\81[\83^"; /* Paranoia */
@@ -2760,22 +2908,35 @@ register int x, y;
 {
     aligntyp altaralign = a_align(x, y);
 
-    if (!strcmp(align_gname(altaralign), u_gname())) {
+    if (u.ualign.type == altaralign && u.ualign.record > -rn2(4)) {
 /*JP
         godvoice(altaralign, "How darest thou desecrate my altar!");
 */
         godvoice(altaralign, "\93ð\81C\89ä\82ª\8dÕ\92d\82ð\89\98\82·\82©\81I");
         (void) adjattrib(A_WIS, -1, FALSE);
+        u.ualign.record--;
     } else {
-/*JP
-        pline("A voice (could it be %s?) whispers:", align_gname(altaralign));
-*/
-        pline("\82³\82³\82â\82«\90º(\82½\82Ô\82ñ%s\81H)\82ª\95·\82±\82¦\82é:", align_gname(altaralign));
+#if 0 /*JP:T*/
+        pline("%s %s%s:",
+              !Deaf ? "A voice (could it be"
+                    : "Despite your deafness, you seem to hear",
+              align_gname(altaralign),
+              !Deaf ? "?) whispers" : " say");
+#else
+        pline("%s %s%s:",
+              !Deaf ? "\82³\82³\82â\82«\90º(\82½\82Ô\82ñ"
+                    : "\8e¨\82Í\95·\82±\82¦\82È\82¢\82ª\81C",
+              align_gname(altaralign),
+              !Deaf ? "\81H)\82ª\95·\82±\82¦\82é" : "\82ª\98b\82µ\82Ä\82¢\82é\82Ì\82ª\95·\82±\82¦\82½\8bC\82ª\82µ\82½");
+#endif
 /*JP
         verbalize("Thou shalt pay, infidel!");
 */
         verbalize("\88Ù\92[\8eÒ\82æ\81I\95ñ\82¢\82ð\8eó\82¯\82æ\81I");
-        change_luck(-1);
+        /* higher luck is more likely to be reduced; as it approaches -5
+           the chance to lose another point drops down, eventually to 0 */
+        if (Luck > -5 && rn2(Luck + 6))
+            change_luck(rn2(20) ? -1 : -2);
     }
 }
 
@@ -2785,6 +2946,7 @@ blocked_boulder(dx, dy)
 int dx, dy;
 {
     register struct obj *otmp;
+    int nx, ny;
     long count = 0L;
 
     for (otmp = level.objects[u.ux + dx][u.uy + dy]; otmp;
@@ -2793,6 +2955,7 @@ int dx, dy;
             count += otmp->quan;
     }
 
+    nx = u.ux + 2 * dx, ny = u.uy + 2 * dy; /* next spot beyond boulder(s) */
     switch (count) {
     case 0:
         /* no boulders--not blocked */
@@ -2800,17 +2963,24 @@ int dx, dy;
     case 1:
         /* possibly blocked depending on if it's pushable */
         break;
+    case 2:
+        /* this is only approximate since multiple boulders might sink */
+        if (is_pool_or_lava(nx, ny)) /* does its own isok() check */
+            break; /* still need Sokoban check below */
+        /*FALLTHRU*/
     default:
         /* more than one boulder--blocked after they push the top one;
            don't force them to push it first to find out */
         return TRUE;
     }
 
-    if (!isok(u.ux + 2 * dx, u.uy + 2 * dy))
+    if (dx && dy && Sokoban) /* can't push boulder diagonally in Sokoban */
+        return TRUE;
+    if (!isok(nx, ny))
         return TRUE;
-    if (IS_ROCK(levl[u.ux + 2 * dx][u.uy + 2 * dy].typ))
+    if (IS_ROCK(levl[nx][ny].typ))
         return TRUE;
-    if (sobj_at(BOULDER, u.ux + 2 * dx, u.uy + 2 * dy))
+    if (sobj_at(BOULDER, nx, ny))
         return TRUE;
 
     return FALSE;