OSDN Git Service

upgrade to 3.6.1
[jnethack/source.git] / src / priest.c
index b58f1a1..74e0be9 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 priest.c        $NHDT-Date: 1446892452 2015/11/07 10:34:12 $  $NHDT-Branch: master $:$NHDT-Revision: 1.41 $ */
+/* NetHack 3.6 priest.c        $NHDT-Date: 1501725407 2017/08/03 01:56:47 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.44 $ */
 /* Copyright (c) Izchak Miller, Steve Linhart, 1989.              */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -586,14 +586,17 @@ int roomno;
         if (!rn2(5)
             && (mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, NO_MM_FLAGS))
                    != 0) {
-            /* [TODO: alter this (at a minimum, by switching from
-               an exclamation to a simple declaration) if hero has
-               already killed enough ghosts.] */
+            int ngen = mvitals[PM_GHOST].born;
             if (canspotmon(mtmp))
-/*JP
-                pline("An enormous ghost appears next to you!");
-*/
-                pline("\8b\90\91å\82È\97H\97ì\82ª\82 \82È\82½\82Ì\82·\82®\82»\82Î\82É\8c»\82í\82ê\82½\81I");
+#if 0 /*JP:T*/
+                pline("A%s ghost appears next to you%c",
+                      ngen < 5 ? "n enormous" : "",
+                      ngen < 10 ? '!' : '.');
+#else
+                pline("%s\97H\97ì\82ª\82 \82È\82½\82Ì\82·\82®\82»\82Î\82É\8c»\82í\82ê\82½%s",
+                      ngen < 5 ? "\8b\90\91å\82È" : "",
+                      ngen < 10 ? "\81I" : "\81D");
+#endif
             else
 /*JP
                 You("sense a presence close by!");
@@ -608,9 +611,9 @@ int roomno;
                 You("\82Ü\82Á\82³\82¨\82É\82È\82Á\82Ä\8bÁ\82«\81C\93®\82¯\82È\82­\82È\82Á\82½\81D");
             nomul(-3);
 /*JP
-            multi_reason = "being terrified of a demon";
+            multi_reason = "being terrified of a ghost";
 */
-            multi_reason = "\88«\97ì\82É\8b°\95|\82µ\82Ä\82¢\82é\8e\9e\82É";
+            multi_reason = "\97H\97ì\82É\8b°\95|\82µ\82Ä\82¢\82é\8e\9e\82É";
 /*JP
             nomovemsg = "You regain your composure.";
 */
@@ -939,11 +942,13 @@ struct monst *priest;
               a_gname_at(ax, ay));
         break;
     case 1:
-/*JP
+#if 0 /*JP*/
         pline("%s voice booms:  \"How darest thou harm my servant!\"",
-*/
-        pline("%s\82Ì\90º\82ª\8b¿\82¢\82½\81F\81u\82í\82ª\89º\96l\82É\8bê\82µ\82Þ\82ª\82æ\82¢\81I\81v",
               s_suffix(a_gname_at(ax, ay)));
+#else
+        pline("%s\82Ì\90º\82ª\8b¿\82¢\82½\81F\81u\82í\82ª\89º\96l\82É\8bê\82µ\82Þ\82ª\82æ\82¢\81I\81v",
+              a_gname_at(ax, ay));
+#endif
         break;
     default:
 /*JP
@@ -968,7 +973,8 @@ angry_priest()
     if ((priest = findpriest(temple_occupied(u.urooms))) != 0) {
         struct epri *eprip = EPRI(priest);
 
-        wakeup(priest);
+        wakeup(priest, FALSE);
+        setmangry(priest, FALSE);
         /*
          * If the altar has been destroyed or converted, let the
          * priest run loose.
@@ -1024,4 +1030,422 @@ boolean ghostly;
     }
 }
 
+/*
+ * align_str(), piousness(), mstatusline() and ustatusline() used to be
+ * in pline.c, presumeably because the latter two generate one line of
+ * output.  The USE_OLDARGS config gets warnings from 2016ish-vintage
+ * gcc (for -Wint-to-pointer-cast, activated by -Wall or -W) when they
+ * follow pline() itself.  Fixing up the variadic calls like is done for
+ * lev_comp would be needlessly messy there.
+ *
+ * They don't belong here.  If/when enlightenment ever gets split off
+ * from cmd.c (which definitely doesn't belong there), they should go
+ * with it.
+ */
+
+const char *
+align_str(alignment)
+aligntyp alignment;
+{
+    switch ((int) alignment) {
+    case A_CHAOTIC:
+/*JP
+        return "chaotic";
+*/
+        return "\8d¬\93×";
+    case A_NEUTRAL:
+/*JP
+        return "neutral";
+*/
+        return "\92\86\97§";
+    case A_LAWFUL:
+/*JP
+        return "lawful";
+*/
+        return "\92\81\8f\98";
+    case A_NONE:
+/*JP
+        return "unaligned";
+*/
+        return "\96³\90S";
+    }
+/*JP
+    return "unknown";
+*/
+    return "\95s\96¾";
+}
+
+/* used for self-probing */
+char *
+piousness(showneg, suffix)
+boolean showneg;
+const char *suffix;
+{
+    static char buf[32]; /* bigger than "insufficiently neutral" */
+    const char *pio;
+
+    /* note: piousness 20 matches MIN_QUEST_ALIGN (quest.h) */
+    if (u.ualign.record >= 20)
+/*JP
+        pio = "piously";
+*/
+        pio = "\8chåi\82È";
+    else if (u.ualign.record > 13)
+/*JP
+        pio = "devoutly";
+*/
+        pio = "\90M\90S\90[\82¢";
+    else if (u.ualign.record > 8)
+/*JP
+        pio = "fervently";
+*/
+        pio = "\94M\90S\82È";
+    else if (u.ualign.record > 3)
+/*JP
+        pio = "stridently";
+*/
+        pio = "\91å\82°\82³\82È";
+    else if (u.ualign.record == 3)
+        pio = "";
+    else if (u.ualign.record > 0)
+/*JP
+        pio = "haltingly";
+*/
+        pio = "\95s\8a®\91S\82È";
+    else if (u.ualign.record == 0)
+/*JP
+        pio = "nominally";
+*/
+        pio = "\8c`\82¾\82¯\82Ì";
+    else if (!showneg)
+/*JP
+        pio = "insufficiently";
+*/
+        pio = "\95s\8f\\95ª\82È";
+    else if (u.ualign.record >= -3)
+/*JP
+        pio = "strayed";
+*/
+        pio = "\96À\82¢\82ð\8e\9d\82Á\82½";
+    else if (u.ualign.record >= -8)
+/*JP
+        pio = "sinned";
+*/
+        pio = "\8dß\82ð\95\89\82Á\82½";
+    else
+/*JP
+        pio = "transgressed";
+*/
+        pio = "\88í\92E\82µ\82½";
+
+    Sprintf(buf, "%s", pio);
+    if (suffix && (!showneg || u.ualign.record >= 0)) {
+        if (u.ualign.record != 3)
+            Strcat(buf, " ");
+        Strcat(buf, suffix);
+    }
+    return buf;
+}
+
+/* stethoscope or probing applied to monster -- one-line feedback */
+void
+mstatusline(mtmp)
+struct monst *mtmp;
+{
+    aligntyp alignment = mon_aligntyp(mtmp);
+    char info[BUFSZ], monnambuf[BUFSZ];
+
+    info[0] = 0;
+    if (mtmp->mtame) {
+/*JP
+        Strcat(info, ", tame");
+*/
+        Strcat(info, ", \8e\94\82¢\82È\82ç\82³\82ê\82Ä\82¢\82é");
+        if (wizard) {
+            Sprintf(eos(info), " (%d", mtmp->mtame);
+            if (!mtmp->isminion)
+                Sprintf(eos(info), "; hungry %ld; apport %d",
+                        EDOG(mtmp)->hungrytime, EDOG(mtmp)->apport);
+            Strcat(info, ")");
+        }
+    } else if (mtmp->mpeaceful)
+/*JP
+        Strcat(info, ", peaceful");
+*/
+        Strcat(info, ", \97F\8dD\93I");
+
+    if (mtmp->data == &mons[PM_LONG_WORM]) {
+        int segndx, nsegs = count_wsegs(mtmp);
+
+        /* the worm code internals don't consider the head of be one of
+           the worm's segments, but we count it as such when presenting
+           worm feedback to the player */
+        if (!nsegs) {
+            Strcat(info, ", single segment");
+        } else {
+            ++nsegs; /* include head in the segment count */
+            segndx = wseg_at(mtmp, bhitpos.x, bhitpos.y);
+            Sprintf(eos(info), ", %d%s of %d segments",
+                    segndx, ordin(segndx), nsegs);
+        }
+    }
+    if (mtmp->cham >= LOW_PM && mtmp->data != &mons[mtmp->cham])
+        /* don't reveal the innate form (chameleon, vampire, &c),
+           just expose the fact that this current form isn't it */
+/*JP
+        Strcat(info, ", shapechanger");
+*/
+        Strcat(info, ", \95Ï\89»");
+    /* pets eating mimic corpses mimic while eating, so this comes first */
+    if (mtmp->meating)
+/*JP
+        Strcat(info, ", eating");
+*/
+        Strcat(info, ", \90H\8e\96\92\86");
+    /* a stethoscope exposes mimic before getting here so this
+       won't be relevant for it, but wand of probing doesn't */
+    if (mtmp->mundetected || mtmp->m_ap_type)
+        mhidden_description(mtmp, TRUE, eos(info));
+    if (mtmp->mcan)
+/*JP
+        Strcat(info, ", cancelled");
+*/
+        Strcat(info, ", \96³\97Í");
+    if (mtmp->mconf)
+/*JP
+        Strcat(info, ", confused");
+*/
+        Strcat(info, ", \8d¬\97\90\8fó\91Ô");
+    if (mtmp->mblinded || !mtmp->mcansee)
+/*JP
+        Strcat(info, ", blind");
+*/
+        Strcat(info, ", \96Ó\96Ú");
+    if (mtmp->mstun)
+/*JP
+        Strcat(info, ", stunned");
+*/
+        Strcat(info, ", \82­\82ç\82­\82ç\8fó\91Ô");
+    if (mtmp->msleeping)
+/*JP
+        Strcat(info, ", asleep");
+*/
+        Strcat(info, ", \90\87\96°\8fó\91Ô");
+#if 0 /* unfortunately mfrozen covers temporary sleep and being busy \
+         (donning armor, for instance) as well as paralysis */
+    else if (mtmp->mfrozen)
+        Strcat(info, ", paralyzed");
+#else
+    else if (mtmp->mfrozen || !mtmp->mcanmove)
+/*JP
+        Strcat(info, ", can't move");
+*/
+        Strcat(info, ", \93®\82¯\82È\82¢");
+#endif
+    /* [arbitrary reason why it isn't moving] */
+    else if (mtmp->mstrategy & STRAT_WAITMASK)
+/*JP
+        Strcat(info, ", meditating");
+*/
+        Strcat(info, ", \96»\91z\92\86");
+    if (mtmp->mflee)
+/*JP
+        Strcat(info, ", scared");
+*/
+        Strcat(info, ", \8b¯\82¦\82Ä\82¢\82é");
+    if (mtmp->mtrapped)
+/*JP
+        Strcat(info, ", trapped");
+*/
+        Strcat(info, ", ã©\82É\82©\82©\82Á\82Ä\82¢\82é");
+    if (mtmp->mspeed)
+#if 0 /*JP:T*/
+        Strcat(info, (mtmp->mspeed == MFAST) ? ", fast"
+                      : (mtmp->mspeed == MSLOW) ? ", slow"
+                         : ", [? speed]");
+#else
+        Strcat(info, (mtmp->mspeed == MFAST) ? ", \91f\91\81\82¢"
+                      : (mtmp->mspeed == MSLOW) ? ", \92x\82¢"
+                         : ", \91¬\93x\95s\96¾");
+#endif
+    if (mtmp->minvis)
+/*JP
+        Strcat(info, ", invisible");
+*/
+        Strcat(info, ", \95s\89Â\8e\8b");
+    if (mtmp == u.ustuck)
+#if 0 /*JP*/
+        Strcat(info, sticks(youmonst.data) ? ", held by you"
+                      : !u.uswallow ? ", holding you"
+                         : attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_DGST)
+                            ? ", digesting you"
+                            : is_animal(u.ustuck->data) ? ", swallowing you"
+                               : ", engulfing you");
+#else
+        Strcat(info, sticks(youmonst.data) ? ", \82 \82È\82½\82ª\92Í\82Ü\82¦\82Ä\82¢\82é"
+                      : !u.uswallow ? ", \92Í\82Ü\82¦\82Ä\82¢\82é"
+                         : attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_DGST)
+                            ? ", \8fÁ\89»\82µ\82Ä\82¢\82é"
+                            : is_animal(u.ustuck->data) ? ", \88ù\82Ý\8d\9e\82ñ\82Å\82¢\82é"
+                               : ", \8aª\82«\8d\9e\82ñ\82Å\82¢\82é");
+#endif
+    if (mtmp == u.usteed)
+/*JP
+        Strcat(info, ", carrying you");
+*/
+        Strcat(info, ", \82 \82È\82½\82ð\8fæ\82¹\82Ä\82¢\82é");
+
+    /* avoid "Status of the invisible newt ..., invisible" */
+    /* and unlike a normal mon_nam, use "saddled" even if it has a name */
+    Strcpy(monnambuf, x_monnam(mtmp, ARTICLE_THE, (char *) 0,
+                               (SUPPRESS_IT | SUPPRESS_INVISIBLE), FALSE));
+
+/*JP
+    pline("Status of %s (%s):  Level %d  HP %d(%d)  AC %d%s.", monnambuf,
+*/
+    pline("%s\82Ì\8fó\91Ô (%s)\81F Level %d  HP %d(%d)  AC %d%s", monnambuf,
+          align_str(alignment), mtmp->m_lev, mtmp->mhp, mtmp->mhpmax,
+          find_mac(mtmp), info);
+}
+
+/* stethoscope or probing applied to hero -- one-line feedback */
+void
+ustatusline()
+{
+    char info[BUFSZ];
+
+    info[0] = '\0';
+    if (Sick) {
+#if 0 /*JP*/
+        Strcat(info, ", dying from");
+        if (u.usick_type & SICK_VOMITABLE)
+            Strcat(info, " food poisoning");
+        if (u.usick_type & SICK_NONVOMITABLE) {
+            if (u.usick_type & SICK_VOMITABLE)
+                Strcat(info, " and");
+            Strcat(info, " illness");
+        }
+#else
+        Strcat(info, ", ");
+        if (u.usick_type & SICK_VOMITABLE)
+            Strcat(info, "\90H\92\86\93Å");
+        if (u.usick_type & SICK_NONVOMITABLE) {
+            if (u.usick_type & SICK_VOMITABLE)
+                Strcat(info, "\82Æ");
+            Strcat(info, "\95a\8bC");
+        }
+        Strcat(info, "\82Å\8e\80\82É\82Â\82Â\82 \82é");
+#endif
+    }
+    if (Stoned)
+/*JP
+        Strcat(info, ", solidifying");
+*/
+        Strcat(info, ", \90Î\89»\82µ\82Â\82Â\82 \82é");
+    if (Slimed)
+/*JP
+        Strcat(info, ", becoming slimy");
+*/
+        Strcat(info, ", \83X\83\89\83C\83\80\82É\82È\82è\82Â\82Â\82 \82é");
+    if (Strangled)
+/*JP
+        Strcat(info, ", being strangled");
+*/
+        Strcat(info, ", \8eñ\82ð\8di\82ß\82ç\82ê\82Ä\82¢\82é");
+    if (Vomiting)
+#if 0 /*JP*/
+        Strcat(info, ", nauseated"); /* !"nauseous" */
+#else
+        Strcat(info, ", \93f\82«\8bC\82ª\82·\82é");
+#endif
+    if (Confusion)
+/*JP
+        Strcat(info, ", confused");
+*/
+        Strcat(info, ", \8d¬\97\90\8fó\91Ô");
+    if (Blind) {
+#if 0 /*JP*/
+        Strcat(info, ", blind");
+        if (u.ucreamed) {
+            if ((long) u.ucreamed < Blinded || Blindfolded
+                || !haseyes(youmonst.data))
+                Strcat(info, ", cover");
+            Strcat(info, "ed by sticky goop");
+        } /* note: "goop" == "glop"; variation is intentional */
+#else
+        Strcat(info, ", ");
+        if (u.ucreamed) {
+            Strcat(info, "\82Ë\82Î\82Ë\82Î\82×\82Æ\82Â\82­\82à\82Ì\82Å");
+            if ((long)u.ucreamed < Blinded || Blindfolded
+                || !haseyes(youmonst.data))
+              Strcat(info, "\95¢\82í\82ê\82Ä");
+        }
+        Strcat(info, "\96Ó\96Ú\8fó\91Ô");
+#endif
+    }
+    if (Stunned)
+/*JP
+        Strcat(info, ", stunned");
+*/
+        Strcat(info, ", \82­\82ç\82­\82ç\8fó\91Ô");
+    if (!u.usteed && Wounded_legs) {
+        const char *what = body_part(LEG);
+        if ((Wounded_legs & BOTH_SIDES) == BOTH_SIDES)
+            what = makeplural(what);
+/*JP
+        Sprintf(eos(info), ", injured %s", what);
+*/
+        Sprintf(eos(info), ", %s\82É\82¯\82ª\82ð\82µ\82Ä\82¢\82é", what);
+    }
+    if (Glib)
+/*JP
+        Sprintf(eos(info), ", slippery %s", makeplural(body_part(HAND)));
+*/
+        Sprintf(eos(info), ", %s\82ª\82Ê\82é\82Ê\82é", makeplural(body_part(HAND)));
+    if (u.utrap)
+/*JP
+        Strcat(info, ", trapped");
+*/
+        Strcat(info, ", ã©\82É\82©\82©\82Á\82Ä\82¢\82é");
+    if (Fast)
+/*JP
+        Strcat(info, Very_fast ? ", very fast" : ", fast");
+*/
+        Strcat(info, Very_fast ? ", \82Æ\82Ä\82à\91f\91\81\82¢" : ", \91f\91\81\82¢");
+    if (u.uundetected)
+/*JP
+        Strcat(info, ", concealed");
+*/
+        Strcat(info, ", \89B\82ê\82Ä\82¢\82é");
+    if (Invis)
+/*JP
+        Strcat(info, ", invisible");
+*/
+        Strcat(info, ", \95s\89Â\8e\8b");
+    if (u.ustuck) {
+#if 0 /*JP*/
+        if (sticks(youmonst.data))
+            Strcat(info, ", holding ");
+        else
+            Strcat(info, ", held by ");
+        Strcat(info, mon_nam(u.ustuck));
+#else
+        Strcat(info, ", ");
+        Strcat(info, mon_nam(u.ustuck));
+        if (sticks(youmonst.data))
+            Strcat(info, "\82ð\92Í\82Ü\82¦\82Ä\82¢\82é");
+        else
+            Strcat(info, "\82É\92Í\82Ü\82¦\82ç\82ê\82Ä\82¢\82é");
+#endif
+    }
+
+/*JP
+    pline("Status of %s (%s):  Level %d  HP %d(%d)  AC %d%s.", plname,
+*/
+    pline("%s\82Ì\8fó\91Ô (%s)\81F Level %d  HP %d(%d)  AC %d%s", plname,
+          piousness(FALSE, align_str(u.ualign.type)),
+          Upolyd ? mons[u.umonnum].mlevel : u.ulevel, Upolyd ? u.mh : u.uhp,
+          Upolyd ? u.mhmax : u.uhpmax, u.uac, info);
+}
+
 /*priest.c*/