# Source:NetHack 3.6.1/src/priest.c
Below is the full text to priest.c from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/src/priest.c#line123]], for example.

Contents

1 Top of file
2 newepri
3 free_epri
4 move_special
5 temple_occupied
6 histemple_at
7 inhistemple
8 pri_move
9 priestini
10 mon_aligntyp
11 priestname
12 p_coaligned
13 has_shrine
14 findpriest
15 intemple
16 forget_temple_entry
17 priest_talk
18 mk_roamer
19 reset_hostility
20 in_your_sanctuary
21 ghod_hitsu
22 angry_priest
23 clearpriests
24 restpriest
25 align_str
26 piousness
27 mstatusline
28 ustatusline

Top of file
&nbsp;/* NetHack 3.6	priest.c	$NHDT-Date: 1501725407 2017/08/03 01:56:47 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.44 $ */
&nbsp;/* Copyright (c) Izchak Miller, Steve Linhart, 1989.              */
&nbsp;/* NetHack may be freely redistributed.  See license for details. */

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

&nbsp;
&nbsp;#include "hack.h"
&nbsp;#include "mfndpos.h"
&nbsp;
&nbsp;/* these match the categorizations shown by enlightenment */
&nbsp;#define ALGN_SINNED (-4) /* worse than strayed (-1..-3) */
&nbsp;#define ALGN_PIOUS 14    /* better than fervent (9..13) */
&nbsp;
&nbsp;STATIC_DCL boolean FDECL(histemple_at, (struct monst *, XCHAR_P, XCHAR_P));
&nbsp;STATIC_DCL boolean FDECL(has_shrine, (struct monst *));
&nbsp;
newepri
&nbsp;void
&nbsp;newepri(mtmp)
&nbsp;struct monst *mtmp;
&nbsp;{
&nbsp;    if (!mtmp-&gt;mextra)
&nbsp;        mtmp-&gt;mextra = newmextra();
&nbsp;    if (!EPRI(mtmp)) {
&nbsp;        EPRI(mtmp) = (struct epri *) alloc(sizeof(struct epri));
&nbsp;        (void) memset((genericptr_t) EPRI(mtmp), 0, sizeof(struct epri));
&nbsp;    }
&nbsp;}
&nbsp;
free_epri
&nbsp;void
&nbsp;free_epri(mtmp)
&nbsp;struct monst *mtmp;
&nbsp;{
&nbsp;    if (mtmp-&gt;mextra &amp;&amp; EPRI(mtmp)) {
&nbsp;        free((genericptr_t) EPRI(mtmp));
&nbsp;        EPRI(mtmp) = (struct epri *) 0;
&nbsp;    }
&nbsp;    mtmp-&gt;ispriest = 0;
&nbsp;}
&nbsp;
move_special
&nbsp;/*
&nbsp; * Move for priests and shopkeepers.  Called from shk_move() and pri_move().
&nbsp; * Valid returns are  1: moved  0: didn't  -1: let m_move do it  -2: died.
&nbsp; */
&nbsp;int
&nbsp;move_special(mtmp, in_his_shop, appr, uondoor, avoid, omx, omy, gx, gy)
&nbsp;register struct monst *mtmp;
&nbsp;boolean in_his_shop;
&nbsp;schar appr;
&nbsp;boolean uondoor, avoid;
&nbsp;register xchar omx, omy, gx, gy;
&nbsp;{
&nbsp;    register xchar nx, ny, nix, niy;
&nbsp;    register schar i;
&nbsp;    schar chcnt, cnt;
&nbsp;    coord poss[9];
&nbsp;    long info[9];
&nbsp;    long allowflags;
&nbsp;    struct obj *ib = (struct obj *) 0;
&nbsp;
&nbsp;    if (omx == gx &amp;&amp; omy == gy)
&nbsp;        return 0;
&nbsp;    if (mtmp-&gt;mconf) {
&nbsp;        avoid = FALSE;
&nbsp;        appr = 0;
&nbsp;    }
&nbsp;
&nbsp;    nix = omx;
&nbsp;    niy = omy;
&nbsp;    if (mtmp-&gt;isshk)
&nbsp;        allowflags = ALLOW_SSM;
&nbsp;    else
&nbsp;        allowflags = ALLOW_SSM | ALLOW_SANCT;
&nbsp;    if (passes_walls(mtmp-&gt;data))
&nbsp;        allowflags |= (ALLOW_ROCK | ALLOW_WALL);
&nbsp;    if (throws_rocks(mtmp-&gt;data))
&nbsp;        allowflags |= ALLOW_ROCK;
&nbsp;    if (tunnels(mtmp-&gt;data))
&nbsp;        allowflags |= ALLOW_DIG;
&nbsp;    if (!nohands(mtmp-&gt;data) &amp;&amp; !verysmall(mtmp-&gt;data)) {
&nbsp;        allowflags |= OPENDOOR;
&nbsp;        if (monhaskey(mtmp, TRUE))
&nbsp;            allowflags |= UNLOCKDOOR;
&nbsp;    }
&nbsp;    if (is_giant(mtmp-&gt;data))
&nbsp;        allowflags |= BUSTDOOR;
&nbsp;    cnt = mfndpos(mtmp, poss, info, allowflags);
&nbsp;
&nbsp;    if (mtmp-&gt;isshk &amp;&amp; avoid &amp;&amp; uondoor) { /* perhaps we cannot avoid him */
&nbsp;        for (i = 0; i &lt; cnt; i++)
&nbsp;            if (!(info[i] &amp; NOTONL))
&nbsp;                goto pick_move;
&nbsp;        avoid = FALSE;
&nbsp;    }
&nbsp;
&nbsp;#define GDIST(x, y) (dist2(x, y, gx, gy))
&nbsp;pick_move:
&nbsp;    chcnt = 0;
&nbsp;    for (i = 0; i &lt; cnt; i++) {
&nbsp;        nx = poss[i].x;
&nbsp;        ny = poss[i].y;
&nbsp;        if (IS_ROOM(levl[nx][ny].typ)
&nbsp;            || (mtmp-&gt;isshk &amp;&amp; (!in_his_shop || ESHK(mtmp)-&gt;following))) {
&nbsp;            if (avoid &amp;&amp; (info[i] &amp; NOTONL))
&nbsp;                continue;
&nbsp;            if ((!appr &amp;&amp; !rn2(++chcnt))
&nbsp;                || (appr &amp;&amp; GDIST(nx, ny) &lt; GDIST(nix, niy))) {
&nbsp;                nix = nx;
&nbsp;                niy = ny;
&nbsp;            }
&nbsp;        }
&nbsp;    }
&nbsp;    if (mtmp-&gt;ispriest &amp;&amp; avoid &amp;&amp; nix == omx &amp;&amp; niy == omy
&nbsp;        &amp;&amp; onlineu(omx, omy)) {
&nbsp;        /* might as well move closer as long it's going to stay
&nbsp;         * lined up */
&nbsp;        avoid = FALSE;
&nbsp;        goto pick_move;
&nbsp;    }
&nbsp;
&nbsp;    if (nix != omx || niy != omy) {
&nbsp;        remove_monster(omx, omy);
&nbsp;        place_monster(mtmp, nix, niy);
&nbsp;        newsym(nix, niy);
&nbsp;        if (mtmp-&gt;isshk &amp;&amp; !in_his_shop &amp;&amp; inhishop(mtmp))
&nbsp;            check_special_room(FALSE);
&nbsp;        if (ib) {
&nbsp;            if (cansee(mtmp-&gt;mx, mtmp-&gt;my))
&nbsp;                pline("%s picks up %s.", Monnam(mtmp),
&nbsp;                      distant_name(ib, doname));
&nbsp;            obj_extract_self(ib);
&nbsp;            (void) mpickobj(mtmp, ib);
&nbsp;        }
&nbsp;        return 1;
&nbsp;    }
&nbsp;    return 0;
&nbsp;}
&nbsp;
temple_occupied
&nbsp;char
&nbsp;temple_occupied(array)
&nbsp;register char *array;
&nbsp;{
&nbsp;    register char *ptr;
&nbsp;
&nbsp;    for (ptr = array; *ptr; ptr++)
&nbsp;        if (rooms[*ptr - ROOMOFFSET].rtype == TEMPLE)
&nbsp;            return *ptr;
&nbsp;    return '\0';
&nbsp;}
&nbsp;
histemple_at
&nbsp;STATIC_OVL boolean
&nbsp;histemple_at(priest, x, y)
&nbsp;register struct monst *priest;
&nbsp;register xchar x, y;
&nbsp;{
&nbsp;    return (boolean) (priest &amp;&amp; priest-&gt;ispriest
&nbsp;                      &amp;&amp; (EPRI(priest)-&gt;shroom == *in_rooms(x, y, TEMPLE))
&nbsp;                      &amp;&amp; on_level(&amp;(EPRI(priest)-&gt;shrlevel), &amp;u.uz));
&nbsp;}
&nbsp;
inhistemple
&nbsp;boolean
&nbsp;inhistemple(priest)
&nbsp;struct monst *priest;
&nbsp;{
&nbsp;    /* make sure we have a priest */
&nbsp;    if (!priest || !priest-&gt;ispriest)
&nbsp;        return FALSE;
&nbsp;    /* priest must be on right level and in right room */
&nbsp;    if (!histemple_at(priest, priest-&gt;mx, priest-&gt;my))
&nbsp;        return FALSE;
&nbsp;    /* temple room must still contain properly aligned altar */
&nbsp;    return has_shrine(priest);
&nbsp;}
&nbsp;
pri_move
&nbsp;/*
&nbsp; * pri_move: return 1: moved  0: didn't  -1: let m_move do it  -2: died
&nbsp; */
&nbsp;int
&nbsp;pri_move(priest)
&nbsp;register struct monst *priest;
&nbsp;{
&nbsp;    register xchar gx, gy, omx, omy;
&nbsp;    schar temple;
&nbsp;    boolean avoid = TRUE;
&nbsp;
&nbsp;    omx = priest-&gt;mx;
&nbsp;    omy = priest-&gt;my;
&nbsp;
&nbsp;    if (!histemple_at(priest, omx, omy))
&nbsp;        return -1;
&nbsp;
&nbsp;    temple = EPRI(priest)-&gt;shroom;
&nbsp;
&nbsp;    gx = EPRI(priest)-&gt;shrpos.x;
&nbsp;    gy = EPRI(priest)-&gt;shrpos.y;
&nbsp;
&nbsp;    gx += rn1(3, -1); /* mill around the altar */
&nbsp;    gy += rn1(3, -1);
&nbsp;
&nbsp;    if (!priest-&gt;mpeaceful
&nbsp;        || (Conflict &amp;&amp; !resist(priest, RING_CLASS, 0, 0))) {
&nbsp;        if (monnear(priest, u.ux, u.uy)) {
&nbsp;            if (Displaced)
&nbsp;                Your("displaced image doesn't fool %s!", mon_nam(priest));
&nbsp;            (void) mattacku(priest);
&nbsp;            return 0;
&nbsp;        } else if (index(u.urooms, temple)) {
&nbsp;            /* chase player if inside temple &amp; can see him */
&nbsp;            if (priest-&gt;mcansee &amp;&amp; m_canseeu(priest)) {
&nbsp;                gx = u.ux;
&nbsp;                gy = u.uy;
&nbsp;            }
&nbsp;            avoid = FALSE;
&nbsp;        }
&nbsp;    } else if (Invis)
&nbsp;        avoid = FALSE;
&nbsp;
&nbsp;    return move_special(priest, FALSE, TRUE, FALSE, avoid, omx, omy, gx, gy);
&nbsp;}
&nbsp;
priestini
&nbsp;/* exclusively for mktemple() */
&nbsp;void
&nbsp;priestini(lvl, sroom, sx, sy, sanctum)
&nbsp;d_level *lvl;
&nbsp;struct mkroom *sroom;
&nbsp;int sx, sy;
&nbsp;boolean sanctum; /* is it the seat of the high priest? */
&nbsp;{
&nbsp;    struct monst *priest;
&nbsp;    struct obj *otmp;
&nbsp;    int cnt;
&nbsp;
&nbsp;    if (MON_AT(sx + 1, sy))
&nbsp;        (void) rloc(m_at(sx + 1, sy), FALSE); /* insurance */
&nbsp;
&nbsp;    priest = makemon(&amp;mons[sanctum ? PM_HIGH_PRIEST : PM_ALIGNED_PRIEST],
&nbsp;                     sx + 1, sy, MM_EPRI);
&nbsp;    if (priest) {
&nbsp;        EPRI(priest)-&gt;shroom = (schar) ((sroom - rooms) + ROOMOFFSET);
&nbsp;        EPRI(priest)-&gt;shralign = Amask2align(levl[sx][sy].altarmask);
&nbsp;        EPRI(priest)-&gt;shrpos.x = sx;
&nbsp;        EPRI(priest)-&gt;shrpos.y = sy;
&nbsp;        assign_level(&amp;(EPRI(priest)-&gt;shrlevel), lvl);
&nbsp;        priest-&gt;mtrapseen = ~0; /* traps are known */
&nbsp;        priest-&gt;mpeaceful = 1;
&nbsp;        priest-&gt;ispriest = 1;
&nbsp;        priest-&gt;isminion = 0;
&nbsp;        priest-&gt;msleeping = 0;
&nbsp;        set_malign(priest); /* mpeaceful may have changed */
&nbsp;
&nbsp;        /* now his/her goodies... */
&nbsp;        if (sanctum &amp;&amp; EPRI(priest)-&gt;shralign == A_NONE
&nbsp;            &amp;&amp; on_level(&amp;sanctum_level, &amp;u.uz)) {
&nbsp;            (void) mongets(priest, AMULET_OF_YENDOR);
&nbsp;        }
&nbsp;        /* 2 to 4 spellbooks */
&nbsp;        for (cnt = rn1(3, 2); cnt &gt; 0; --cnt) {
&nbsp;            (void) mpickobj(priest, mkobj(SPBOOK_CLASS, FALSE));
&nbsp;        }
&nbsp;        /* robe [via makemon()] */
&nbsp;        if (rn2(2) &amp;&amp; (otmp = which_armor(priest, W_ARMC)) != 0) {
&nbsp;            if (p_coaligned(priest))
&nbsp;                uncurse(otmp);
&nbsp;            else
&nbsp;                curse(otmp);
&nbsp;        }
&nbsp;    }
&nbsp;}
&nbsp;
mon_aligntyp
&nbsp;/* get a monster's alignment type without caller needing EPRI &amp; EMIN */
&nbsp;aligntyp
&nbsp;mon_aligntyp(mon)
&nbsp;struct monst *mon;
&nbsp;{
&nbsp;    aligntyp algn = mon-&gt;ispriest ? EPRI(mon)-&gt;shralign
&nbsp;                                  : mon-&gt;isminion ? EMIN(mon)-&gt;min_align
&nbsp;                                                  : mon-&gt;data-&gt;maligntyp;
&nbsp;
&nbsp;    if (algn == A_NONE)
&nbsp;        return A_NONE; /* negative but differs from chaotic */
&nbsp;    return (algn &gt; 0) ? A_LAWFUL : (algn &lt; 0) ? A_CHAOTIC : A_NEUTRAL;
&nbsp;}
&nbsp;
priestname
&nbsp;/*
&nbsp; * Specially aligned monsters are named specially.
&nbsp; *      - aligned priests with ispriest and high priests have shrines
&nbsp; *              they retain ispriest and epri when polymorphed
&nbsp; *      - aligned priests without ispriest are roamers
&nbsp; *              they have isminion set and use emin rather than epri
&nbsp; *      - minions do not have ispriest but have isminion and emin
&nbsp; *      - caller needs to inhibit Hallucination if it wants to force
&nbsp; *              the true name even when under that influence
&nbsp; */
&nbsp;char *
&nbsp;priestname(mon, pname)
&nbsp;register struct monst *mon;
&nbsp;char *pname; /* caller-supplied output buffer */
&nbsp;{
&nbsp;    boolean do_hallu = Hallucination,
&nbsp;            aligned_priest = mon-&gt;data == &amp;mons[PM_ALIGNED_PRIEST],
&nbsp;            high_priest = mon-&gt;data == &amp;mons[PM_HIGH_PRIEST];
&nbsp;    char whatcode = '\0';
&nbsp;    const char *what = do_hallu ? rndmonnam(&amp;whatcode) : mon-&gt;data-&gt;mname;
&nbsp;
&nbsp;    if (!mon-&gt;ispriest &amp;&amp; !mon-&gt;isminion) /* should never happen...  */
&nbsp;        return strcpy(pname, what);       /* caller must be confused */
&nbsp;
&nbsp;    *pname = '\0';
&nbsp;    if (!do_hallu || !bogon_is_pname(whatcode))
&nbsp;        Strcat(pname, "the ");
&nbsp;    if (mon-&gt;minvis)
&nbsp;        Strcat(pname, "invisible ");
&nbsp;    if (mon-&gt;isminion &amp;&amp; EMIN(mon)-&gt;renegade)
&nbsp;        Strcat(pname, "renegade ");
&nbsp;
&nbsp;    if (mon-&gt;ispriest || aligned_priest) { /* high_priest implies ispriest */
&nbsp;        if (!aligned_priest &amp;&amp; !high_priest) {
&nbsp;            ; /* polymorphed priest; use ``what'' as is */
&nbsp;        } else {
&nbsp;            if (high_priest)
&nbsp;                Strcat(pname, "high ");
&nbsp;            if (Hallucination)
&nbsp;                what = "poohbah";
&nbsp;            else if (mon-&gt;female)
&nbsp;                what = "priestess";
&nbsp;            else
&nbsp;                what = "priest";
&nbsp;        }
&nbsp;    } else {
&nbsp;        if (mon-&gt;mtame &amp;&amp; !strcmpi(what, "Angel"))
&nbsp;            Strcat(pname, "guardian ");
&nbsp;    }
&nbsp;
&nbsp;    Strcat(pname, what);
&nbsp;    /* same as distant_monnam(), more or less... */
&nbsp;    if (do_hallu || !high_priest || !Is_astralevel(&amp;u.uz)
&nbsp;        || distu(mon-&gt;mx, mon-&gt;my) &lt;= 2 || program_state.gameover) {
&nbsp;        Strcat(pname, " of ");
&nbsp;        Strcat(pname, halu_gname(mon_aligntyp(mon)));
&nbsp;    }
&nbsp;    return pname;
&nbsp;}
&nbsp;
p_coaligned
&nbsp;boolean
&nbsp;p_coaligned(priest)
&nbsp;struct monst *priest;
&nbsp;{
&nbsp;    return (boolean) (u.ualign.type == mon_aligntyp(priest));
&nbsp;}
&nbsp;
has_shrine
&nbsp;STATIC_OVL boolean
&nbsp;has_shrine(pri)
&nbsp;struct monst *pri;
&nbsp;{
&nbsp;    struct rm *lev;
&nbsp;    struct epri *epri_p;
&nbsp;
&nbsp;    if (!pri || !pri-&gt;ispriest)
&nbsp;        return FALSE;
&nbsp;    epri_p = EPRI(pri);
&nbsp;    lev = &amp;levl[epri_p-&gt;shrpos.x][epri_p-&gt;shrpos.y];
&nbsp;    if (!IS_ALTAR(lev-&gt;typ) || !(lev-&gt;altarmask &amp; AM_SHRINE))
&nbsp;        return FALSE;
&nbsp;    return (boolean) (epri_p-&gt;shralign
&nbsp;                      == (Amask2align(lev-&gt;altarmask &amp; ~AM_SHRINE)));
&nbsp;}
&nbsp;
findpriest
&nbsp;struct monst *
&nbsp;findpriest(roomno)
&nbsp;char roomno;
&nbsp;{
&nbsp;    register struct monst *mtmp;
&nbsp;
&nbsp;    for (mtmp = fmon; mtmp; mtmp = mtmp-&gt;nmon) {
&nbsp;        if (DEADMONSTER(mtmp))
&nbsp;            continue;
&nbsp;        if (mtmp-&gt;ispriest &amp;&amp; (EPRI(mtmp)-&gt;shroom == roomno)
&nbsp;            &amp;&amp; histemple_at(mtmp, mtmp-&gt;mx, mtmp-&gt;my))
&nbsp;            return mtmp;
&nbsp;    }
&nbsp;    return (struct monst *) 0;
&nbsp;}
&nbsp;
intemple
&nbsp;/* called from check_special_room() when the player enters the temple room */
&nbsp;void
&nbsp;intemple(roomno)
&nbsp;int roomno;
&nbsp;{
&nbsp;    struct monst *priest, *mtmp;
&nbsp;    struct epri *epri_p;
&nbsp;    boolean shrined, sanctum, can_speak;
&nbsp;    long *this_time, *other_time;
&nbsp;    const char *msg1, *msg2;
&nbsp;    char buf[BUFSZ];
&nbsp;
&nbsp;    /* don't do anything if hero is already in the room */
&nbsp;    if (temple_occupied(u.urooms0))
&nbsp;        return;
&nbsp;
&nbsp;    if ((priest = findpriest((char) roomno)) != 0) {
&nbsp;        /* tended */
&nbsp;
&nbsp;        epri_p = EPRI(priest);
&nbsp;        shrined = has_shrine(priest);
&nbsp;        sanctum = (priest-&gt;data == &amp;mons[PM_HIGH_PRIEST]
&nbsp;                   &amp;&amp; (Is_sanctum(&amp;u.uz) || In_endgame(&amp;u.uz)));
&nbsp;        can_speak = (priest-&gt;mcanmove &amp;&amp; !priest-&gt;msleeping);
&nbsp;        if (can_speak &amp;&amp; !Deaf &amp;&amp; moves &gt;= epri_p-&gt;intone_time) {
&nbsp;            unsigned save_priest = priest-&gt;ispriest;
&nbsp;
&nbsp;            /* don't reveal the altar's owner upon temple entry in
&nbsp;               the endgame; for the Sanctum, the next message names
&nbsp;               Moloch so suppress the "of Moloch" for him here too */
&nbsp;            if (sanctum &amp;&amp; !Hallucination)
&nbsp;                priest-&gt;ispriest = 0;
&nbsp;            pline("%s intones:",
&nbsp;                  canseemon(priest) ? Monnam(priest) : "A nearby voice");
&nbsp;            priest-&gt;ispriest = save_priest;
&nbsp;            epri_p-&gt;intone_time = moves + (long) d(10, 500); /* ~2505 */
&nbsp;            /* make sure that we don't suppress entry message when
&nbsp;               we've just given its "priest intones" introduction */
&nbsp;            epri_p-&gt;enter_time = 0L;
&nbsp;        }
&nbsp;        msg1 = msg2 = 0;
&nbsp;        if (sanctum &amp;&amp; Is_sanctum(&amp;u.uz)) {
&nbsp;            if (priest-&gt;mpeaceful) {
&nbsp;                /* first time inside */
&nbsp;                msg1 = "Infidel, you have entered Moloch's Sanctum!";
&nbsp;                msg2 = "Be gone!";
&nbsp;                priest-&gt;mpeaceful = 0;
&nbsp;                /* became angry voluntarily; no penalty for attacking him */
&nbsp;                set_malign(priest);
&nbsp;            } else {
&nbsp;                /* repeat visit, or attacked priest before entering */
&nbsp;                msg1 = "You desecrate this place by your presence!";
&nbsp;            }
&nbsp;        } else if (moves &gt;= epri_p-&gt;enter_time) {
&nbsp;            Sprintf(buf, "Pilgrim, you enter a %s place!",
&nbsp;                    !shrined ? "desecrated" : "sacred");
&nbsp;            msg1 = buf;
&nbsp;        }
&nbsp;        if (msg1 &amp;&amp; can_speak &amp;&amp; !Deaf) {
&nbsp;            verbalize1(msg1);
&nbsp;            if (msg2)
&nbsp;                verbalize1(msg2);
&nbsp;            epri_p-&gt;enter_time = moves + (long) d(10, 100); /* ~505 */
&nbsp;        }
&nbsp;        if (!sanctum) {
&nbsp;            if (!shrined || !p_coaligned(priest)
&nbsp;                || u.ualign.record &lt;= ALGN_SINNED) {
&nbsp;                msg1 = "have a%s forbidding feeling...";
&nbsp;                msg2 = (!shrined || !p_coaligned(priest)) ? "" : " strange";
&nbsp;                this_time = &amp;epri_p-&gt;hostile_time;
&nbsp;                other_time = &amp;epri_p-&gt;peaceful_time;
&nbsp;            } else {
&nbsp;                msg1 = "experience %s sense of peace.";
&nbsp;                msg2 = (u.ualign.record &gt;= ALGN_PIOUS) ? "a" : "an unusual";
&nbsp;                this_time = &amp;epri_p-&gt;peaceful_time;
&nbsp;                other_time = &amp;epri_p-&gt;hostile_time;
&nbsp;            }
&nbsp;            /* give message if we haven't seen it recently or
&nbsp;               if alignment update has caused it to switch from
&nbsp;               forbidding to sense-of-peace or vice versa */
&nbsp;            if (moves &gt;= *this_time || *other_time &gt;= *this_time) {
&nbsp;                You(msg1, msg2);
&nbsp;                *this_time = moves + (long) d(10, 20); /* ~55 */
&nbsp;                /* avoid being tricked by the RNG:  switch might have just
&nbsp;                   happened and previous random threshold could be larger */
&nbsp;                if (*this_time &lt;= *other_time)
&nbsp;                    *other_time = *this_time - 1L;
&nbsp;            }
&nbsp;        }
&nbsp;        /* recognize the Valley of the Dead and Moloch's Sanctum
&nbsp;           once hero has encountered the temple priest on those levels */
&nbsp;        mapseen_temple(priest);
&nbsp;    } else {
&nbsp;        /* untended */
&nbsp;
&nbsp;        switch (rn2(4)) {
&nbsp;        case 0:
&nbsp;            You("have an eerie feeling...");
&nbsp;            break;
&nbsp;        case 1:
&nbsp;            You_feel("like you are being watched.");
&nbsp;            break;
&nbsp;        case 2:
&nbsp;            pline("A shiver runs down your %s.", body_part(SPINE));
&nbsp;            break;
&nbsp;        default:
&nbsp;            break; /* no message; unfortunately there's no
&nbsp;                      EPRI(priest)-&gt;eerie_time available to
&nbsp;                      make sure we give one the first time */
&nbsp;        }
&nbsp;        if (!rn2(5)
&nbsp;            &amp;&amp; (mtmp = makemon(&amp;mons[PM_GHOST], u.ux, u.uy, NO_MM_FLAGS))
&nbsp;                   != 0) {
&nbsp;            int ngen = mvitals[PM_GHOST].born;
&nbsp;            if (canspotmon(mtmp))
&nbsp;                pline("A%s ghost appears next to you%c",
&nbsp;                      ngen &lt; 5 ? "n enormous" : "",
&nbsp;                      ngen &lt; 10 ? '!' : '.');
&nbsp;            else
&nbsp;                You("sense a presence close by!");
&nbsp;            mtmp-&gt;mpeaceful = 0;
&nbsp;            set_malign(mtmp);
&nbsp;            if (flags.verbose)
&nbsp;                You("are frightened to death, and unable to move.");
&nbsp;            nomul(-3);
&nbsp;            multi_reason = "being terrified of a ghost";
&nbsp;            nomovemsg = "You regain your composure.";
&nbsp;        }
&nbsp;    }
&nbsp;}
&nbsp;
forget_temple_entry
&nbsp;/* reset the move counters used to limit temple entry feedback;
&nbsp;   leaving the level and then returning yields a fresh start */
&nbsp;void
&nbsp;forget_temple_entry(priest)
&nbsp;struct monst *priest;
&nbsp;{
&nbsp;    struct epri *epri_p = priest-&gt;ispriest ? EPRI(priest) : 0;
&nbsp;
&nbsp;    if (!epri_p) {
&nbsp;        impossible("attempting to manipulate shrine data for non-priest?");
&nbsp;        return;
&nbsp;    }
&nbsp;    epri_p-&gt;intone_time = epri_p-&gt;enter_time = epri_p-&gt;peaceful_time =
&nbsp;        epri_p-&gt;hostile_time = 0L;
&nbsp;}
&nbsp;
priest_talk
&nbsp;void
&nbsp;priest_talk(priest)
&nbsp;register struct monst *priest;
&nbsp;{
&nbsp;    boolean coaligned = p_coaligned(priest);
&nbsp;    boolean strayed = (u.ualign.record &lt; 0);
&nbsp;
&nbsp;    /* KMH, conduct */
&nbsp;    u.uconduct.gnostic++;
&nbsp;
&nbsp;    if (priest-&gt;mflee || (!priest-&gt;ispriest &amp;&amp; coaligned &amp;&amp; strayed)) {
&nbsp;        pline("%s doesn't want anything to do with you!", Monnam(priest));
&nbsp;        priest-&gt;mpeaceful = 0;
&nbsp;        return;
&nbsp;    }
&nbsp;
&nbsp;    /* priests don't chat unless peaceful and in their own temple */
&nbsp;    if (!inhistemple(priest) || !priest-&gt;mpeaceful
&nbsp;        || !priest-&gt;mcanmove || priest-&gt;msleeping) {
&nbsp;        static const char *cranky_msg[3] = {
&nbsp;            "Thou wouldst have words, eh?  I'll give thee a word or two!",
&nbsp;            "Talk?  Here is what I have to say!",
&nbsp;            "Pilgrim, I would speak no longer with thee."
&nbsp;        };
&nbsp;
&nbsp;        if (!priest-&gt;mcanmove || priest-&gt;msleeping) {
&nbsp;            pline("%s breaks out of %s reverie!", Monnam(priest),
&nbsp;                  mhis(priest));
&nbsp;            priest-&gt;mfrozen = priest-&gt;msleeping = 0;
&nbsp;            priest-&gt;mcanmove = 1;
&nbsp;        }
&nbsp;        priest-&gt;mpeaceful = 0;
&nbsp;        verbalize1(cranky_msg[rn2(3)]);
&nbsp;        return;
&nbsp;    }
&nbsp;
&nbsp;    /* you desecrated the temple and now you want to chat? */
&nbsp;    if (priest-&gt;mpeaceful &amp;&amp; *in_rooms(priest-&gt;mx, priest-&gt;my, TEMPLE)
&nbsp;        &amp;&amp; !has_shrine(priest)) {
&nbsp;        verbalize(
&nbsp;              "Begone!  Thou desecratest this holy place with thy presence.");
&nbsp;        priest-&gt;mpeaceful = 0;
&nbsp;        return;
&nbsp;    }
&nbsp;    if (!money_cnt(invent)) {
&nbsp;        if (coaligned &amp;&amp; !strayed) {
&nbsp;            long pmoney = money_cnt(priest-&gt;minvent);
&nbsp;            if (pmoney &gt; 0L) {
&nbsp;                /* Note: two bits is actually 25 cents.  Hmm. */
&nbsp;                pline("%s gives you %s for an ale.", Monnam(priest),
&nbsp;                      (pmoney == 1L) ? "one bit" : "two bits");
&nbsp;                money2u(priest, pmoney &gt; 1L ? 2 : 1);
&nbsp;            } else
&nbsp;                pline("%s preaches the virtues of poverty.", Monnam(priest));
&nbsp;            exercise(A_WIS, TRUE);
&nbsp;        } else
&nbsp;            pline("%s is not interested.", Monnam(priest));
&nbsp;        return;
&nbsp;    } else {
&nbsp;        long offer;
&nbsp;
&nbsp;        pline("%s asks you for a contribution for the temple.",
&nbsp;              Monnam(priest));
&nbsp;        if ((offer = bribe(priest)) == 0) {
&nbsp;            verbalize("Thou shalt regret thine action!");
&nbsp;            if (coaligned)
&nbsp;                adjalign(-1);
&nbsp;        } else if (offer &lt; (u.ulevel * 200)) {
&nbsp;            if (money_cnt(invent) &gt; (offer * 2L)) {
&nbsp;                verbalize("Cheapskate.");
&nbsp;            } else {
&nbsp;                verbalize("I thank thee for thy contribution.");
&nbsp;                /* give player some token */
&nbsp;                exercise(A_WIS, TRUE);
&nbsp;            }
&nbsp;        } else if (offer &lt; (u.ulevel * 400)) {
&nbsp;            verbalize("Thou art indeed a pious individual.");
&nbsp;            if (money_cnt(invent) &lt; (offer * 2L)) {
&nbsp;                if (coaligned &amp;&amp; u.ualign.record &lt;= ALGN_SINNED)
&nbsp;                    adjalign(1);
&nbsp;                verbalize("I bestow upon thee a blessing.");
&nbsp;                incr_itimeout(&amp;HClairvoyant, rn1(500, 500));
&nbsp;            }
&nbsp;        } else if (offer &lt; (u.ulevel * 600)
&nbsp;                   /* u.ublessed is only active when Protection is
&nbsp;                      enabled via something other than worn gear
&nbsp;                      (theft by gremlin clears the intrinsic but not
&nbsp;                      its former magnitude, making it recoverable) */
&nbsp;                   &amp;&amp; (!(HProtection &amp; INTRINSIC)
&nbsp;                       || (u.ublessed &lt; 20
&nbsp;                           &amp;&amp; (u.ublessed &lt; 9 || !rn2(u.ublessed))))) {
&nbsp;            verbalize("Thy devotion has been rewarded.");
&nbsp;            if (!(HProtection &amp; INTRINSIC)) {
&nbsp;                HProtection |= FROMOUTSIDE;
&nbsp;                if (!u.ublessed)
&nbsp;                    u.ublessed = rn1(3, 2);
&nbsp;            } else
&nbsp;                u.ublessed++;
&nbsp;        } else {
&nbsp;            verbalize("Thy selfless generosity is deeply appreciated.");
&nbsp;            if (money_cnt(invent) &lt; (offer * 2L) &amp;&amp; coaligned) {
&nbsp;                if (strayed &amp;&amp; (moves - u.ucleansed) &gt; 5000L) {
&nbsp;                    u.ualign.record = 0; /* cleanse thee */
&nbsp;                    u.ucleansed = moves;
&nbsp;                } else {
&nbsp;                    adjalign(2);
&nbsp;                }
&nbsp;            }
&nbsp;        }
&nbsp;    }
&nbsp;}
&nbsp;
mk_roamer
&nbsp;struct monst *
&nbsp;mk_roamer(ptr, alignment, x, y, peaceful)
&nbsp;register struct permonst *ptr;
&nbsp;aligntyp alignment;
&nbsp;xchar x, y;
&nbsp;boolean peaceful;
&nbsp;{
&nbsp;    register struct monst *roamer;
&nbsp;    register boolean coaligned = (u.ualign.type == alignment);
&nbsp;
&nbsp;#if 0 /* this was due to permonst's pxlth field which is now gone */
&nbsp;    if (ptr != &amp;mons[PM_ALIGNED_PRIEST] &amp;&amp; ptr != &amp;mons[PM_ANGEL])
&nbsp;        return (struct monst *) 0;
&nbsp;#endif
&nbsp;
&nbsp;    if (MON_AT(x, y))
&nbsp;        (void) rloc(m_at(x, y), FALSE); /* insurance */
&nbsp;
&nbsp;    if (!(roamer = makemon(ptr, x, y, MM_ADJACENTOK | MM_EMIN)))
&nbsp;        return (struct monst *) 0;
&nbsp;
&nbsp;    EMIN(roamer)-&gt;min_align = alignment;
&nbsp;    EMIN(roamer)-&gt;renegade = (coaligned &amp;&amp; !peaceful);
&nbsp;    roamer-&gt;ispriest = 0;
&nbsp;    roamer-&gt;isminion = 1;
&nbsp;    roamer-&gt;mtrapseen = ~0; /* traps are known */
&nbsp;    roamer-&gt;mpeaceful = peaceful;
&nbsp;    roamer-&gt;msleeping = 0;
&nbsp;    set_malign(roamer); /* peaceful may have changed */
&nbsp;
&nbsp;    /* MORE TO COME */
&nbsp;    return roamer;
&nbsp;}
&nbsp;
reset_hostility
&nbsp;void
&nbsp;reset_hostility(roamer)
&nbsp;register struct monst *roamer;
&nbsp;{
&nbsp;    if (!roamer-&gt;isminion)
&nbsp;        return;
&nbsp;    if (roamer-&gt;data != &amp;mons[PM_ALIGNED_PRIEST]
&nbsp;        &amp;&amp; roamer-&gt;data != &amp;mons[PM_ANGEL])
&nbsp;        return;
&nbsp;
&nbsp;    if (EMIN(roamer)-&gt;min_align != u.ualign.type) {
&nbsp;        roamer-&gt;mpeaceful = roamer-&gt;mtame = 0;
&nbsp;        set_malign(roamer);
&nbsp;    }
&nbsp;    newsym(roamer-&gt;mx, roamer-&gt;my);
&nbsp;}
&nbsp;
in_your_sanctuary
&nbsp;boolean
&nbsp;in_your_sanctuary(mon, x, y)
&nbsp;struct monst *mon; /* if non-null, 

<mx,my> overrides <x,y> */
&nbsp;xchar x, y;
&nbsp;{
&nbsp;    register char roomno;
&nbsp;    register struct monst *priest;
&nbsp;
&nbsp;    if (mon) {
&nbsp;        if (is_minion(mon-&gt;data) || is_rider(mon-&gt;data))
&nbsp;            return FALSE;
&nbsp;        x = mon-&gt;mx, y = mon-&gt;my;
&nbsp;    }
&nbsp;    if (u.ualign.record &lt;= ALGN_SINNED) /* sinned or worse */
&nbsp;        return FALSE;
&nbsp;    if ((roomno = temple_occupied(u.urooms)) == 0
&nbsp;        || roomno != *in_rooms(x, y, TEMPLE))
&nbsp;        return FALSE;
&nbsp;    if ((priest = findpriest(roomno)) == 0)
&nbsp;        return FALSE;
&nbsp;    return (boolean) (has_shrine(priest) &amp;&amp; p_coaligned(priest)
&nbsp;                      &amp;&amp; priest-&gt;mpeaceful);
&nbsp;}
&nbsp;
ghod_hitsu
&nbsp;/* when attacking "priest" in his temple */
&nbsp;void
&nbsp;ghod_hitsu(priest)
&nbsp;struct monst *priest;
&nbsp;{
&nbsp;    int x, y, ax, ay, roomno = (int) temple_occupied(u.urooms);
&nbsp;    struct mkroom *troom;
&nbsp;
&nbsp;    if (!roomno || !has_shrine(priest))
&nbsp;        return;
&nbsp;
&nbsp;    ax = x = EPRI(priest)-&gt;shrpos.x;
&nbsp;    ay = y = EPRI(priest)-&gt;shrpos.y;
&nbsp;    troom = &amp;rooms[roomno - ROOMOFFSET];
&nbsp;
&nbsp;    if ((u.ux == x &amp;&amp; u.uy == y) || !linedup(u.ux, u.uy, x, y, 1)) {
&nbsp;        if (IS_DOOR(levl[u.ux][u.uy].typ)) {
&nbsp;            if (u.ux == troom-&gt;lx - 1) {
&nbsp;                x = troom-&gt;hx;
&nbsp;                y = u.uy;
&nbsp;            } else if (u.ux == troom-&gt;hx + 1) {
&nbsp;                x = troom-&gt;lx;
&nbsp;                y = u.uy;
&nbsp;            } else if (u.uy == troom-&gt;ly - 1) {
&nbsp;                x = u.ux;
&nbsp;                y = troom-&gt;hy;
&nbsp;            } else if (u.uy == troom-&gt;hy + 1) {
&nbsp;                x = u.ux;
&nbsp;                y = troom-&gt;ly;
&nbsp;            }
&nbsp;        } else {
&nbsp;            switch (rn2(4)) {
&nbsp;            case 0:
&nbsp;                x = u.ux;
&nbsp;                y = troom-&gt;ly;
&nbsp;                break;
&nbsp;            case 1:
&nbsp;                x = u.ux;
&nbsp;                y = troom-&gt;hy;
&nbsp;                break;
&nbsp;            case 2:
&nbsp;                x = troom-&gt;lx;
&nbsp;                y = u.uy;
&nbsp;                break;
&nbsp;            default:
&nbsp;                x = troom-&gt;hx;
&nbsp;                y = u.uy;
&nbsp;                break;
&nbsp;            }
&nbsp;        }
&nbsp;        if (!linedup(u.ux, u.uy, x, y, 1))
&nbsp;            return;
&nbsp;    }
&nbsp;
&nbsp;    switch (rn2(3)) {
&nbsp;    case 0:
&nbsp;        pline("%s roars in anger:  \"Thou shalt suffer!\"",
&nbsp;              a_gname_at(ax, ay));
&nbsp;        break;
&nbsp;    case 1:
&nbsp;        pline("%s voice booms:  \"How darest thou harm my servant!\"",
&nbsp;              s_suffix(a_gname_at(ax, ay)));
&nbsp;        break;
&nbsp;    default:
&nbsp;        pline("%s roars:  \"Thou dost profane my shrine!\"",
&nbsp;              a_gname_at(ax, ay));
&nbsp;        break;
&nbsp;    }
&nbsp;
&nbsp;    buzz(-10 - (AD_ELEC - 1), 6, x, y, sgn(tbx),
&nbsp;         sgn(tby)); /* bolt of lightning */
&nbsp;    exercise(A_WIS, FALSE);
&nbsp;}
&nbsp;
angry_priest
&nbsp;void
&nbsp;angry_priest()
&nbsp;{
&nbsp;    register struct monst *priest;
&nbsp;    struct rm *lev;
&nbsp;
&nbsp;    if ((priest = findpriest(temple_occupied(u.urooms))) != 0) {
&nbsp;        struct epri *eprip = EPRI(priest);
&nbsp;
&nbsp;        wakeup(priest, FALSE);
&nbsp;        setmangry(priest, FALSE);
&nbsp;        /*
&nbsp;         * If the altar has been destroyed or converted, let the
&nbsp;         * priest run loose.
&nbsp;         * (When it's just a conversion and there happens to be
&nbsp;         * a fresh corpse nearby, the priest ought to have an
&nbsp;         * opportunity to try converting it back; maybe someday...)
&nbsp;         */
&nbsp;        lev = &amp;levl[eprip-&gt;shrpos.x][eprip-&gt;shrpos.y];
&nbsp;        if (!IS_ALTAR(lev-&gt;typ)
&nbsp;            || ((aligntyp) Amask2align(lev-&gt;altarmask &amp; AM_MASK)
&nbsp;                != eprip-&gt;shralign)) {
&nbsp;            if (!EMIN(priest))
&nbsp;                newemin(priest);
&nbsp;            priest-&gt;ispriest = 0; /* now a roaming minion */
&nbsp;            priest-&gt;isminion = 1;
&nbsp;            EMIN(priest)-&gt;min_align = eprip-&gt;shralign;
&nbsp;            EMIN(priest)-&gt;renegade = FALSE;
&nbsp;            /* discard priest's memory of his former shrine;
&nbsp;               if we ever implement the re-conversion mentioned
&nbsp;               above, this will need to be removed */
&nbsp;            free_epri(priest);
&nbsp;        }
&nbsp;    }
&nbsp;}
&nbsp;
clearpriests
&nbsp;/*
&nbsp; * When saving bones, find priests that aren't on their shrine level,
&nbsp; * and remove them.  This avoids big problems when restoring bones.
&nbsp; * [Perhaps we should convert them into roamers instead?]
&nbsp; */
&nbsp;void
&nbsp;clearpriests()
&nbsp;{
&nbsp;    struct monst *mtmp;
&nbsp;
&nbsp;    for (mtmp = fmon; mtmp; mtmp = mtmp-&gt;nmon) {
&nbsp;        if (DEADMONSTER(mtmp))
&nbsp;            continue;
&nbsp;        if (mtmp-&gt;ispriest &amp;&amp; !on_level(&amp;(EPRI(mtmp)-&gt;shrlevel), &amp;u.uz))
&nbsp;            mongone(mtmp);
&nbsp;    }
&nbsp;}
&nbsp;
restpriest
&nbsp;/* munge priest-specific structure when restoring -dlc */
&nbsp;void
&nbsp;restpriest(mtmp, ghostly)
&nbsp;register struct monst *mtmp;
&nbsp;boolean ghostly;
&nbsp;{
&nbsp;    if (u.uz.dlevel) {
&nbsp;        if (ghostly)
&nbsp;            assign_level(&amp;(EPRI(mtmp)-&gt;shrlevel), &amp;u.uz);
&nbsp;    }
&nbsp;}
&nbsp;
align_str
&nbsp;/*
&nbsp; * align_str(), piousness(), mstatusline() and ustatusline() used to be
&nbsp; * in pline.c, presumeably because the latter two generate one line of
&nbsp; * output.  The USE_OLDARGS config gets warnings from 2016ish-vintage
&nbsp; * gcc (for -Wint-to-pointer-cast, activated by -Wall or -W) when they
&nbsp; * follow pline() itself.  Fixing up the variadic calls like is done for
&nbsp; * lev_comp would be needlessly messy there.
&nbsp; *
&nbsp; * They don't belong here.  If/when enlightenment ever gets split off
&nbsp; * from cmd.c (which definitely doesn't belong there), they should go
&nbsp; * with it.
&nbsp; */
&nbsp;
&nbsp;const char *
&nbsp;align_str(alignment)
&nbsp;aligntyp alignment;
&nbsp;{
&nbsp;    switch ((int) alignment) {
&nbsp;    case A_CHAOTIC:
&nbsp;        return "chaotic";
&nbsp;    case A_NEUTRAL:
&nbsp;        return "neutral";
&nbsp;    case A_LAWFUL:
&nbsp;        return "lawful";
&nbsp;    case A_NONE:
&nbsp;        return "unaligned";
&nbsp;    }
&nbsp;    return "unknown";
&nbsp;}
&nbsp;
piousness
&nbsp;/* used for self-probing */
&nbsp;char *
&nbsp;piousness(showneg, suffix)
&nbsp;boolean showneg;
&nbsp;const char *suffix;
&nbsp;{
&nbsp;    static char buf[32]; /* bigger than "insufficiently neutral" */
&nbsp;    const char *pio;
&nbsp;
&nbsp;    /* note: piousness 20 matches MIN_QUEST_ALIGN (quest.h) */
&nbsp;    if (u.ualign.record &gt;= 20)
&nbsp;        pio = "piously";
&nbsp;    else if (u.ualign.record &gt; 13)
&nbsp;        pio = "devoutly";
&nbsp;    else if (u.ualign.record &gt; 8)
&nbsp;        pio = "fervently";
&nbsp;    else if (u.ualign.record &gt; 3)
&nbsp;        pio = "stridently";
&nbsp;    else if (u.ualign.record == 3)
&nbsp;        pio = "";
&nbsp;    else if (u.ualign.record &gt; 0)
&nbsp;        pio = "haltingly";
&nbsp;    else if (u.ualign.record == 0)
&nbsp;        pio = "nominally";
&nbsp;    else if (!showneg)
&nbsp;        pio = "insufficiently";
&nbsp;    else if (u.ualign.record &gt;= -3)
&nbsp;        pio = "strayed";
&nbsp;    else if (u.ualign.record &gt;= -8)
&nbsp;        pio = "sinned";
&nbsp;    else
&nbsp;        pio = "transgressed";
&nbsp;
&nbsp;    Sprintf(buf, "%s", pio);
&nbsp;    if (suffix &amp;&amp; (!showneg || u.ualign.record &gt;= 0)) {
&nbsp;        if (u.ualign.record != 3)
&nbsp;            Strcat(buf, " ");
&nbsp;        Strcat(buf, suffix);
&nbsp;    }
&nbsp;    return buf;
&nbsp;}
&nbsp;
mstatusline
&nbsp;/* stethoscope or probing applied to monster -- one-line feedback */
&nbsp;void
&nbsp;mstatusline(mtmp)
&nbsp;struct monst *mtmp;
&nbsp;{
&nbsp;    aligntyp alignment = mon_aligntyp(mtmp);
&nbsp;    char info[BUFSZ], monnambuf[BUFSZ];
&nbsp;
&nbsp;    info[0] = 0;
&nbsp;    if (mtmp-&gt;mtame) {
&nbsp;        Strcat(info, ", tame");
&nbsp;        if (wizard) {
&nbsp;            Sprintf(eos(info), " (%d", mtmp-&gt;mtame);
&nbsp;            if (!mtmp-&gt;isminion)
&nbsp;                Sprintf(eos(info), "; hungry %ld; apport %d",
&nbsp;                        EDOG(mtmp)-&gt;hungrytime, EDOG(mtmp)-&gt;apport);
&nbsp;            Strcat(info, ")");
&nbsp;        }
&nbsp;    } else if (mtmp-&gt;mpeaceful)
&nbsp;        Strcat(info, ", peaceful");
&nbsp;
&nbsp;    if (mtmp-&gt;data == &amp;mons[PM_LONG_WORM]) {
&nbsp;        int segndx, nsegs = count_wsegs(mtmp);
&nbsp;
&nbsp;        /* the worm code internals don't consider the head of be one of
&nbsp;           the worm's segments, but we count it as such when presenting
&nbsp;           worm feedback to the player */
&nbsp;        if (!nsegs) {
&nbsp;            Strcat(info, ", single segment");
&nbsp;        } else {
&nbsp;            ++nsegs; /* include head in the segment count */
&nbsp;            segndx = wseg_at(mtmp, bhitpos.x, bhitpos.y);
&nbsp;            Sprintf(eos(info), ", %d%s of %d segments",
&nbsp;                    segndx, ordin(segndx), nsegs);
&nbsp;        }
&nbsp;    }
&nbsp;    if (mtmp-&gt;cham &gt;= LOW_PM &amp;&amp; mtmp-&gt;data != &amp;mons[mtmp-&gt;cham])
&nbsp;        /* don't reveal the innate form (chameleon, vampire, &amp;c),
&nbsp;           just expose the fact that this current form isn't it */
&nbsp;        Strcat(info, ", shapechanger");
&nbsp;    /* pets eating mimic corpses mimic while eating, so this comes first */
&nbsp;    if (mtmp-&gt;meating)
&nbsp;        Strcat(info, ", eating");
&nbsp;    /* a stethoscope exposes mimic before getting here so this
&nbsp;       won't be relevant for it, but wand of probing doesn't */
&nbsp;    if (mtmp-&gt;mundetected || mtmp-&gt;m_ap_type)
&nbsp;        mhidden_description(mtmp, TRUE, eos(info));
&nbsp;    if (mtmp-&gt;mcan)
&nbsp;        Strcat(info, ", cancelled");
&nbsp;    if (mtmp-&gt;mconf)
&nbsp;        Strcat(info, ", confused");
&nbsp;    if (mtmp-&gt;mblinded || !mtmp-&gt;mcansee)
&nbsp;        Strcat(info, ", blind");
&nbsp;    if (mtmp-&gt;mstun)
&nbsp;        Strcat(info, ", stunned");
&nbsp;    if (mtmp-&gt;msleeping)
&nbsp;        Strcat(info, ", asleep");
&nbsp;#if 0 /* unfortunately mfrozen covers temporary sleep and being busy \
&nbsp;         (donning armor, for instance) as well as paralysis */
&nbsp;    else if (mtmp-&gt;mfrozen)
&nbsp;        Strcat(info, ", paralyzed");
&nbsp;#else
&nbsp;    else if (mtmp-&gt;mfrozen || !mtmp-&gt;mcanmove)
&nbsp;        Strcat(info, ", can't move");
&nbsp;#endif
&nbsp;    /* [arbitrary reason why it isn't moving] */
&nbsp;    else if (mtmp-&gt;mstrategy &amp; STRAT_WAITMASK)
&nbsp;        Strcat(info, ", meditating");
&nbsp;    if (mtmp-&gt;mflee)
&nbsp;        Strcat(info, ", scared");
&nbsp;    if (mtmp-&gt;mtrapped)
&nbsp;        Strcat(info, ", trapped");
&nbsp;    if (mtmp-&gt;mspeed)
&nbsp;        Strcat(info, (mtmp-&gt;mspeed == MFAST) ? ", fast"
&nbsp;                      : (mtmp-&gt;mspeed == MSLOW) ? ", slow"
&nbsp;                         : ", [? speed]");
&nbsp;    if (mtmp-&gt;minvis)
&nbsp;        Strcat(info, ", invisible");
&nbsp;    if (mtmp == u.ustuck)
&nbsp;        Strcat(info, sticks(youmonst.data) ? ", held by you"
&nbsp;                      : !u.uswallow ? ", holding you"
&nbsp;                         : attacktype_fordmg(u.ustuck-&gt;data, AT_ENGL, AD_DGST)
&nbsp;                            ? ", digesting you"
&nbsp;                            : is_animal(u.ustuck-&gt;data) ? ", swallowing you"
&nbsp;                               : ", engulfing you");
&nbsp;    if (mtmp == u.usteed)
&nbsp;        Strcat(info, ", carrying you");
&nbsp;
&nbsp;    /* avoid "Status of the invisible newt ..., invisible" */
&nbsp;    /* and unlike a normal mon_nam, use "saddled" even if it has a name */
&nbsp;    Strcpy(monnambuf, x_monnam(mtmp, ARTICLE_THE, (char *) 0,
&nbsp;                               (SUPPRESS_IT | SUPPRESS_INVISIBLE), FALSE));
&nbsp;
&nbsp;    pline("Status of %s (%s):  Level %d  HP %d(%d)  AC %d%s.", monnambuf,
&nbsp;          align_str(alignment), mtmp-&gt;m_lev, mtmp-&gt;mhp, mtmp-&gt;mhpmax,
&nbsp;          find_mac(mtmp), info);
&nbsp;}
&nbsp;
ustatusline
&nbsp;/* stethoscope or probing applied to hero -- one-line feedback */
&nbsp;void
&nbsp;ustatusline()
&nbsp;{
&nbsp;    char info[BUFSZ];
&nbsp;
&nbsp;    info[0] = '\0';
&nbsp;    if (Sick) {
&nbsp;        Strcat(info, ", dying from");
&nbsp;        if (u.usick_type &amp; SICK_VOMITABLE)
&nbsp;            Strcat(info, " food poisoning");
&nbsp;        if (u.usick_type &amp; SICK_NONVOMITABLE) {
&nbsp;            if (u.usick_type &amp; SICK_VOMITABLE)
&nbsp;                Strcat(info, " and");
&nbsp;            Strcat(info, " illness");
&nbsp;        }
&nbsp;    }
&nbsp;    if (Stoned)
&nbsp;        Strcat(info, ", solidifying");
&nbsp;    if (Slimed)
&nbsp;        Strcat(info, ", becoming slimy");
&nbsp;    if (Strangled)
&nbsp;        Strcat(info, ", being strangled");
&nbsp;    if (Vomiting)
&nbsp;        Strcat(info, ", nauseated"); /* !"nauseous" */
&nbsp;    if (Confusion)
&nbsp;        Strcat(info, ", confused");
&nbsp;    if (Blind) {
&nbsp;        Strcat(info, ", blind");
&nbsp;        if (u.ucreamed) {
&nbsp;            if ((long) u.ucreamed &lt; Blinded || Blindfolded
&nbsp;                || !haseyes(youmonst.data))
&nbsp;                Strcat(info, ", cover");
&nbsp;            Strcat(info, "ed by sticky goop");
&nbsp;        } /* note: "goop" == "glop"; variation is intentional */
&nbsp;    }
&nbsp;    if (Stunned)
&nbsp;        Strcat(info, ", stunned");
&nbsp;    if (!u.usteed &amp;&amp; Wounded_legs) {
&nbsp;        const char *what = body_part(LEG);
&nbsp;        if ((Wounded_legs &amp; BOTH_SIDES) == BOTH_SIDES)
&nbsp;            what = makeplural(what);
&nbsp;        Sprintf(eos(info), ", injured %s", what);
&nbsp;    }
&nbsp;    if (Glib)
&nbsp;        Sprintf(eos(info), ", slippery %s", makeplural(body_part(HAND)));
&nbsp;    if (u.utrap)
&nbsp;        Strcat(info, ", trapped");
&nbsp;    if (Fast)
&nbsp;        Strcat(info, Very_fast ? ", very fast" : ", fast");
&nbsp;    if (u.uundetected)
&nbsp;        Strcat(info, ", concealed");
&nbsp;    if (Invis)
&nbsp;        Strcat(info, ", invisible");
&nbsp;    if (u.ustuck) {
&nbsp;        if (sticks(youmonst.data))
&nbsp;            Strcat(info, ", holding ");
&nbsp;        else
&nbsp;            Strcat(info, ", held by ");
&nbsp;        Strcat(info, mon_nam(u.ustuck));
&nbsp;    }
&nbsp;
&nbsp;    pline("Status of %s (%s):  Level %d  HP %d(%d)  AC %d%s.", plname,
&nbsp;          piousness(FALSE, align_str(u.ualign.type)),
&nbsp;          Upolyd ? mons[u.umonnum].mlevel : u.ulevel, Upolyd ? u.mh : u.uhp,
&nbsp;          Upolyd ? u.mhmax : u.uhpmax, u.uac, info);
&nbsp;}
&nbsp;
&nbsp;/*priest.c*/

</x,y></mx,my>