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

Function drinksink

src/fountain.c:594–712  ·  view source on GitHub ↗

quaff from a sink while standing on its location */

Source from the content-addressed store, hash-verified

592
593/* quaff from a sink while standing on its location */
594void
595drinksink(void)
596{
597 struct obj *otmp;
598 struct monst *mtmp;
599
600 if (Levitation) {
601 floating_above("sink");
602 return;
603 }
604 switch (rn2(20)) {
605 case 0:
606 You("take a sip of very cold %s.", hliquid("water"));
607 break;
608 case 1:
609 You("take a sip of very warm %s.", hliquid("water"));
610 break;
611 case 2:
612 You("take a sip of scalding hot %s.", hliquid("water"));
613 if (Fire_resistance) {
614 pline("It seems quite tasty.");
615 monstseesu(M_SEEN_FIRE);
616 } else {
617 losehp(rnd(6), "sipping boiling water", KILLED_BY);
618 monstunseesu(M_SEEN_FIRE);
619 }
620 /* boiling water burns considered fire damage */
621 break;
622 case 3:
623 if (svm.mvitals[PM_SEWER_RAT].mvflags & G_GONE)
624 pline_The("sink seems quite dirty.");
625 else {
626 mtmp = makemon(&mons[PM_SEWER_RAT], u.ux, u.uy, MM_NOMSG);
627 if (mtmp)
628 pline("Eek! There's %s in the sink!",
629 (Blind || !canspotmon(mtmp)) ? "something squirmy"
630 : a_monnam(mtmp));
631 }
632 break;
633 case 4:
634 for (;;) {
635 otmp = mkobj(POTION_CLASS, FALSE);
636 if (otmp->otyp != POT_WATER)
637 break;
638 /* reject water and try again */
639 obfree(otmp, (struct obj *) 0);
640 }
641 otmp->cursed = otmp->blessed = 0;
642 pline("Some %s liquid flows from the faucet.",
643 Blind ? "odd" : hcolor(OBJ_DESCR(objects[otmp->otyp])));
644 if(!(Blind || Hallucination))
645 observe_object(otmp);
646 otmp->quan++; /* Avoid panic upon useup() */
647 otmp->fromsink = 1; /* kludge for docall() */
648 (void) dopotion(otmp);
649 obfree(otmp, (struct obj *) 0);
650 break;
651 case 5:

Callers 1

dodrinkFunction · 0.85

Calls 15

rn2Function · 0.85
YouFunction · 0.85
hliquidFunction · 0.85
monstseesuFunction · 0.85
losehpFunction · 0.85
rndFunction · 0.85
monstunseesuFunction · 0.85
pline_TheFunction · 0.85
makemonFunction · 0.85
a_monnamFunction · 0.85
mkobjFunction · 0.85
obfreeFunction · 0.85

Tested by

no test coverage detected