# Source:NetHack 3.6.1/src/fountain.c
Below is the full text to fountain.c from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/src/fountain.c#line123]], for example.

Contents

1 Top of file
2 floating_above
3 dowatersnakes
4 dowaterdemon
5 dowaternymph
6 dogushforth
7 gush
8 dofindgem
9 dryup
10 drinkfountain
11 dipfountain
12 breaksink
13 drinksink

Top of file
&nbsp;/* NetHack 3.6	fountain.c	$NHDT-Date: 1455402364 2016/02/13 22:26:04 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.56 $ */
&nbsp;/*      Copyright Scott R. Turner, srt@ucla, 10/27/86 */
&nbsp;/* NetHack may be freely redistributed.  See license for details. */

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

&nbsp;
&nbsp;/* Code for drinking from fountains. */
&nbsp;
&nbsp;#include "hack.h"
&nbsp;
&nbsp;STATIC_DCL void NDECL(dowatersnakes);
&nbsp;STATIC_DCL void NDECL(dowaterdemon);
&nbsp;STATIC_DCL void NDECL(dowaternymph);
&nbsp;STATIC_PTR void FDECL(gush, (int, int, genericptr_t));
&nbsp;STATIC_DCL void NDECL(dofindgem);
&nbsp;
floating_above
&nbsp;/* used when trying to dip in or drink from fountain or sink or pool while
&nbsp;   levitating above it, or when trying to move downwards in that state */
&nbsp;void
&nbsp;floating_above(what)
&nbsp;const char *what;
&nbsp;{
&nbsp;    const char *umsg = "are floating high above the %s.";
&nbsp;
&nbsp;    if (u.utrap &amp;&amp; (u.utraptype == TT_INFLOOR || u.utraptype == TT_LAVA)) {
&nbsp;        /* when stuck in floor (not possible at fountain or sink location,
&nbsp;           so must be attempting to move down), override the usual message */
&nbsp;        umsg = "are trapped in the %s.";
&nbsp;        what = surface(u.ux, u.uy); /* probably redundant */
&nbsp;    }
&nbsp;    You(umsg, what);
&nbsp;}
&nbsp;
dowatersnakes
&nbsp;/* Fountain of snakes! */
&nbsp;STATIC_OVL void
&nbsp;dowatersnakes()
&nbsp;{
&nbsp;    register int num = rn1(5, 2);
&nbsp;    struct monst *mtmp;
&nbsp;
&nbsp;    if (!(mvitals[PM_WATER_MOCCASIN].mvflags &amp; G_GONE)) {
&nbsp;        if (!Blind)
&nbsp;            pline("An endless stream of %s pours forth!",
&nbsp;                  Hallucination ? makeplural(rndmonnam(NULL)) : "snakes");
&nbsp;        else
&nbsp;            You_hear("%s hissing!", something);
&nbsp;        while (num-- &gt; 0)
&nbsp;            if ((mtmp = makemon(&amp;mons[PM_WATER_MOCCASIN], u.ux, u.uy,
&nbsp;                                NO_MM_FLAGS)) != 0
&nbsp;                &amp;&amp; t_at(mtmp-&gt;mx, mtmp-&gt;my))
&nbsp;                (void) mintrap(mtmp);
&nbsp;    } else
&nbsp;        pline_The("fountain bubbles furiously for a moment, then calms.");
&nbsp;}
&nbsp;
dowaterdemon
&nbsp;/* Water demon */
&nbsp;STATIC_OVL void
&nbsp;dowaterdemon()
&nbsp;{
&nbsp;    struct monst *mtmp;
&nbsp;
&nbsp;    if (!(mvitals[PM_WATER_DEMON].mvflags &amp; G_GONE)) {
&nbsp;        if ((mtmp = makemon(&amp;mons[PM_WATER_DEMON], u.ux, u.uy,
&nbsp;                            NO_MM_FLAGS)) != 0) {
&nbsp;            if (!Blind)
&nbsp;                You("unleash %s!", a_monnam(mtmp));
&nbsp;            else
&nbsp;                You_feel("the presence of evil.");
&nbsp;
&nbsp;            /* Give those on low levels a (slightly) better chance of survival
&nbsp;             */
&nbsp;            if (rnd(100) &gt; (80 + level_difficulty())) {
&nbsp;                pline("Grateful for %s release, %s grants you a wish!",
&nbsp;                      mhis(mtmp), mhe(mtmp));
&nbsp;                /* give a wish and discard the monster (mtmp set to null) */
&nbsp;                mongrantswish(&amp;mtmp);
&nbsp;            } else if (t_at(mtmp-&gt;mx, mtmp-&gt;my))
&nbsp;                (void) mintrap(mtmp);
&nbsp;        }
&nbsp;    } else
&nbsp;        pline_The("fountain bubbles furiously for a moment, then calms.");
&nbsp;}
&nbsp;
dowaternymph
&nbsp;/* Water Nymph */
&nbsp;STATIC_OVL void
&nbsp;dowaternymph()
&nbsp;{
&nbsp;    register struct monst *mtmp;
&nbsp;
&nbsp;    if (!(mvitals[PM_WATER_NYMPH].mvflags &amp; G_GONE)
&nbsp;        &amp;&amp; (mtmp = makemon(&amp;mons[PM_WATER_NYMPH], u.ux, u.uy,
&nbsp;                           NO_MM_FLAGS)) != 0) {
&nbsp;        if (!Blind)
&nbsp;            You("attract %s!", a_monnam(mtmp));
&nbsp;        else
&nbsp;            You_hear("a seductive voice.");
&nbsp;        mtmp-&gt;msleeping = 0;
&nbsp;        if (t_at(mtmp-&gt;mx, mtmp-&gt;my))
&nbsp;            (void) mintrap(mtmp);
&nbsp;    } else if (!Blind)
&nbsp;        pline("A large bubble rises to the surface and pops.");
&nbsp;    else
&nbsp;        You_hear("a loud pop.");
&nbsp;}
&nbsp;
dogushforth
&nbsp;/* Gushing forth along LOS from (u.ux, u.uy) */
&nbsp;void
&nbsp;dogushforth(drinking)
&nbsp;int drinking;
&nbsp;{
&nbsp;    int madepool = 0;
&nbsp;
&nbsp;    do_clear_area(u.ux, u.uy, 7, gush, (genericptr_t) &amp;madepool);
&nbsp;    if (!madepool) {
&nbsp;        if (drinking)
&nbsp;            Your("thirst is quenched.");
&nbsp;        else
&nbsp;            pline("Water sprays all over you.");
&nbsp;    }
&nbsp;}
&nbsp;
gush
&nbsp;STATIC_PTR void
&nbsp;gush(x, y, poolcnt)
&nbsp;int x, y;
&nbsp;genericptr_t poolcnt;
&nbsp;{
&nbsp;    register struct monst *mtmp;
&nbsp;    register struct trap *ttmp;
&nbsp;
&nbsp;    if (((x + y) % 2) || (x == u.ux &amp;&amp; y == u.uy)
&nbsp;        || (rn2(1 + distmin(u.ux, u.uy, x, y))) || (levl[x][y].typ != ROOM)
&nbsp;        || (sobj_at(BOULDER, x, y)) || nexttodoor(x, y))
&nbsp;        return;
&nbsp;
&nbsp;    if ((ttmp = t_at(x, y)) != 0 &amp;&amp; !delfloortrap(ttmp))
&nbsp;        return;
&nbsp;
&nbsp;    if (!((*(int *) poolcnt)++))
&nbsp;        pline("Water gushes forth from the overflowing fountain!");
&nbsp;
&nbsp;    /* Put a pool at x, y */
&nbsp;    levl[x][y].typ = POOL;
&nbsp;    /* No kelp! */
&nbsp;    del_engr_at(x, y);
&nbsp;    water_damage_chain(level.objects[x][y], TRUE);
&nbsp;
&nbsp;    if ((mtmp = m_at(x, y)) != 0)
&nbsp;        (void) minliquid(mtmp);
&nbsp;    else
&nbsp;        newsym(x, y);
&nbsp;}
&nbsp;
dofindgem
&nbsp;/* Find a gem in the sparkling waters. */
&nbsp;STATIC_OVL void
&nbsp;dofindgem()
&nbsp;{
&nbsp;    if (!Blind)
&nbsp;        You("spot a gem in the sparkling waters!");
&nbsp;    else
&nbsp;        You_feel("a gem here!");
&nbsp;    (void) mksobj_at(rnd_class(DILITHIUM_CRYSTAL, LUCKSTONE - 1), u.ux, u.uy,
&nbsp;                     FALSE, FALSE);
&nbsp;    SET_FOUNTAIN_LOOTED(u.ux, u.uy);
&nbsp;    newsym(u.ux, u.uy);
&nbsp;    exercise(A_WIS, TRUE); /* a discovery! */
&nbsp;}
&nbsp;
dryup
&nbsp;void
&nbsp;dryup(x, y, isyou)
&nbsp;xchar x, y;
&nbsp;boolean isyou;
&nbsp;{
&nbsp;    if (IS_FOUNTAIN(levl[x][y].typ)
&nbsp;        &amp;&amp; (!rn2(3) || FOUNTAIN_IS_WARNED(x, y))) {
&nbsp;        if (isyou &amp;&amp; in_town(x, y) &amp;&amp; !FOUNTAIN_IS_WARNED(x, y)) {
&nbsp;            struct monst *mtmp;
&nbsp;
&nbsp;            SET_FOUNTAIN_WARNED(x, y);
&nbsp;            /* Warn about future fountain use. */
&nbsp;            for (mtmp = fmon; mtmp; mtmp = mtmp-&gt;nmon) {
&nbsp;                if (DEADMONSTER(mtmp))
&nbsp;                    continue;
&nbsp;                if (is_watch(mtmp-&gt;data) &amp;&amp; couldsee(mtmp-&gt;mx, mtmp-&gt;my)
&nbsp;                    &amp;&amp; mtmp-&gt;mpeaceful) {
&nbsp;                    if (!Deaf) {
&nbsp;                        pline("%s yells:", Amonnam(mtmp));
&nbsp;                        verbalize("Hey, stop using that fountain!");
&nbsp;                    } else {
&nbsp;                        pline("%s earnestly %s %s %s!",
&nbsp;                              Amonnam(mtmp),
&nbsp;                              nolimbs(mtmp-&gt;data) ? "shakes" : "waves",
&nbsp;                              mhis(mtmp),
&nbsp;                              nolimbs(mtmp-&gt;data)
&nbsp;                                      ? mbodypart(mtmp, HEAD)
&nbsp;                                      : makeplural(mbodypart(mtmp, ARM)));
&nbsp;                    }
&nbsp;                    break;
&nbsp;                }
&nbsp;            }
&nbsp;            /* You can see or hear this effect */
&nbsp;            if (!mtmp)
&nbsp;                pline_The("flow reduces to a trickle.");
&nbsp;            return;
&nbsp;        }
&nbsp;        if (isyou &amp;&amp; wizard) {
&nbsp;            if (yn("Dry up fountain?") == 'n')
&nbsp;                return;
&nbsp;        }
&nbsp;        /* replace the fountain with ordinary floor */
&nbsp;        levl[x][y].typ = ROOM;
&nbsp;        levl[x][y].looted = 0;
&nbsp;        levl[x][y].blessedftn = 0;
&nbsp;        if (cansee(x, y))
&nbsp;            pline_The("fountain dries up!");
&nbsp;        /* The location is seen if the hero/monster is invisible
&nbsp;           or felt if the hero is blind. */
&nbsp;        newsym(x, y);
&nbsp;        level.flags.nfountains--;
&nbsp;        if (isyou &amp;&amp; in_town(x, y))
&nbsp;            (void) angry_guards(FALSE);
&nbsp;    }
&nbsp;}
&nbsp;
drinkfountain
&nbsp;void
&nbsp;drinkfountain()
&nbsp;{
&nbsp;    /* What happens when you drink from a fountain? */
&nbsp;    register boolean mgkftn = (levl[u.ux][u.uy].blessedftn == 1);
&nbsp;    register int fate = rnd(30);
&nbsp;
&nbsp;    if (Levitation) {
&nbsp;        floating_above("fountain");
&nbsp;        return;
&nbsp;    }
&nbsp;
&nbsp;    if (mgkftn &amp;&amp; u.uluck &gt;= 0 &amp;&amp; fate &gt;= 10) {
&nbsp;        int i, ii, littleluck = (u.uluck &lt; 4);
&nbsp;
&nbsp;        pline("Wow!  This makes you feel great!");
&nbsp;        /* blessed restore ability */
&nbsp;        for (ii = 0; ii &lt; A_MAX; ii++)
&nbsp;            if (ABASE(ii) &lt; AMAX(ii)) {
&nbsp;                ABASE(ii) = AMAX(ii);
&nbsp;                context.botl = 1;
&nbsp;            }
&nbsp;        /* gain ability, blessed if "natural" luck is high */
&nbsp;        i = rn2(A_MAX); /* start at a random attribute */
&nbsp;        for (ii = 0; ii &lt; A_MAX; ii++) {
&nbsp;            if (adjattrib(i, 1, littleluck ? -1 : 0) &amp;&amp; littleluck)
&nbsp;                break;
&nbsp;            if (++i &gt;= A_MAX)
&nbsp;                i = 0;
&nbsp;        }
&nbsp;        display_nhwindow(WIN_MESSAGE, FALSE);
&nbsp;        pline("A wisp of vapor escapes the fountain...");
&nbsp;        exercise(A_WIS, TRUE);
&nbsp;        levl[u.ux][u.uy].blessedftn = 0;
&nbsp;        return;
&nbsp;    }
&nbsp;
&nbsp;    if (fate &lt; 10) {
&nbsp;        pline_The("cool draught refreshes you.");
&nbsp;        u.uhunger += rnd(10); /* don't choke on water */
&nbsp;        newuhs(FALSE);
&nbsp;        if (mgkftn)
&nbsp;            return;
&nbsp;    } else {
&nbsp;        switch (fate) {
&nbsp;        case 19: /* Self-knowledge */
&nbsp;            You_feel("self-knowledgeable...");
&nbsp;            display_nhwindow(WIN_MESSAGE, FALSE);
&nbsp;            enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS);
&nbsp;            exercise(A_WIS, TRUE);
&nbsp;            pline_The("feeling subsides.");
&nbsp;            break;
&nbsp;        case 20: /* Foul water */
&nbsp;            pline_The("water is foul!  You gag and vomit.");
&nbsp;            morehungry(rn1(20, 11));
&nbsp;            vomit();
&nbsp;            break;
&nbsp;        case 21: /* Poisonous */
&nbsp;            pline_The("water is contaminated!");
&nbsp;            if (Poison_resistance) {
&nbsp;                pline("Perhaps it is runoff from the nearby %s farm.",
&nbsp;                      fruitname(FALSE));
&nbsp;                losehp(rnd(4), "unrefrigerated sip of juice", KILLED_BY_AN);
&nbsp;                break;
&nbsp;            }
&nbsp;            losestr(rn1(4, 3));
&nbsp;            losehp(rnd(10), "contaminated water", KILLED_BY);
&nbsp;            exercise(A_CON, FALSE);
&nbsp;            break;
&nbsp;        case 22: /* Fountain of snakes! */
&nbsp;            dowatersnakes();
&nbsp;            break;
&nbsp;        case 23: /* Water demon */
&nbsp;            dowaterdemon();
&nbsp;            break;
&nbsp;        case 24: /* Curse an item */ {
&nbsp;            register struct obj *obj;
&nbsp;
&nbsp;            pline("This water's no good!");
&nbsp;            morehungry(rn1(20, 11));
&nbsp;            exercise(A_CON, FALSE);
&nbsp;            for (obj = invent; obj; obj = obj-&gt;nobj)
&nbsp;                if (!rn2(5))
&nbsp;                    curse(obj);
&nbsp;            break;
&nbsp;        }
&nbsp;        case 25: /* See invisible */
&nbsp;            if (Blind) {
&nbsp;                if (Invisible) {
&nbsp;                    You("feel transparent.");
&nbsp;                } else {
&nbsp;                    You("feel very self-conscious.");
&nbsp;                    pline("Then it passes.");
&nbsp;                }
&nbsp;            } else {
&nbsp;                You_see("an image of someone stalking you.");
&nbsp;                pline("But it disappears.");
&nbsp;            }
&nbsp;            HSee_invisible |= FROMOUTSIDE;
&nbsp;            newsym(u.ux, u.uy);
&nbsp;            exercise(A_WIS, TRUE);
&nbsp;            break;
&nbsp;        case 26: /* See Monsters */
&nbsp;            (void) monster_detect((struct obj *) 0, 0);
&nbsp;            exercise(A_WIS, TRUE);
&nbsp;            break;
&nbsp;        case 27: /* Find a gem in the sparkling waters. */
&nbsp;            if (!FOUNTAIN_IS_LOOTED(u.ux, u.uy)) {
&nbsp;                dofindgem();
&nbsp;                break;
&nbsp;            }
&nbsp;            /*FALLTHRU*/
&nbsp;        case 28: /* Water Nymph */
&nbsp;            dowaternymph();
&nbsp;            break;
&nbsp;        case 29: /* Scare */
&nbsp;        {
&nbsp;            register struct monst *mtmp;
&nbsp;
&nbsp;            pline("This %s gives you bad breath!",
&nbsp;                  hliquid("water"));
&nbsp;            for (mtmp = fmon; mtmp; mtmp = mtmp-&gt;nmon) {
&nbsp;                if (DEADMONSTER(mtmp))
&nbsp;                    continue;
&nbsp;                monflee(mtmp, 0, FALSE, FALSE);
&nbsp;            }
&nbsp;            break;
&nbsp;        }
&nbsp;        case 30: /* Gushing forth in this room */
&nbsp;            dogushforth(TRUE);
&nbsp;            break;
&nbsp;        default:
&nbsp;            pline("This tepid %s is tasteless.",
&nbsp;                  hliquid("water"));
&nbsp;            break;
&nbsp;        }
&nbsp;    }
&nbsp;    dryup(u.ux, u.uy, TRUE);
&nbsp;}
&nbsp;
dipfountain
&nbsp;void
&nbsp;dipfountain(obj)
&nbsp;register struct obj *obj;
&nbsp;{
&nbsp;    if (Levitation) {
&nbsp;        floating_above("fountain");
&nbsp;        return;
&nbsp;    }
&nbsp;
&nbsp;    /* Don't grant Excalibur when there's more than one object.  */
&nbsp;    /* (quantity could be &gt; 1 if merged daggers got polymorphed) */
&nbsp;    if (obj-&gt;otyp == LONG_SWORD &amp;&amp; obj-&gt;quan == 1L &amp;&amp; u.ulevel &gt;= 5 &amp;&amp; !rn2(6)
&nbsp;        &amp;&amp; !obj-&gt;oartifact
&nbsp;        &amp;&amp; !exist_artifact(LONG_SWORD, artiname(ART_EXCALIBUR))) {
&nbsp;        if (u.ualign.type != A_LAWFUL) {
&nbsp;            /* Ha!  Trying to cheat her. */
&nbsp;            pline("A freezing mist rises from the %s and envelopes the sword.",
&nbsp;                  hliquid("water"));
&nbsp;            pline_The("fountain disappears!");
&nbsp;            curse(obj);
&nbsp;            if (obj-&gt;spe &gt; -6 &amp;&amp; !rn2(3))
&nbsp;                obj-&gt;spe--;
&nbsp;            obj-&gt;oerodeproof = FALSE;
&nbsp;            exercise(A_WIS, FALSE);
&nbsp;        } else {
&nbsp;            /* The lady of the lake acts! - Eric Backus */
&nbsp;            /* Be *REAL* nice */
&nbsp;            pline(
&nbsp;              "From the murky depths, a hand reaches up to bless the sword.");
&nbsp;            pline("As the hand retreats, the fountain disappears!");
&nbsp;            obj = oname(obj, artiname(ART_EXCALIBUR));
&nbsp;            discover_artifact(ART_EXCALIBUR);
&nbsp;            bless(obj);
&nbsp;            obj-&gt;oeroded = obj-&gt;oeroded2 = 0;
&nbsp;            obj-&gt;oerodeproof = TRUE;
&nbsp;            exercise(A_WIS, TRUE);
&nbsp;        }
&nbsp;        update_inventory();
&nbsp;        levl[u.ux][u.uy].typ = ROOM;
&nbsp;        levl[u.ux][u.uy].looted = 0;
&nbsp;        newsym(u.ux, u.uy);
&nbsp;        level.flags.nfountains--;
&nbsp;        if (in_town(u.ux, u.uy))
&nbsp;            (void) angry_guards(FALSE);
&nbsp;        return;
&nbsp;    } else {
&nbsp;        int er = water_damage(obj, NULL, TRUE);
&nbsp;
&nbsp;        if (obj-&gt;otyp == POT_ACID
&nbsp;            &amp;&amp; er != ER_DESTROYED) { /* Acid and water don't mix */
&nbsp;            useup(obj);
&nbsp;            return;
&nbsp;        } else if (er != ER_NOTHING &amp;&amp; !rn2(2)) { /* no further effect */
&nbsp;            return;
&nbsp;        }
&nbsp;    }
&nbsp;
&nbsp;    switch (rnd(30)) {
&nbsp;    case 16: /* Curse the item */
&nbsp;        curse(obj);
&nbsp;        break;
&nbsp;    case 17:
&nbsp;    case 18:
&nbsp;    case 19:
&nbsp;    case 20: /* Uncurse the item */
&nbsp;        if (obj-&gt;cursed) {
&nbsp;            if (!Blind)
&nbsp;                pline_The("%s glows for a moment.", hliquid("water"));
&nbsp;            uncurse(obj);
&nbsp;        } else {
&nbsp;            pline("A feeling of loss comes over you.");
&nbsp;        }
&nbsp;        break;
&nbsp;    case 21: /* Water Demon */
&nbsp;        dowaterdemon();
&nbsp;        break;
&nbsp;    case 22: /* Water Nymph */
&nbsp;        dowaternymph();
&nbsp;        break;
&nbsp;    case 23: /* an Endless Stream of Snakes */
&nbsp;        dowatersnakes();
&nbsp;        break;
&nbsp;    case 24: /* Find a gem */
&nbsp;        if (!FOUNTAIN_IS_LOOTED(u.ux, u.uy)) {
&nbsp;            dofindgem();
&nbsp;            break;
&nbsp;        }
&nbsp;        /*FALLTHRU*/
&nbsp;    case 25: /* Water gushes forth */
&nbsp;        dogushforth(FALSE);
&nbsp;        break;
&nbsp;    case 26: /* Strange feeling */
&nbsp;        pline("A strange tingling runs up your %s.", body_part(ARM));
&nbsp;        break;
&nbsp;    case 27: /* Strange feeling */
&nbsp;        You_feel("a sudden chill.");
&nbsp;        break;
&nbsp;    case 28: /* Strange feeling */
&nbsp;        pline("An urge to take a bath overwhelms you.");
&nbsp;        {
&nbsp;            long money = money_cnt(invent);
&nbsp;            struct obj *otmp;
&nbsp;            if (money &gt; 10) {
&nbsp;                /* Amount to lose.  Might get rounded up as fountains don't
&nbsp;                 * pay change... */
&nbsp;                money = somegold(money) / 10;
&nbsp;                for (otmp = invent; otmp &amp;&amp; money &gt; 0; otmp = otmp-&gt;nobj)
&nbsp;                    if (otmp-&gt;oclass == COIN_CLASS) {
&nbsp;                        int denomination = objects[otmp-&gt;otyp].oc_cost;
&nbsp;                        long coin_loss =
&nbsp;                            (money + denomination - 1) / denomination;
&nbsp;                        coin_loss = min(coin_loss, otmp-&gt;quan);
&nbsp;                        otmp-&gt;quan -= coin_loss;
&nbsp;                        money -= coin_loss * denomination;
&nbsp;                        if (!otmp-&gt;quan)
&nbsp;                            delobj(otmp);
&nbsp;                    }
&nbsp;                You("lost some of your money in the fountain!");
&nbsp;                CLEAR_FOUNTAIN_LOOTED(u.ux, u.uy);
&nbsp;                exercise(A_WIS, FALSE);
&nbsp;            }
&nbsp;        }
&nbsp;        break;
&nbsp;    case 29: /* You see coins */
&nbsp;        /* We make fountains have more coins the closer you are to the
&nbsp;         * surface.  After all, there will have been more people going
&nbsp;         * by.  Just like a shopping mall!  Chris Woodbury  */
&nbsp;
&nbsp;        if (FOUNTAIN_IS_LOOTED(u.ux, u.uy))
&nbsp;            break;
&nbsp;        SET_FOUNTAIN_LOOTED(u.ux, u.uy);
&nbsp;        (void) mkgold((long) (rnd((dunlevs_in_dungeon(&amp;u.uz) - dunlev(&amp;u.uz)
&nbsp;                                   + 1) * 2) + 5),
&nbsp;                      u.ux, u.uy);
&nbsp;        if (!Blind)
&nbsp;            pline("Far below you, you see coins glistening in the %s.",
&nbsp;                  hliquid("water"));
&nbsp;        exercise(A_WIS, TRUE);
&nbsp;        newsym(u.ux, u.uy);
&nbsp;        break;
&nbsp;    }
&nbsp;    update_inventory();
&nbsp;    dryup(u.ux, u.uy, TRUE);
&nbsp;}
&nbsp;
breaksink
&nbsp;void
&nbsp;breaksink(x, y)
&nbsp;int x, y;
&nbsp;{
&nbsp;    if (cansee(x, y) || (x == u.ux &amp;&amp; y == u.uy))
&nbsp;        pline_The("pipes break!  Water spurts out!");
&nbsp;    level.flags.nsinks--;
&nbsp;    levl[x][y].doormask = 0;
&nbsp;    levl[x][y].typ = FOUNTAIN;
&nbsp;    level.flags.nfountains++;
&nbsp;    newsym(x, y);
&nbsp;}
&nbsp;
drinksink
&nbsp;void
&nbsp;drinksink()
&nbsp;{
&nbsp;    struct obj *otmp;
&nbsp;    struct monst *mtmp;
&nbsp;
&nbsp;    if (Levitation) {
&nbsp;        floating_above("sink");
&nbsp;        return;
&nbsp;    }
&nbsp;    switch (rn2(20)) {
&nbsp;    case 0:
&nbsp;        You("take a sip of very cold %s.", hliquid("water"));
&nbsp;        break;
&nbsp;    case 1:
&nbsp;        You("take a sip of very warm %s.", hliquid("water"));
&nbsp;        break;
&nbsp;    case 2:
&nbsp;        You("take a sip of scalding hot %s.", hliquid("water"));
&nbsp;        if (Fire_resistance)
&nbsp;            pline("It seems quite tasty.");
&nbsp;        else
&nbsp;            losehp(rnd(6), "sipping boiling water", KILLED_BY);
&nbsp;        /* boiling water burns considered fire damage */
&nbsp;        break;
&nbsp;    case 3:
&nbsp;        if (mvitals[PM_SEWER_RAT].mvflags &amp; G_GONE)
&nbsp;            pline_The("sink seems quite dirty.");
&nbsp;        else {
&nbsp;            mtmp = makemon(&amp;mons[PM_SEWER_RAT], u.ux, u.uy, NO_MM_FLAGS);
&nbsp;            if (mtmp)
&nbsp;                pline("Eek!  There's %s in the sink!",
&nbsp;                      (Blind || !canspotmon(mtmp)) ? "something squirmy"
&nbsp;                                                   : a_monnam(mtmp));
&nbsp;        }
&nbsp;        break;
&nbsp;    case 4:
&nbsp;        do {
&nbsp;            otmp = mkobj(POTION_CLASS, FALSE);
&nbsp;            if (otmp-&gt;otyp == POT_WATER) {
&nbsp;                obfree(otmp, (struct obj *) 0);
&nbsp;                otmp = (struct obj *) 0;
&nbsp;            }
&nbsp;        } while (!otmp);
&nbsp;        otmp-&gt;cursed = otmp-&gt;blessed = 0;
&nbsp;        pline("Some %s liquid flows from the faucet.",
&nbsp;              Blind ? "odd" : hcolor(OBJ_DESCR(objects[otmp-&gt;otyp])));
&nbsp;        otmp-&gt;dknown = !(Blind || Hallucination);
&nbsp;        otmp-&gt;quan++;       /* Avoid panic upon useup() */
&nbsp;        otmp-&gt;fromsink = 1; /* kludge for docall() */
&nbsp;        (void) dopotion(otmp);
&nbsp;        obfree(otmp, (struct obj *) 0);
&nbsp;        break;
&nbsp;    case 5:
&nbsp;        if (!(levl[u.ux][u.uy].looted &amp; S_LRING)) {
&nbsp;            You("find a ring in the sink!");
&nbsp;            (void) mkobj_at(RING_CLASS, u.ux, u.uy, TRUE);
&nbsp;            levl[u.ux][u.uy].looted |= S_LRING;
&nbsp;            exercise(A_WIS, TRUE);
&nbsp;            newsym(u.ux, u.uy);
&nbsp;        } else
&nbsp;            pline("Some dirty %s backs up in the drain.", hliquid("water"));
&nbsp;        break;
&nbsp;    case 6:
&nbsp;        breaksink(u.ux, u.uy);
&nbsp;        break;
&nbsp;    case 7:
&nbsp;        pline_The("%s moves as though of its own will!", hliquid("water"));
&nbsp;        if ((mvitals[PM_WATER_ELEMENTAL].mvflags &amp; G_GONE)
&nbsp;            || !makemon(&amp;mons[PM_WATER_ELEMENTAL], u.ux, u.uy, NO_MM_FLAGS))
&nbsp;            pline("But it quiets down.");
&nbsp;        break;
&nbsp;    case 8:
&nbsp;        pline("Yuk, this %s tastes awful.", hliquid("water"));
&nbsp;        more_experienced(1, 0);
&nbsp;        newexplevel();
&nbsp;        break;
&nbsp;    case 9:
&nbsp;        pline("Gaggg... this tastes like sewage!  You vomit.");
&nbsp;        morehungry(rn1(30 - ACURR(A_CON), 11));
&nbsp;        vomit();
&nbsp;        break;
&nbsp;    case 10:
&nbsp;        pline("This %s contains toxic wastes!", hliquid("water"));
&nbsp;        if (!Unchanging) {
&nbsp;            You("undergo a freakish metamorphosis!");
&nbsp;            polyself(0);
&nbsp;        }
&nbsp;        break;
&nbsp;    /* more odd messages --JJB */
&nbsp;    case 11:
&nbsp;        You_hear("clanking from the pipes...");
&nbsp;        break;
&nbsp;    case 12:
&nbsp;        You_hear("snatches of song from among the sewers...");
&nbsp;        break;
&nbsp;    case 19:
&nbsp;        if (Hallucination) {
&nbsp;            pline("From the murky drain, a hand reaches up... --oops--");
&nbsp;            break;
&nbsp;        }
&nbsp;        /*FALLTHRU*/
&nbsp;    default:
&nbsp;        You("take a sip of %s %s.",
&nbsp;            rn2(3) ? (rn2(2) ? "cold" : "warm") : "hot",
&nbsp;            hliquid("water"));
&nbsp;    }
&nbsp;}
&nbsp;
&nbsp;/*fountain.c*/