-/* NetHack 3.7 extern.h $NHDT-Date: 1607945415 2020/12/14 11:30:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.932 $ */
+/* NetHack 3.7 extern.h $NHDT-Date: 1608749030 2020/12/23 18:43:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.934 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
/* ### pager.c ### */
E char *FDECL(self_lookat, (char *));
+E char *FDECL(monhealthdescr, (struct monst *mon, BOOLEAN_P, char *));
E void FDECL(mhidden_description, (struct monst *, BOOLEAN_P, char *));
E boolean FDECL(object_from_map, (int,int,int,struct obj **));
E int FDECL(do_screen_description, (coord, BOOLEAN_P, int, char *,
-/* NetHack 3.7 do_name.c $NHDT-Date: 1608343467 2020/12/19 02:04:27 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.185 $ */
+/* NetHack 3.7 do_name.c $NHDT-Date: 1608749030 2020/12/23 18:43:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.186 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
static char *NDECL(nextmbuf);
-static void FDECL(getpos_help_keyxhelp, (winid, const char *, const char *, int));
+static void FDECL(getpos_help_keyxhelp, (winid, const char *,
+ const char *, int));
static void FDECL(getpos_help, (BOOLEAN_P, const char *));
static int FDECL(CFDECLSPEC cmp_coord_distu, (const void *, const void *));
static int FDECL(gloc_filter_classify_glyph, (int));
-/* NetHack 3.7 pager.c $NHDT-Date: 1607735717 2020/12/12 01:15:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.191 $ */
+/* NetHack 3.7 pager.c $NHDT-Date: 1608749031 2020/12/23 18:43:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.192 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */
static boolean FDECL(is_swallow_sym, (int));
static int FDECL(append_str, (char *, const char *));
static void FDECL(look_at_object, (char *, int, int, int));
-static void FDECL(look_at_monster, (char *, char *,
- struct monst *, int, int));
+static void FDECL(look_at_monster, (char *, char *, struct monst *, int, int));
static struct permonst *FDECL(lookat, (int, int, char *, char *));
static void FDECL(checkfile, (char *, struct permonst *,
- BOOLEAN_P, BOOLEAN_P, char *));
+ BOOLEAN_P, BOOLEAN_P, char *));
static void FDECL(look_all, (BOOLEAN_P,BOOLEAN_P));
static void FDECL(do_supplemental_info, (char *, struct permonst *,
- BOOLEAN_P));
+ BOOLEAN_P));
static void NDECL(whatdoes_help);
static void NDECL(docontact);
static void NDECL(dispfile_help);
return outbuf;
}
+/* format description of 'mon's health for look_at_monster(), done_in_by() */
+char *
+monhealthdescr(mon, addspace, outbuf)
+struct monst *mon;
+boolean addspace;
+char *outbuf;
+{
+ int mhp_max = max(mon->mhpmax, 1), /* bullet proofing */
+ pct = (mon->mhp * 100) / mhp_max;
+
+ if (mon->mhp >= mhp_max)
+ Strcpy(outbuf, "uninjured");
+ else if (mon->mhp <= 1 || pct < 5)
+ Sprintf(outbuf, "%s%s", (mon->mhp > 0) ? "nearly " : "",
+ !nonliving(mon->data) ? "deceased" : "defunct");
+ else
+ Sprintf(outbuf, "%swounded",
+ (pct >= 95) ? "barely "
+ : (pct >= 80) ? "slightly "
+ : (pct < 20) ? "heavily "
+ : "");
+ if (addspace)
+ (void) strkitten(outbuf, ' ');
+ return outbuf;
+}
+
/* describe a hidden monster; used for look_at during extended monster
detection and for probing; also when looking at self */
void
struct monst *mtmp;
int x, y;
{
- char *name, monnambuf[BUFSZ];
+ char *name, monnambuf[BUFSZ], healthbuf[BUFSZ];
boolean accurate = !Hallucination;
name = (mtmp->data == &mons[PM_COYOTE] && accurate)
? coyotename(mtmp, monnambuf)
: distant_monnam(mtmp, ARTICLE_NONE, monnambuf);
- Sprintf(buf, "%s%s%s",
+ Sprintf(buf, "%s%s%s%s",
(mtmp->mx != x || mtmp->my != y)
? ((mtmp->isshk && accurate) ? "tail of " : "tail of a ")
: "",
+ accurate ? monhealthdescr(mtmp, TRUE, healthbuf) : "",
(mtmp->mtame && accurate)
? "tame "
: (mtmp->mpeaceful && accurate)