OSDN Git Service

finalize changelog
[jnethack/source.git] / src / pray.c
index 4655695..b3a45ef 100644 (file)
@@ -1,10 +1,10 @@
-/* NetHack 3.6 pray.c  $NHDT-Date: 1519662898 2018/02/26 16:34:58 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.96 $ */
+/* 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-2019            */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2022            */
 /* JNetHack may be freely redistributed.  See license for details. */
 
 #include "hack.h"
@@ -168,7 +168,7 @@ stuck_in_wall()
             y = u.uy + j;
             if (!isok(x, y)
                 || (IS_ROCK(levl[x][y].typ)
-                    && (levl[x][y].typ != SDOOR || levl[x][y].typ != SCORR))
+                    && (levl[x][y].typ != SDOOR && levl[x][y].typ != SCORR))
                 || (blocked_boulder(i, j) && !throws_rocks(youmonst.data)))
                 ++count;
         }
@@ -258,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;
@@ -386,7 +391,7 @@ int trouble;
         You("\8cÅ\82¢\92n\96Ê\82É\96ß\82Á\82½\81D");
         /* teleport should always succeed, but if not, just untrap them */
         if (!safe_teleds(FALSE))
-            u.utrap = 0;
+            reset_utrap(TRUE);
         break;
     case TROUBLE_STARVING:
         /* temporarily lost strength recovery now handled by init_uhunger() */
@@ -433,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
@@ -458,9 +463,9 @@ int trouble;
         /* 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");
+            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
@@ -541,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.",
@@ -554,10 +568,10 @@ int trouble;
 #else
             Your("%s\82Í%s\82â\82í\82ç\82©\82­\8bP\82¢\82½\81D",
                  what ? what : (const char *)xname(otmp),
-                 jconj_adj(hcolor(NH_AMBER)));
+                 hcolor_adv(NH_AMBER));
 #endif
             iflags.last_msg = PLNMSG_OBJ_GLOWS;
-            otmp->bknown = !Hallucination;
+            otmp->bknown = !Hallucination; /* ok to skip set_bknown() */
         }
         uncurse(otmp);
         update_inventory();
@@ -582,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
+            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);
+        }
+        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
-        pline("%s\82ª\89ñ\95\9c\82µ\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", body_part(EYE));
+                Sprintf(eos(msgbuf), "%s\82Ü\82½\95·\82±\82¦\82é\82æ\82¤\82É\82È\82Á\82½",
+                        !*msgbuf ? "" : "\81C\82»\82µ\82Ä");
 #endif
-        u.ucreamed = 0;
-        make_blinded(0L, FALSE);
+        }
+        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);
@@ -618,8 +657,8 @@ int trouble;
 /*JP
             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;
+            pline("%s\82Í%s\82â\82í\82ç\82©\82­\8bP\82¢\82½\81D", y_monnam(u.usteed), hcolor_adv(NH_AMBER));
+            set_bknown(otmp, 1);
         }
         uncurse(otmp);
         break;
@@ -765,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
@@ -806,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
@@ -817,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"
@@ -856,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"
@@ -867,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;
@@ -895,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
@@ -903,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)));
@@ -932,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) {
@@ -957,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");
 */
@@ -994,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) {
@@ -1084,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 */
@@ -1112,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"
@@ -1143,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
@@ -1216,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
@@ -1225,16 +1269,16 @@ 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
                         Your("%s\82Í%s\82â\82í\82ç\82©\82­\8bP\82¢\82½\81D%s", xname(uwep), 
-                             jconj_adj(hcolor(NH_AMBER)), repair_buf);
+                              hcolor_adv(NH_AMBER), repair_buf);
 #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
@@ -1242,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);
@@ -1257,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
@@ -1265,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';
                 }
 
@@ -1276,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
@@ -1295,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");
@@ -1308,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) {
@@ -1344,7 +1388,11 @@ 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
@@ -1378,15 +1426,15 @@ aligntyp g_align;
                     && (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
                         Your("%s\82Í%s\82â\82í\82ç\82©\82­\8bP\82¢\82½\81D", xname(otmp),
-                             jconj_adj(hcolor(NH_AMBER)));
+                              hcolor_adv(NH_AMBER));
 #endif
                         iflags.last_msg = PLNMSG_OBJ_GLOWS;
-                        otmp->bknown = TRUE;
+                        otmp->bknown = 1; /* ok to bypass set_bknown() */
                         ++any;
                     }
                     uncurse(otmp);
@@ -1517,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")),
@@ -1533,7 +1581,7 @@ boolean bless_water;
         pline("%s\8dÕ\92d\82Ì\96ò\82Í\88ê\8fu%s\8bP\82¢\82½\81D",
               (other && changed > 1L) ? "\82¢\82­\82Â\82©\82Ì"
                                       : "",
-              jconj_adj(bless_water ? hcolor(NH_LIGHT_BLUE) : hcolor(NH_BLACK)));
+              (bless_water ? hcolor_adv(NH_LIGHT_BLUE) : hcolor_adv(NH_BLACK)));
 #endif
     }
     return (boolean) (changed > 0L);
@@ -1618,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
@@ -1672,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++;
@@ -1685,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);
         }
@@ -1823,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");
@@ -1868,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"
@@ -1913,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
@@ -1926,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);
@@ -1946,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
@@ -1970,7 +2017,7 @@ 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, "Mortal, thou hast done well!");
 */
@@ -1981,7 +2028,7 @@ dosacrifice()
           "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ð\8eö\82¯\82æ\82¤\82¼\81I");
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 You("ascend to the status of Demigod%s...",
                     flags.female ? "dess" : "");
 #else
@@ -2001,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
@@ -2014,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 */
@@ -2032,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.
@@ -2101,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
@@ -2123,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
@@ -2132,11 +2179,11 @@ dosacrifice()
                                                : (const char *) "gray"));
 #else
                         pline("\8dÕ\92d\82Í%s\8bP\82¢\82½\81D",
-                              jconj_adj(hcolor((u.ualign.type == A_LAWFUL)
+                                  hcolor_adv((u.ualign.type == A_LAWFUL)
                                             ? NH_WHITE
                                             : u.ualign.type
                                                ? NH_BLACK
-                                               : (const char *)"\8aD\90F\82Ì")));
+                                               : (const char *)"\8aD\90F\82Ì"));
 #endif
 
                     if (rnl(u.ulevel) > 6 && u.ualign.record > 0
@@ -2171,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
@@ -2182,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");
@@ -2293,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
@@ -2301,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.",
@@ -2329,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
@@ -2438,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?"
@@ -2464,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);
@@ -2508,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)) {
@@ -2533,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
@@ -2590,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) {
@@ -2617,6 +2698,22 @@ doturn()
             }
         }
     }
+
+    /*
+     *  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";
@@ -2683,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 */
@@ -2728,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;
@@ -2749,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;
@@ -2759,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 */
@@ -2808,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);
     }
 }
 
@@ -2833,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;
@@ -2841,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 */
@@ -2848,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;