MCPcopy Index your code
hub / github.com/NetHack/NetHack / its_dead

Function its_dead

src/apply.c:197–309  ·  view source on GitHub ↗

maybe give a stethoscope message based on floor objects */

Source from the content-addressed store, hash-verified

195
196/* maybe give a stethoscope message based on floor objects */
197staticfn boolean
198its_dead(coordxy rx, coordxy ry, int *resp)
199{
200 char buf[BUFSZ];
201 boolean more_corpses;
202 struct permonst *mptr;
203 struct obj *corpse = sobj_at(CORPSE, rx, ry),
204 *statue = sobj_at(STATUE, rx, ry);
205
206 if (!can_reach_floor(TRUE)) { /* levitation or unskilled riding */
207 corpse = 0; /* can't reach corpse on floor */
208 /* you can't reach tiny statues (even though you can fight
209 tiny monsters while levitating--consistency, what's that?) */
210 while (statue && mons[statue->corpsenm].msize == MZ_TINY)
211 statue = nxtobj(statue, STATUE, TRUE);
212 }
213 /* when both corpse and statue are present, pick the uppermost one */
214 if (corpse && statue) {
215 if (nxtobj(statue, CORPSE, TRUE) == corpse)
216 corpse = 0; /* corpse follows statue; ignore it */
217 else
218 statue = 0; /* corpse precedes statue; ignore statue */
219 }
220 more_corpses = (corpse && nxtobj(corpse, CORPSE, TRUE));
221
222 /* additional stethoscope messages from jyoung@apanix.apana.org.au */
223 if (!corpse && !statue) {
224 ; /* nothing to do */
225
226 } else if (Hallucination) {
227 if (!corpse) {
228 /* it's a statue */
229 Strcpy(buf, "You're both stoned");
230 } else if (corpse->quan == 1L && !more_corpses) {
231 int gndr = 2; /* neuter: "it" */
232 struct monst *mtmp = get_mtraits(corpse, FALSE);
233
234 /* (most corpses don't retain the monster's sex, so
235 we're usually forced to use generic pronoun here) */
236 if (mtmp) {
237 mtmp->data = &mons[mtmp->mnum];
238 gndr = pronoun_gender(mtmp, PRONOUN_NO_IT);
239 } else {
240 mptr = &mons[corpse->corpsenm];
241 if (is_female(mptr))
242 gndr = 1;
243 else if (is_male(mptr))
244 gndr = 0;
245 }
246 Sprintf(buf, "%s's dead", genders[gndr].he); /* "he"/"she"/"it" */
247 buf[0] = highc(buf[0]);
248 } else { /* plural */
249 Strcpy(buf, "They're dead");
250 }
251 /* variations on "He's dead, Jim." (Star Trek's Dr McCoy) */
252 You_hear("a voice say, \"%s, Jim.\"", buf);
253 *resp = ECMD_TIME;
254 return TRUE;

Callers 1

use_stethoscopeFunction · 0.85

Calls 15

sobj_atFunction · 0.85
can_reach_floorFunction · 0.85
nxtobjFunction · 0.85
get_mtraitsFunction · 0.85
pronoun_genderFunction · 0.85
highcFunction · 0.85
You_hearFunction · 0.85
glyph_atFunction · 0.85
map_objectFunction · 0.85
obj_has_timerFunction · 0.85
YouFunction · 0.85
obj_pmnameFunction · 0.85

Tested by

no test coverage detected