xref: /netbsd-src/games/hack/hack.potion.c (revision 57c13365a356afd66d3c516457a7b914b8cf5375)
1*57c13365Sjoerg /*	$NetBSD: hack.potion.c,v 1.9 2011/05/23 22:53:25 joerg Exp $	*/
23ea4a95cSchristos 
3210cab45Smycroft /*
41c7f94e5Sjsm  * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
51c7f94e5Sjsm  * Amsterdam
61c7f94e5Sjsm  * All rights reserved.
71c7f94e5Sjsm  *
81c7f94e5Sjsm  * Redistribution and use in source and binary forms, with or without
91c7f94e5Sjsm  * modification, are permitted provided that the following conditions are
101c7f94e5Sjsm  * met:
111c7f94e5Sjsm  *
121c7f94e5Sjsm  * - Redistributions of source code must retain the above copyright notice,
131c7f94e5Sjsm  * this list of conditions and the following disclaimer.
141c7f94e5Sjsm  *
151c7f94e5Sjsm  * - Redistributions in binary form must reproduce the above copyright
161c7f94e5Sjsm  * notice, this list of conditions and the following disclaimer in the
171c7f94e5Sjsm  * documentation and/or other materials provided with the distribution.
181c7f94e5Sjsm  *
191c7f94e5Sjsm  * - Neither the name of the Stichting Centrum voor Wiskunde en
201c7f94e5Sjsm  * Informatica, nor the names of its contributors may be used to endorse or
211c7f94e5Sjsm  * promote products derived from this software without specific prior
221c7f94e5Sjsm  * written permission.
231c7f94e5Sjsm  *
241c7f94e5Sjsm  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
251c7f94e5Sjsm  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
261c7f94e5Sjsm  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
271c7f94e5Sjsm  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
281c7f94e5Sjsm  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
291c7f94e5Sjsm  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
301c7f94e5Sjsm  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
311c7f94e5Sjsm  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
321c7f94e5Sjsm  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
331c7f94e5Sjsm  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
341c7f94e5Sjsm  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
351c7f94e5Sjsm  */
361c7f94e5Sjsm 
371c7f94e5Sjsm /*
381c7f94e5Sjsm  * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
391c7f94e5Sjsm  * All rights reserved.
401c7f94e5Sjsm  *
411c7f94e5Sjsm  * Redistribution and use in source and binary forms, with or without
421c7f94e5Sjsm  * modification, are permitted provided that the following conditions
431c7f94e5Sjsm  * are met:
441c7f94e5Sjsm  * 1. Redistributions of source code must retain the above copyright
451c7f94e5Sjsm  *    notice, this list of conditions and the following disclaimer.
461c7f94e5Sjsm  * 2. Redistributions in binary form must reproduce the above copyright
471c7f94e5Sjsm  *    notice, this list of conditions and the following disclaimer in the
481c7f94e5Sjsm  *    documentation and/or other materials provided with the distribution.
491c7f94e5Sjsm  * 3. The name of the author may not be used to endorse or promote products
501c7f94e5Sjsm  *    derived from this software without specific prior written permission.
511c7f94e5Sjsm  *
521c7f94e5Sjsm  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
531c7f94e5Sjsm  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
541c7f94e5Sjsm  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
551c7f94e5Sjsm  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
561c7f94e5Sjsm  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
571c7f94e5Sjsm  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
581c7f94e5Sjsm  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
591c7f94e5Sjsm  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
601c7f94e5Sjsm  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
611c7f94e5Sjsm  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62210cab45Smycroft  */
63210cab45Smycroft 
643ea4a95cSchristos #include <sys/cdefs.h>
65210cab45Smycroft #ifndef lint
66*57c13365Sjoerg __RCSID("$NetBSD: hack.potion.c,v 1.9 2011/05/23 22:53:25 joerg Exp $");
67210cab45Smycroft #endif				/* not lint */
6861f28255Scgd 
6961f28255Scgd #include "hack.h"
703ea4a95cSchristos #include "extern.h"
7161f28255Scgd 
729b92b189Sdholland static void ghost_from_bottle(void);
739b92b189Sdholland 
743ea4a95cSchristos int
dodrink(void)751fa8a9a6Sdholland dodrink(void)
763ea4a95cSchristos {
773ea4a95cSchristos 	struct obj     *otmp, *objs;
783ea4a95cSchristos 	struct monst   *mtmp;
793ea4a95cSchristos 	int             unkn = 0, nothing = 0;
8061f28255Scgd 
8161f28255Scgd 	otmp = getobj("!", "drink");
823ea4a95cSchristos 	if (!otmp)
833ea4a95cSchristos 		return (0);
8461f28255Scgd 	if (!strcmp(objects[otmp->otyp].oc_descr, "smoky") && !rn2(13)) {
8561f28255Scgd 		ghost_from_bottle();
8661f28255Scgd 		goto use_it;
8761f28255Scgd 	}
8861f28255Scgd 	switch (otmp->otyp) {
8961f28255Scgd 	case POT_RESTORE_STRENGTH:
9061f28255Scgd 		unkn++;
9161f28255Scgd 		pline("Wow!  This makes you feel great!");
9261f28255Scgd 		if (u.ustr < u.ustrmax) {
9361f28255Scgd 			u.ustr = u.ustrmax;
9461f28255Scgd 			flags.botl = 1;
9561f28255Scgd 		}
9661f28255Scgd 		break;
9761f28255Scgd 	case POT_BOOZE:
9861f28255Scgd 		unkn++;
9961f28255Scgd 		pline("Ooph!  This tastes like liquid fire!");
10061f28255Scgd 		Confusion += d(3, 8);
10161f28255Scgd 		/* the whiskey makes us feel better */
1023ea4a95cSchristos 		if (u.uhp < u.uhpmax)
1033ea4a95cSchristos 			losehp(-1, "bottle of whiskey");
10461f28255Scgd 		if (!rn2(4)) {
10561f28255Scgd 			pline("You pass out.");
10661f28255Scgd 			multi = -rnd(15);
10761f28255Scgd 			nomovemsg = "You awake with a headache.";
10861f28255Scgd 		}
10961f28255Scgd 		break;
11061f28255Scgd 	case POT_INVISIBILITY:
11161f28255Scgd 		if (Invis || See_invisible)
11261f28255Scgd 			nothing++;
11361f28255Scgd 		else {
11461f28255Scgd 			if (!Blind)
11561f28255Scgd 				pline("Gee!  All of a sudden, you can't see yourself.");
11661f28255Scgd 			else
11761f28255Scgd 				pline("You feel rather airy."), unkn++;
11861f28255Scgd 			newsym(u.ux, u.uy);
11961f28255Scgd 		}
12061f28255Scgd 		Invis += rn1(15, 31);
12161f28255Scgd 		break;
12261f28255Scgd 	case POT_FRUIT_JUICE:
12361f28255Scgd 		pline("This tastes like fruit juice.");
12461f28255Scgd 		lesshungry(20);
12561f28255Scgd 		break;
12661f28255Scgd 	case POT_HEALING:
12761f28255Scgd 		pline("You begin to feel better.");
12861f28255Scgd 		flags.botl = 1;
12961f28255Scgd 		u.uhp += rnd(10);
13061f28255Scgd 		if (u.uhp > u.uhpmax)
13161f28255Scgd 			u.uhp = ++u.uhpmax;
1323ea4a95cSchristos 		if (Blind)
1333ea4a95cSchristos 			Blind = 1;	/* see on next move */
1343ea4a95cSchristos 		if (Sick)
1353ea4a95cSchristos 			Sick = 0;
13661f28255Scgd 		break;
13761f28255Scgd 	case POT_PARALYSIS:
13861f28255Scgd 		if (Levitation)
13961f28255Scgd 			pline("You are motionlessly suspended.");
14061f28255Scgd 		else
14161f28255Scgd 			pline("Your feet are frozen to the floor!");
14261f28255Scgd 		nomul(-(rn1(10, 25)));
14361f28255Scgd 		break;
14461f28255Scgd 	case POT_MONSTER_DETECTION:
14561f28255Scgd 		if (!fmon) {
14661f28255Scgd 			strange_feeling(otmp, "You feel threatened.");
14761f28255Scgd 			return (1);
14861f28255Scgd 		} else {
14961f28255Scgd 			cls();
15061f28255Scgd 			for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
15161f28255Scgd 				if (mtmp->mx > 0)
15261f28255Scgd 					at(mtmp->mx, mtmp->my, mtmp->data->mlet);
15361f28255Scgd 			prme();
15461f28255Scgd 			pline("You sense the presence of monsters.");
15561f28255Scgd 			more();
15661f28255Scgd 			docrt();
15761f28255Scgd 		}
15861f28255Scgd 		break;
15961f28255Scgd 	case POT_OBJECT_DETECTION:
16061f28255Scgd 		if (!fobj) {
16161f28255Scgd 			strange_feeling(otmp, "You feel a pull downward.");
16261f28255Scgd 			return (1);
16361f28255Scgd 		} else {
16461f28255Scgd 			for (objs = fobj; objs; objs = objs->nobj)
16561f28255Scgd 				if (objs->ox != u.ux || objs->oy != u.uy)
16661f28255Scgd 					goto outobjmap;
16761f28255Scgd 			pline("You sense the presence of objects close nearby.");
16861f28255Scgd 			break;
16961f28255Scgd 	outobjmap:
17061f28255Scgd 			cls();
17161f28255Scgd 			for (objs = fobj; objs; objs = objs->nobj)
17261f28255Scgd 				at(objs->ox, objs->oy, objs->olet);
17361f28255Scgd 			prme();
17461f28255Scgd 			pline("You sense the presence of objects.");
17561f28255Scgd 			more();
17661f28255Scgd 			docrt();
17761f28255Scgd 		}
17861f28255Scgd 		break;
17961f28255Scgd 	case POT_SICKNESS:
18061f28255Scgd 		pline("Yech! This stuff tastes like poison.");
18161f28255Scgd 		if (Poison_resistance)
18261f28255Scgd 			pline("(But in fact it was biologically contaminated orange juice.)");
18361f28255Scgd 		losestr(rn1(4, 3));
18461f28255Scgd 		losehp(rnd(10), "contaminated potion");
18561f28255Scgd 		break;
18661f28255Scgd 	case POT_CONFUSION:
18761f28255Scgd 		if (!Confusion)
18861f28255Scgd 			pline("Huh, What?  Where am I?");
18961f28255Scgd 		else
19061f28255Scgd 			nothing++;
19161f28255Scgd 		Confusion += rn1(7, 16);
19261f28255Scgd 		break;
19361f28255Scgd 	case POT_GAIN_STRENGTH:
19461f28255Scgd 		pline("Wow do you feel strong!");
1953ea4a95cSchristos 		if (u.ustr >= 118)
1963ea4a95cSchristos 			break;	/* > 118 is impossible */
1973ea4a95cSchristos 		if (u.ustr > 17)
1983ea4a95cSchristos 			u.ustr += rnd(118 - u.ustr);
1993ea4a95cSchristos 		else
2003ea4a95cSchristos 			u.ustr++;
2013ea4a95cSchristos 		if (u.ustr > u.ustrmax)
2023ea4a95cSchristos 			u.ustrmax = u.ustr;
20361f28255Scgd 		flags.botl = 1;
20461f28255Scgd 		break;
20561f28255Scgd 	case POT_SPEED:
20661f28255Scgd 		if (Wounded_legs) {
20761f28255Scgd 			heal_legs();
20861f28255Scgd 			unkn++;
20961f28255Scgd 			break;
21061f28255Scgd 		}
21161f28255Scgd 		if (!(Fast & ~INTRINSIC))
21261f28255Scgd 			pline("You are suddenly moving much faster.");
21361f28255Scgd 		else
21461f28255Scgd 			pline("Your legs get new energy."), unkn++;
21561f28255Scgd 		Fast += rn1(10, 100);
21661f28255Scgd 		break;
21761f28255Scgd 	case POT_BLINDNESS:
21861f28255Scgd 		if (!Blind)
21961f28255Scgd 			pline("A cloud of darkness falls upon you.");
22061f28255Scgd 		else
22161f28255Scgd 			nothing++;
22261f28255Scgd 		Blind += rn1(100, 250);
22361f28255Scgd 		seeoff(0);
22461f28255Scgd 		break;
22561f28255Scgd 	case POT_GAIN_LEVEL:
22661f28255Scgd 		pluslvl();
22761f28255Scgd 		break;
22861f28255Scgd 	case POT_EXTRA_HEALING:
22961f28255Scgd 		pline("You feel much better.");
23061f28255Scgd 		flags.botl = 1;
23161f28255Scgd 		u.uhp += d(2, 20) + 1;
23261f28255Scgd 		if (u.uhp > u.uhpmax)
23361f28255Scgd 			u.uhp = (u.uhpmax += 2);
2343ea4a95cSchristos 		if (Blind)
2353ea4a95cSchristos 			Blind = 1;
2363ea4a95cSchristos 		if (Sick)
2373ea4a95cSchristos 			Sick = 0;
23861f28255Scgd 		break;
23961f28255Scgd 	case POT_LEVITATION:
24061f28255Scgd 		if (!Levitation)
24161f28255Scgd 			float_up();
24261f28255Scgd 		else
24361f28255Scgd 			nothing++;
24461f28255Scgd 		Levitation += rnd(100);
24561f28255Scgd 		u.uprops[PROP(RIN_LEVITATION)].p_tofn = float_down;
24661f28255Scgd 		break;
24761f28255Scgd 	default:
24861f28255Scgd 		impossible("What a funny potion! (%u)", otmp->otyp);
24961f28255Scgd 		return (0);
25061f28255Scgd 	}
25161f28255Scgd 	if (nothing) {
25261f28255Scgd 		unkn++;
25361f28255Scgd 		pline("You have a peculiar feeling for a moment, then it passes.");
25461f28255Scgd 	}
25561f28255Scgd 	if (otmp->dknown && !objects[otmp->otyp].oc_name_known) {
25661f28255Scgd 		if (!unkn) {
25761f28255Scgd 			objects[otmp->otyp].oc_name_known = 1;
25861f28255Scgd 			more_experienced(0, 10);
25961f28255Scgd 		} else if (!objects[otmp->otyp].oc_uname)
26061f28255Scgd 			docall(otmp);
26161f28255Scgd 	}
26261f28255Scgd use_it:
26361f28255Scgd 	useup(otmp);
26461f28255Scgd 	return (1);
26561f28255Scgd }
26661f28255Scgd 
2673ea4a95cSchristos void
pluslvl(void)2681fa8a9a6Sdholland pluslvl(void)
26961f28255Scgd {
2703ea4a95cSchristos 	int num;
27161f28255Scgd 
27261f28255Scgd 	pline("You feel more experienced.");
27361f28255Scgd 	num = rnd(10);
27461f28255Scgd 	u.uhpmax += num;
27561f28255Scgd 	u.uhp += num;
27661f28255Scgd 	if (u.ulevel < 14) {
27761f28255Scgd 		u.uexp = newuexp() + 1;
27861f28255Scgd 		pline("Welcome to experience level %u.", ++u.ulevel);
27961f28255Scgd 	}
28061f28255Scgd 	flags.botl = 1;
28161f28255Scgd }
28261f28255Scgd 
2833ea4a95cSchristos void
strange_feeling(struct obj * obj,const char * txt)2841fa8a9a6Sdholland strange_feeling(struct obj *obj, const char *txt)
28561f28255Scgd {
28661f28255Scgd 	if (flags.beginner)
28761f28255Scgd 		pline("You have a strange feeling for a moment, then it passes.");
28861f28255Scgd 	else
289*57c13365Sjoerg 		pline("%s", txt);
29061f28255Scgd 	if (!objects[obj->otyp].oc_name_known && !objects[obj->otyp].oc_uname)
29161f28255Scgd 		docall(obj);
29261f28255Scgd 	useup(obj);
29361f28255Scgd }
29461f28255Scgd 
2959b92b189Sdholland static const char *const bottlenames[] = {
29661f28255Scgd 	"bottle", "phial", "flagon", "carafe", "flask", "jar", "vial"
29761f28255Scgd };
29861f28255Scgd 
2993ea4a95cSchristos void
potionhit(struct monst * mon,struct obj * obj)3001fa8a9a6Sdholland potionhit(struct monst *mon, struct obj *obj)
30161f28255Scgd {
302ab8b6343Sjsm 	const char           *botlnam = bottlenames[rn2(SIZE(bottlenames))];
30361f28255Scgd 	boolean         uclose, isyou = (mon == &youmonst);
30461f28255Scgd 
30561f28255Scgd 	if (isyou) {
30661f28255Scgd 		uclose = TRUE;
30761f28255Scgd 		pline("The %s crashes on your head and breaks into shivers.",
30861f28255Scgd 		      botlnam);
30961f28255Scgd 		losehp(rnd(2), "thrown potion");
31061f28255Scgd 	} else {
31161f28255Scgd 		uclose = (dist(mon->mx, mon->my) < 3);
31261f28255Scgd 		/* perhaps 'E' and 'a' have no head? */
31361f28255Scgd 		pline("The %s crashes on %s's head and breaks into shivers.",
31461f28255Scgd 		      botlnam, monnam(mon));
31561f28255Scgd 		if (rn2(5) && mon->mhp > 1)
31661f28255Scgd 			mon->mhp--;
31761f28255Scgd 	}
31861f28255Scgd 	pline("The %s evaporates.", xname(obj));
31961f28255Scgd 
3203ea4a95cSchristos 	if (!isyou && !rn2(3))
3213ea4a95cSchristos 		switch (obj->otyp) {
32261f28255Scgd 
32361f28255Scgd 		case POT_RESTORE_STRENGTH:
32461f28255Scgd 		case POT_GAIN_STRENGTH:
32561f28255Scgd 		case POT_HEALING:
32661f28255Scgd 		case POT_EXTRA_HEALING:
32761f28255Scgd 			if (mon->mhp < mon->mhpmax) {
32861f28255Scgd 				mon->mhp = mon->mhpmax;
32961f28255Scgd 				pline("%s looks sound and hale again!", Monnam(mon));
33061f28255Scgd 			}
33161f28255Scgd 			break;
33261f28255Scgd 		case POT_SICKNESS:
33361f28255Scgd 			if (mon->mhpmax > 3)
33461f28255Scgd 				mon->mhpmax /= 2;
33561f28255Scgd 			if (mon->mhp > 2)
33661f28255Scgd 				mon->mhp /= 2;
33761f28255Scgd 			break;
33861f28255Scgd 		case POT_CONFUSION:
33961f28255Scgd 		case POT_BOOZE:
34061f28255Scgd 			mon->mconf = 1;
34161f28255Scgd 			break;
34261f28255Scgd 		case POT_INVISIBILITY:
34361f28255Scgd 			unpmon(mon);
34461f28255Scgd 			mon->minvis = 1;
34561f28255Scgd 			pmon(mon);
34661f28255Scgd 			break;
34761f28255Scgd 		case POT_PARALYSIS:
34861f28255Scgd 			mon->mfroz = 1;
34961f28255Scgd 			break;
35061f28255Scgd 		case POT_SPEED:
35161f28255Scgd 			mon->mspeed = MFAST;
35261f28255Scgd 			break;
35361f28255Scgd 		case POT_BLINDNESS:
35461f28255Scgd 			mon->mblinded |= 64 + rn2(64);
35561f28255Scgd 			break;
35661f28255Scgd 			/*
3573ea4a95cSchristos 			 * case POT_GAIN_LEVEL: case POT_LEVITATION: case
3583ea4a95cSchristos 			 * POT_FRUIT_JUICE: case POT_MONSTER_DETECTION: case
3593ea4a95cSchristos 			 * POT_OBJECT_DETECTION: break;
36061f28255Scgd 			 */
36161f28255Scgd 		}
36261f28255Scgd 	if (uclose && rn2(5))
36361f28255Scgd 		potionbreathe(obj);
36461f28255Scgd 	obfree(obj, Null(obj));
36561f28255Scgd }
36661f28255Scgd 
3673ea4a95cSchristos void
potionbreathe(struct obj * obj)3681fa8a9a6Sdholland potionbreathe(struct obj *obj)
36961f28255Scgd {
37061f28255Scgd 	switch (obj->otyp) {
37161f28255Scgd 	case POT_RESTORE_STRENGTH:
37261f28255Scgd 	case POT_GAIN_STRENGTH:
3733ea4a95cSchristos 		if (u.ustr < u.ustrmax)
3743ea4a95cSchristos 			u.ustr++, flags.botl = 1;
37561f28255Scgd 		break;
37661f28255Scgd 	case POT_HEALING:
37761f28255Scgd 	case POT_EXTRA_HEALING:
3783ea4a95cSchristos 		if (u.uhp < u.uhpmax)
3793ea4a95cSchristos 			u.uhp++, flags.botl = 1;
38061f28255Scgd 		break;
38161f28255Scgd 	case POT_SICKNESS:
3823ea4a95cSchristos 		if (u.uhp <= 5)
3833ea4a95cSchristos 			u.uhp = 1;
3843ea4a95cSchristos 		else
3853ea4a95cSchristos 			u.uhp -= 5;
38661f28255Scgd 		flags.botl = 1;
38761f28255Scgd 		break;
38861f28255Scgd 	case POT_CONFUSION:
38961f28255Scgd 	case POT_BOOZE:
39061f28255Scgd 		if (!Confusion)
39161f28255Scgd 			pline("You feel somewhat dizzy.");
39261f28255Scgd 		Confusion += rnd(5);
39361f28255Scgd 		break;
39461f28255Scgd 	case POT_INVISIBILITY:
39561f28255Scgd 		pline("For an instant you couldn't see your right hand.");
39661f28255Scgd 		break;
39761f28255Scgd 	case POT_PARALYSIS:
39861f28255Scgd 		pline("Something seems to be holding you.");
39961f28255Scgd 		nomul(-rnd(5));
40061f28255Scgd 		break;
40161f28255Scgd 	case POT_SPEED:
40261f28255Scgd 		Fast += rnd(5);
40361f28255Scgd 		pline("Your knees seem more flexible now.");
40461f28255Scgd 		break;
40561f28255Scgd 	case POT_BLINDNESS:
4063ea4a95cSchristos 		if (!Blind)
4073ea4a95cSchristos 			pline("It suddenly gets dark.");
40861f28255Scgd 		Blind += rnd(5);
40961f28255Scgd 		seeoff(0);
41061f28255Scgd 		break;
41161f28255Scgd 		/*
4123ea4a95cSchristos 		 * case POT_GAIN_LEVEL: case POT_LEVITATION: case
4133ea4a95cSchristos 		 * POT_FRUIT_JUICE: case POT_MONSTER_DETECTION: case
4143ea4a95cSchristos 		 * POT_OBJECT_DETECTION: break;
41561f28255Scgd 		 */
41661f28255Scgd 	}
41761f28255Scgd 	/* note: no obfree() */
41861f28255Scgd }
41961f28255Scgd 
42061f28255Scgd /*
42161f28255Scgd  * -- rudimentary -- to do this correctly requires much more work
42261f28255Scgd  * -- all sharp weapons get one or more qualities derived from the potions
42361f28255Scgd  * -- texts on scrolls may be (partially) wiped out; do they become blank?
42461f28255Scgd  * --   or does their effect change, like under Confusion?
42561f28255Scgd  * -- all objects may be made invisible by POT_INVISIBILITY
42661f28255Scgd  * -- If the flask is small, can one dip a large object? Does it magically
42761f28255Scgd  * --   become a jug? Etc.
42861f28255Scgd  */
4293ea4a95cSchristos int
dodip(void)4301fa8a9a6Sdholland dodip(void)
4313ea4a95cSchristos {
4323ea4a95cSchristos 	struct obj     *potion, *obj;
43361f28255Scgd 
43461f28255Scgd 	if (!(obj = getobj("#", "dip")))
43561f28255Scgd 		return (0);
43661f28255Scgd 	if (!(potion = getobj("!", "dip into")))
43761f28255Scgd 		return (0);
43861f28255Scgd 	pline("Interesting...");
43961f28255Scgd 	if (obj->otyp == ARROW || obj->otyp == DART ||
44061f28255Scgd 	    obj->otyp == CROSSBOW_BOLT) {
44161f28255Scgd 		if (potion->otyp == POT_SICKNESS) {
44261f28255Scgd 			useup(potion);
4433ea4a95cSchristos 			if (obj->spe < 7)
4443ea4a95cSchristos 				obj->spe++;	/* %% */
44561f28255Scgd 		}
44661f28255Scgd 	}
44761f28255Scgd 	return (1);
44861f28255Scgd }
44961f28255Scgd 
4509b92b189Sdholland static void
ghost_from_bottle(void)4511fa8a9a6Sdholland ghost_from_bottle(void)
4523ea4a95cSchristos {
4533ea4a95cSchristos 	struct monst   *mtmp;
45461f28255Scgd 
45561f28255Scgd 	if (!(mtmp = makemon(PM_GHOST, u.ux, u.uy))) {
45661f28255Scgd 		pline("This bottle turns out to be empty.");
45761f28255Scgd 		return;
45861f28255Scgd 	}
45961f28255Scgd 	mnexto(mtmp);
46061f28255Scgd 	pline("As you open the bottle, an enormous ghost emerges!");
46161f28255Scgd 	pline("You are frightened to death, and unable to move.");
46261f28255Scgd 	nomul(-3);
46361f28255Scgd }
464