MCPcopy Create free account
hub / github.com/NetHack/NetHack / stinky_nemesis

Function stinky_nemesis

src/questpgr.c:149–194  ·  view source on GitHub ↗

returns 1 if nemesis death message mentions noxious fumes, otherwise 0; does not display the message */

Source from the content-addressed store, hash-verified

147/* returns 1 if nemesis death message mentions noxious fumes, otherwise 0;
148 does not display the message */
149int
150stinky_nemesis(struct monst *mon)
151{
152 char *mesg = 0;
153 int res = 0;
154
155#if 0
156 /* get the quest text for dying nemesis; don't assume that mon is
157 hero's own role's nemesis (overkill since m_detach() and nemdead()
158 both make that assumption--valid for normal play but not necessarily
159 valid for wizard mode) */
160 int r, mndx = monsndx(mon->data);
161 for (r = 0; roles[r].name.m || roles[r].name.f; ++r)
162 if (roles[r].neminum == mndx) {
163 (void) com_pager_core(roles[r].filecode, "killed_nemesis",
164 FALSE, &mesg);
165 break;
166 }
167#else
168 nhUse(mon);
169 /* since nemdead() just gave the message for hero's nemesis even if 'mon'
170 is some other role's nemesis (feasible in wizard mode), base any gas
171 cloud on the text that was shown even if not appropriate for 'mon' */
172 (void) com_pager_core(gu.urole.filecode, "killed_nemesis", FALSE, &mesg);
173#endif
174
175 /* this is somewhat fragile; it assumes that when both {noxious or
176 poisonous or toxic} and {gas or fumes} are present, the latter
177 refers to the former rather than to something unrelated; it does
178 make sure that fumes occurs after noxious rather than before */
179 if (mesg) {
180 char *p;
181
182 /* change newlines into spaces to cope with "...noxious\nfumes..." */
183 (void) strNsubst(mesg, "\n", " ", 0);
184
185 if (((p = strstri(mesg, "noxious")) != 0
186 || (p = strstri(mesg, "poisonous")) != 0
187 || (p = strstri(mesg, "toxic")) != 0)
188 && (strstri(p, " gas") || strstri(p, " fumes")))
189 res = 1;
190
191 free((genericptr_t) mesg);
192 }
193 return res;
194}
195
196/* replace deity, leader, nemesis, or artifact name with pronoun;
197 overwrites cvt_buf[] */

Callers 1

m_detachFunction · 0.85

Calls 3

com_pager_coreFunction · 0.85
strNsubstFunction · 0.85
strstriFunction · 0.85

Tested by

no test coverage detected