noxious quest nemeses

Refine the code added by pull request #763 to check the quest nemesis
death message for reference to noxious fumes rather than having the
three relevant roles be hardcoded.
This commit is contained in:
PatR
2022-06-12 13:19:13 -07:00
parent ca3e406601
commit fe34d4e3e3
4 changed files with 69 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.946 $ $NHDT-Date: 1654931291 2022/06/11 07:08:11 $ HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.949 $ $NHDT-Date: 1655065133 2022/06/12 20:18:53 $
General Fixes and Modified Features General Fixes and Modified Features
----------------------------------- -----------------------------------
@@ -1676,6 +1676,7 @@ if built with DEBUG enabled and running in wizard mode, starting play with
DEBUGFILES=seethru in environment makes clouds on the Plane of Air, DEBUGFILES=seethru in environment makes clouds on the Plane of Air,
water on Plane of Water, and fumaroles on Plane of Fire be transparent water on Plane of Water, and fumaroles on Plane of Fire be transparent
add wizard mode #wizkill command to remove monster(s) from play add wizard mode #wizkill command to remove monster(s) from play
some quest nemeses release a cloud of poisonous gas when they die
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 extern.h $NHDT-Date: 1654896957 2022/06/10 21:35:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1119 $ */ /* NetHack 3.7 extern.h $NHDT-Date: 1655065134 2022/06/12 20:18:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1121 $ */
/* Copyright (c) Steve Creps, 1988. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2231,6 +2231,7 @@ extern short quest_info(int);
extern const char *ldrname(void); extern const char *ldrname(void);
extern boolean is_quest_artifact(struct obj *); extern boolean is_quest_artifact(struct obj *);
extern struct obj *find_quest_artifact(unsigned); extern struct obj *find_quest_artifact(unsigned);
extern int stinky_nemesis(struct monst *);
extern void com_pager(const char *); extern void com_pager(const char *);
extern void qt_pager(const char *); extern void qt_pager(const char *);
extern struct permonst *qt_montype(void); extern struct permonst *qt_montype(void);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mon.c $NHDT-Date: 1654465182 2022/06/05 21:39:42 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.433 $ */ /* NetHack 3.7 mon.c $NHDT-Date: 1655065140 2022/06/12 20:19:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.436 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2380,16 +2380,11 @@ m_detach(
if (mtmp->iswiz) if (mtmp->iswiz)
wizdead(); wizdead();
if (mtmp->data->msound == MS_NEMESIS) { if (mtmp->data->msound == MS_NEMESIS) {
struct permonst *mdat = mtmp->data;
nemdead(); nemdead();
/* The Archeologist, Caveman, and Priest quest texts describe /* The Archeologist, Caveman, and Priest quest texts describe
the nemesis's body creating noxious fumes/gas when the nemesis's body creating noxious fumes/gas when killed. */
killed. */ if (stinky_nemesis(mtmp))
if (mdat == &mons[PM_MINION_OF_HUHETOTL]
|| mdat == &mons[PM_CHROMATIC_DRAGON]
|| mdat == &mons[PM_NALZOK]) {
create_gas_cloud(mx, my, 5, 8); create_gas_cloud(mx, my, 5, 8);
}
} }
if (mtmp->data->msound == MS_LEADER) if (mtmp->data->msound == MS_LEADER)
leaddead(); leaddead();

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 questpgr.c $NHDT-Date: 1652827965 2022/05/17 22:52:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.78 $ */ /* NetHack 3.7 questpgr.c $NHDT-Date: 1655065145 2022/06/12 20:19:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.79 $ */
/* Copyright 1991, M. Stephenson */ /* Copyright 1991, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -24,7 +24,7 @@ static void convert_line(char *,char *);
static void deliver_by_pline(const char *); static void deliver_by_pline(const char *);
static void deliver_by_window(const char *, int); static void deliver_by_window(const char *, int);
static boolean skip_pager(boolean); static boolean skip_pager(boolean);
static boolean com_pager_core(const char *, const char *, boolean); static boolean com_pager_core(const char *, const char *, boolean, char **);
short short
quest_info(int typ) quest_info(int typ)
@@ -143,6 +143,55 @@ homebase(void) /* return your role leader's location */
return g.urole.homebase; return g.urole.homebase;
} }
/* returns 1 if nemesis death message mentions noxious fumes, otherwise 0;
does not display the message */
int
stinky_nemesis(struct monst *mon)
{
char *mesg = 0;
int res = 0;
#if 0
/* get the quest text for dying nemesis; don't assume that mon is
hero's own role's nemesis (overkill since m_detach() and nemdead()
both make that assumption--valid for normal play but not necessarily
valid for wizard mode) */
int r, mndx = monsndx(mon->data);
for (r = 0; roles[r].name.m || roles[r].name.f; ++r)
if (roles[r].neminum == mndx) {
(void) com_pager_core(roles[r].filecode, "killed_nemesis",
FALSE, &mesg);
break;
}
#else
nhUse(mon);
/* since nemdead() just gave the message for hero's nemesis even if 'mon'
is some other role's nemesis (feasible in wizard mode), base any gas
cloud on the text that was shown even if not appropriate for 'mon' */
(void) com_pager_core(g.urole.filecode, "killed_nemesis", FALSE, &mesg);
#endif
/* this is somewhat fragile; it assumes that when both (noxious or
poisonous or toxic) and (gas or fumes) are present, the latter
refers to the former rather than to something unrelated; it does
make sure that fumes occurs after noxious rather than before */
if (mesg) {
char *p;
/* change newlines into spaces to cope with "...noxious\nfumes..." */
(void) strNsubst(mesg, "\n", " ", 0);
if (((p = strstri(mesg, "noxious")) != 0
|| (p = strstri(mesg, "poisonous")) != 0
|| (p = strstri(mesg, "toxic")) != 0)
&& (strstri(p, " gas") || strstri(p, " fumes")))
res = 1;
free((genericptr_t) mesg);
}
return res;
}
/* replace deity, leader, nemesis, or artifact name with pronoun; /* replace deity, leader, nemesis, or artifact name with pronoun;
overwrites cvt_buf[] */ overwrites cvt_buf[] */
static void static void
@@ -415,7 +464,8 @@ static boolean
com_pager_core( com_pager_core(
const char *section, const char *section,
const char *msgid, const char *msgid,
boolean showerror) boolean showerror,
char **rawtext)
{ {
static const char *const howtoput[] = { static const char *const howtoput[] = {
"pline", "window", "text", "menu", "default", NULL "pline", "window", "text", "menu", "default", NULL
@@ -486,8 +536,13 @@ com_pager_core(
goto compagerdone; goto compagerdone;
} }
synopsis = get_table_str_opt(L, "synopsis", NULL);
text = get_table_str_opt(L, "text", NULL); text = get_table_str_opt(L, "text", NULL);
if (rawtext) {
*rawtext = dupstr(text);
res = TRUE;
goto compagerdone;
}
synopsis = get_table_str_opt(L, "synopsis", NULL);
output = howtoput2i[get_table_option(L, "output", "default", howtoput)]; output = howtoput2i[get_table_option(L, "output", "default", howtoput)];
if (!text) { if (!text) {
@@ -564,14 +619,14 @@ com_pager_core(
void void
com_pager(const char *msgid) com_pager(const char *msgid)
{ {
com_pager_core("common", msgid, TRUE); (void) com_pager_core("common", msgid, TRUE, (char **) 0);
} }
void void
qt_pager(const char *msgid) qt_pager(const char *msgid)
{ {
if (!com_pager_core(g.urole.filecode, msgid, FALSE)) if (!com_pager_core(g.urole.filecode, msgid, FALSE, (char **) 0))
com_pager_core("common", msgid, TRUE); (void) com_pager_core("common", msgid, TRUE, (char **) 0);
} }
struct permonst * struct permonst *