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

Function dipsink

src/fountain.c:715–801  ·  view source on GitHub ↗

for #dip(potion.c) when standing on a sink */

Source from the content-addressed store, hash-verified

713
714/* for #dip(potion.c) when standing on a sink */
715void
716dipsink(struct obj *obj)
717{
718 boolean try_call = FALSE,
719 not_looted_yet = (levl[u.ux][u.uy].looted & S_LRING) == 0,
720 is_hands = (obj == &hands_obj || (uarmg && obj == uarmg));
721
722 if (!rn2(not_looted_yet ? 25 : 15)) {
723 /* can't rely on using sink for unlimited scroll blanking; however,
724 since sink will be converted into a fountain, hero can dip again */
725 breaksink(u.ux, u.uy); /* "The pipes break! Water spurts out!" */
726 if (Glib && is_hands)
727 Your("%s are still slippery.", fingers_or_gloves(TRUE));
728 return;
729 } else if (is_hands) {
730 (void) wash_hands();
731 return;
732 } else if (obj->oclass != POTION_CLASS) {
733 You("hold %s under the tap.", the(xname(obj)));
734 if (water_damage(obj, (const char *) 0, TRUE) == ER_NOTHING)
735 pline1(nothing_seems_to_happen);
736 return;
737 }
738
739 /* at this point the object must be a potion */
740 You("pour %s%s down the drain.", (obj->quan > 1L ? "one of " : ""),
741 the(xname(obj)));
742 switch (obj->otyp) {
743 case POT_POLYMORPH:
744 polymorph_sink();
745 try_call = TRUE;
746 break;
747 case POT_OIL:
748 if (!Blind) {
749 pline("It leaves an oily film on the basin.");
750 try_call = TRUE;
751 } else {
752 pline1(nothing_seems_to_happen);
753 }
754 break;
755 case POT_ACID:
756 /* acts like a drain cleaner product */
757 try_call = TRUE;
758 if (!Blind) {
759 pline_The("drain seems less clogged.");
760 } else if (!Deaf) {
761 You_hear("a sucking sound.");
762 } else {
763 pline1(nothing_seems_to_happen);
764 try_call = FALSE;
765 }
766 break;
767 case POT_LEVITATION:
768 sink_backs_up(u.ux, u.uy);
769 try_call = TRUE;
770 break;
771 case POT_OBJECT_DETECTION:
772 if (!(levl[u.ux][u.uy].looted & S_LRING)) {

Callers 1

dodipFunction · 0.85

Calls 15

rn2Function · 0.85
breaksinkFunction · 0.85
YourFunction · 0.85
fingers_or_glovesFunction · 0.85
wash_handsFunction · 0.85
YouFunction · 0.85
theFunction · 0.85
xnameFunction · 0.85
water_damageFunction · 0.85
polymorph_sinkFunction · 0.85
pline_TheFunction · 0.85
You_hearFunction · 0.85

Tested by

no test coverage detected