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

Function slime_dialogue

src/timeout.c:388–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386};
387
388staticfn void
389slime_dialogue(void)
390{
391 long t = (Slimed & TIMEOUT), i = t / 2L;
392
393 if (t == 1L) {
394 /* display as green slime during "You have become green slime."
395 but don't worry about not being able to see self; if already
396 mimicking something else at the time, implicitly be revealed */
397 gy.youmonst.m_ap_type = M_AP_MONSTER;
398 gy.youmonst.mappearance = PM_GREEN_SLIME;
399 /* no message given when 't' is odd, so no automatic update of
400 self; force one */
401 newsym(u.ux, u.uy);
402 }
403
404 if ((t % 2L) != 0L && i >= 0L && i < SIZE(slime_texts)) {
405 char buf[BUFSZ];
406
407 Strcpy(buf, slime_texts[SIZE(slime_texts) - i - 1L]);
408 if (nolimbs(gy.youmonst.data) && strstri(buf, "limbs"))
409 (void) strsubst(buf, "limbs", "extremities");
410
411 if (strchr(buf, '%')) {
412 if (i == 4L) { /* "you are turning green" */
413 if (!Blind) /* [what if you're already green?] */
414 urgent_pline(buf, hcolor(NH_GREEN));
415 } else {
416 urgent_pline(buf, an(Hallucination ? rndmonnam(NULL)
417 : "green slime"));
418 }
419 } else {
420 urgent_pline("%s", buf);
421 }
422 }
423
424 switch (i) {
425 case 3L: /* limbs becoming oozy */
426 HFast = 0L; /* lose intrinsic speed */
427 if (!Popeye(SLIMED))
428 stop_occupation();
429 if (gm.multi > 0)
430 nomul(0);
431 break;
432 case 2L: /* skin begins to peel */
433 if ((HDeaf & TIMEOUT) > 0L && (HDeaf & TIMEOUT) < 5L)
434 set_itimeout(&HDeaf, 5L); /* avoid Hear_again at tail end */
435 break;
436 case 1L: /* turning into slime */
437 /* if also turning to stone, stop doing that (no message) */
438 if (Stoned)
439 make_stoned(0L, (char *) 0, KILLED_BY_AN, (char *) 0);
440 break;
441 }
442 exercise(A_DEX, FALSE);
443}
444
445RESTORE_WARNING_FORMAT_NONLITERAL

Callers 1

nh_timeoutFunction · 0.85

Calls 13

newsymFunction · 0.85
strstriFunction · 0.85
strsubstFunction · 0.85
urgent_plineFunction · 0.85
hcolorFunction · 0.85
anFunction · 0.85
rndmonnamFunction · 0.85
PopeyeFunction · 0.85
stop_occupationFunction · 0.85
nomulFunction · 0.85
set_itimeoutFunction · 0.85
make_stonedFunction · 0.85

Tested by

no test coverage detected