2003-04-02 22:36:33 +04:00
|
|
|
/* $NetBSD: hack.potion.c,v 1.6 2003/04/02 18:36:39 jsm Exp $ */
|
1997-10-19 20:56:41 +04:00
|
|
|
|
1993-08-02 21:18:41 +04:00
|
|
|
/*
|
2003-04-02 22:36:33 +04:00
|
|
|
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
|
|
|
|
* Amsterdam
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met:
|
|
|
|
*
|
|
|
|
* - Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* - Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* - Neither the name of the Stichting Centrum voor Wiskunde en
|
|
|
|
* Informatica, nor the names of its contributors may be used to endorse or
|
|
|
|
* promote products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
|
|
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
|
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
|
|
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
|
|
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1993-08-02 21:18:41 +04:00
|
|
|
*/
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
#include <sys/cdefs.h>
|
1993-08-02 21:18:41 +04:00
|
|
|
#ifndef lint
|
2003-04-02 22:36:33 +04:00
|
|
|
__RCSID("$NetBSD: hack.potion.c,v 1.6 2003/04/02 18:36:39 jsm Exp $");
|
1997-10-19 20:56:41 +04:00
|
|
|
#endif /* not lint */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
#include "hack.h"
|
1997-10-19 20:56:41 +04:00
|
|
|
#include "extern.h"
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
int
|
|
|
|
dodrink()
|
|
|
|
{
|
|
|
|
struct obj *otmp, *objs;
|
|
|
|
struct monst *mtmp;
|
|
|
|
int unkn = 0, nothing = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
otmp = getobj("!", "drink");
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!otmp)
|
|
|
|
return (0);
|
|
|
|
if (!strcmp(objects[otmp->otyp].oc_descr, "smoky") && !rn2(13)) {
|
1993-03-21 12:45:37 +03:00
|
|
|
ghost_from_bottle();
|
|
|
|
goto use_it;
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
switch (otmp->otyp) {
|
1993-03-21 12:45:37 +03:00
|
|
|
case POT_RESTORE_STRENGTH:
|
|
|
|
unkn++;
|
|
|
|
pline("Wow! This makes you feel great!");
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.ustr < u.ustrmax) {
|
1993-03-21 12:45:37 +03:00
|
|
|
u.ustr = u.ustrmax;
|
|
|
|
flags.botl = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case POT_BOOZE:
|
|
|
|
unkn++;
|
|
|
|
pline("Ooph! This tastes like liquid fire!");
|
1997-10-19 20:56:41 +04:00
|
|
|
Confusion += d(3, 8);
|
1993-03-21 12:45:37 +03:00
|
|
|
/* the whiskey makes us feel better */
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.uhp < u.uhpmax)
|
|
|
|
losehp(-1, "bottle of whiskey");
|
|
|
|
if (!rn2(4)) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You pass out.");
|
|
|
|
multi = -rnd(15);
|
|
|
|
nomovemsg = "You awake with a headache.";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case POT_INVISIBILITY:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (Invis || See_invisible)
|
|
|
|
nothing++;
|
1993-03-21 12:45:37 +03:00
|
|
|
else {
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!Blind)
|
|
|
|
pline("Gee! All of a sudden, you can't see yourself.");
|
|
|
|
else
|
|
|
|
pline("You feel rather airy."), unkn++;
|
|
|
|
newsym(u.ux, u.uy);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
Invis += rn1(15, 31);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case POT_FRUIT_JUICE:
|
|
|
|
pline("This tastes like fruit juice.");
|
|
|
|
lesshungry(20);
|
|
|
|
break;
|
|
|
|
case POT_HEALING:
|
|
|
|
pline("You begin to feel better.");
|
|
|
|
flags.botl = 1;
|
|
|
|
u.uhp += rnd(10);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.uhp > u.uhpmax)
|
1993-03-21 12:45:37 +03:00
|
|
|
u.uhp = ++u.uhpmax;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (Blind)
|
|
|
|
Blind = 1; /* see on next move */
|
|
|
|
if (Sick)
|
|
|
|
Sick = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case POT_PARALYSIS:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (Levitation)
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You are motionlessly suspended.");
|
|
|
|
else
|
|
|
|
pline("Your feet are frozen to the floor!");
|
1997-10-19 20:56:41 +04:00
|
|
|
nomul(-(rn1(10, 25)));
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case POT_MONSTER_DETECTION:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!fmon) {
|
1993-03-21 12:45:37 +03:00
|
|
|
strange_feeling(otmp, "You feel threatened.");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
} else {
|
|
|
|
cls();
|
1997-10-19 20:56:41 +04:00
|
|
|
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
|
|
|
|
if (mtmp->mx > 0)
|
|
|
|
at(mtmp->mx, mtmp->my, mtmp->data->mlet);
|
1993-03-21 12:45:37 +03:00
|
|
|
prme();
|
|
|
|
pline("You sense the presence of monsters.");
|
|
|
|
more();
|
|
|
|
docrt();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case POT_OBJECT_DETECTION:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!fobj) {
|
1993-03-21 12:45:37 +03:00
|
|
|
strange_feeling(otmp, "You feel a pull downward.");
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
} else {
|
1997-10-19 20:56:41 +04:00
|
|
|
for (objs = fobj; objs; objs = objs->nobj)
|
|
|
|
if (objs->ox != u.ux || objs->oy != u.uy)
|
|
|
|
goto outobjmap;
|
|
|
|
pline("You sense the presence of objects close nearby.");
|
|
|
|
break;
|
|
|
|
outobjmap:
|
1993-03-21 12:45:37 +03:00
|
|
|
cls();
|
1997-10-19 20:56:41 +04:00
|
|
|
for (objs = fobj; objs; objs = objs->nobj)
|
|
|
|
at(objs->ox, objs->oy, objs->olet);
|
1993-03-21 12:45:37 +03:00
|
|
|
prme();
|
|
|
|
pline("You sense the presence of objects.");
|
|
|
|
more();
|
|
|
|
docrt();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case POT_SICKNESS:
|
|
|
|
pline("Yech! This stuff tastes like poison.");
|
1997-10-19 20:56:41 +04:00
|
|
|
if (Poison_resistance)
|
|
|
|
pline("(But in fact it was biologically contaminated orange juice.)");
|
|
|
|
losestr(rn1(4, 3));
|
1993-03-21 12:45:37 +03:00
|
|
|
losehp(rnd(10), "contaminated potion");
|
|
|
|
break;
|
|
|
|
case POT_CONFUSION:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!Confusion)
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("Huh, What? Where am I?");
|
|
|
|
else
|
|
|
|
nothing++;
|
1997-10-19 20:56:41 +04:00
|
|
|
Confusion += rn1(7, 16);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case POT_GAIN_STRENGTH:
|
|
|
|
pline("Wow do you feel strong!");
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.ustr >= 118)
|
|
|
|
break; /* > 118 is impossible */
|
|
|
|
if (u.ustr > 17)
|
|
|
|
u.ustr += rnd(118 - u.ustr);
|
|
|
|
else
|
|
|
|
u.ustr++;
|
|
|
|
if (u.ustr > u.ustrmax)
|
|
|
|
u.ustrmax = u.ustr;
|
1993-03-21 12:45:37 +03:00
|
|
|
flags.botl = 1;
|
|
|
|
break;
|
|
|
|
case POT_SPEED:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (Wounded_legs) {
|
1993-03-21 12:45:37 +03:00
|
|
|
heal_legs();
|
|
|
|
unkn++;
|
|
|
|
break;
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!(Fast & ~INTRINSIC))
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You are suddenly moving much faster.");
|
|
|
|
else
|
|
|
|
pline("Your legs get new energy."), unkn++;
|
1997-10-19 20:56:41 +04:00
|
|
|
Fast += rn1(10, 100);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case POT_BLINDNESS:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!Blind)
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("A cloud of darkness falls upon you.");
|
|
|
|
else
|
|
|
|
nothing++;
|
1997-10-19 20:56:41 +04:00
|
|
|
Blind += rn1(100, 250);
|
1993-03-21 12:45:37 +03:00
|
|
|
seeoff(0);
|
|
|
|
break;
|
1997-10-19 20:56:41 +04:00
|
|
|
case POT_GAIN_LEVEL:
|
1993-03-21 12:45:37 +03:00
|
|
|
pluslvl();
|
|
|
|
break;
|
|
|
|
case POT_EXTRA_HEALING:
|
|
|
|
pline("You feel much better.");
|
|
|
|
flags.botl = 1;
|
1997-10-19 20:56:41 +04:00
|
|
|
u.uhp += d(2, 20) + 1;
|
|
|
|
if (u.uhp > u.uhpmax)
|
1993-03-21 12:45:37 +03:00
|
|
|
u.uhp = (u.uhpmax += 2);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (Blind)
|
|
|
|
Blind = 1;
|
|
|
|
if (Sick)
|
|
|
|
Sick = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case POT_LEVITATION:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!Levitation)
|
1993-03-21 12:45:37 +03:00
|
|
|
float_up();
|
|
|
|
else
|
|
|
|
nothing++;
|
|
|
|
Levitation += rnd(100);
|
|
|
|
u.uprops[PROP(RIN_LEVITATION)].p_tofn = float_down;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
impossible("What a funny potion! (%u)", otmp->otyp);
|
1997-10-19 20:56:41 +04:00
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (nothing) {
|
|
|
|
unkn++;
|
|
|
|
pline("You have a peculiar feeling for a moment, then it passes.");
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (otmp->dknown && !objects[otmp->otyp].oc_name_known) {
|
|
|
|
if (!unkn) {
|
1993-03-21 12:45:37 +03:00
|
|
|
objects[otmp->otyp].oc_name_known = 1;
|
1997-10-19 20:56:41 +04:00
|
|
|
more_experienced(0, 10);
|
|
|
|
} else if (!objects[otmp->otyp].oc_uname)
|
1993-03-21 12:45:37 +03:00
|
|
|
docall(otmp);
|
|
|
|
}
|
|
|
|
use_it:
|
|
|
|
useup(otmp);
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
pluslvl()
|
|
|
|
{
|
1997-10-19 20:56:41 +04:00
|
|
|
int num;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
pline("You feel more experienced.");
|
|
|
|
num = rnd(10);
|
|
|
|
u.uhpmax += num;
|
|
|
|
u.uhp += num;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.ulevel < 14) {
|
|
|
|
u.uexp = newuexp() + 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("Welcome to experience level %u.", ++u.ulevel);
|
|
|
|
}
|
|
|
|
flags.botl = 1;
|
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
|
|
|
strange_feeling(obj, txt)
|
|
|
|
struct obj *obj;
|
2001-03-26 00:43:58 +04:00
|
|
|
const char *txt;
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1997-10-19 20:56:41 +04:00
|
|
|
if (flags.beginner)
|
|
|
|
pline("You have a strange feeling for a moment, then it passes.");
|
1993-03-21 12:45:37 +03:00
|
|
|
else
|
1997-10-19 20:56:41 +04:00
|
|
|
pline(txt);
|
|
|
|
if (!objects[obj->otyp].oc_name_known && !objects[obj->otyp].oc_uname)
|
1993-03-21 12:45:37 +03:00
|
|
|
docall(obj);
|
|
|
|
useup(obj);
|
|
|
|
}
|
|
|
|
|
2001-03-26 00:43:58 +04:00
|
|
|
const char *const bottlenames[] = {
|
1993-03-21 12:45:37 +03:00
|
|
|
"bottle", "phial", "flagon", "carafe", "flask", "jar", "vial"
|
|
|
|
};
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
potionhit(mon, obj)
|
1997-10-19 20:56:41 +04:00
|
|
|
struct monst *mon;
|
|
|
|
struct obj *obj;
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
2001-03-26 00:43:58 +04:00
|
|
|
const char *botlnam = bottlenames[rn2(SIZE(bottlenames))];
|
1997-10-19 20:56:41 +04:00
|
|
|
boolean uclose, isyou = (mon == &youmonst);
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
if (isyou) {
|
1993-03-21 12:45:37 +03:00
|
|
|
uclose = TRUE;
|
|
|
|
pline("The %s crashes on your head and breaks into shivers.",
|
1997-10-19 20:56:41 +04:00
|
|
|
botlnam);
|
1993-03-21 12:45:37 +03:00
|
|
|
losehp(rnd(2), "thrown potion");
|
|
|
|
} else {
|
1997-10-19 20:56:41 +04:00
|
|
|
uclose = (dist(mon->mx, mon->my) < 3);
|
1993-03-21 12:45:37 +03:00
|
|
|
/* perhaps 'E' and 'a' have no head? */
|
|
|
|
pline("The %s crashes on %s's head and breaks into shivers.",
|
1997-10-19 20:56:41 +04:00
|
|
|
botlnam, monnam(mon));
|
|
|
|
if (rn2(5) && mon->mhp > 1)
|
1993-03-21 12:45:37 +03:00
|
|
|
mon->mhp--;
|
|
|
|
}
|
|
|
|
pline("The %s evaporates.", xname(obj));
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!isyou && !rn2(3))
|
|
|
|
switch (obj->otyp) {
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
case POT_RESTORE_STRENGTH:
|
|
|
|
case POT_GAIN_STRENGTH:
|
|
|
|
case POT_HEALING:
|
|
|
|
case POT_EXTRA_HEALING:
|
|
|
|
if (mon->mhp < mon->mhpmax) {
|
|
|
|
mon->mhp = mon->mhpmax;
|
|
|
|
pline("%s looks sound and hale again!", Monnam(mon));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case POT_SICKNESS:
|
|
|
|
if (mon->mhpmax > 3)
|
|
|
|
mon->mhpmax /= 2;
|
|
|
|
if (mon->mhp > 2)
|
|
|
|
mon->mhp /= 2;
|
|
|
|
break;
|
|
|
|
case POT_CONFUSION:
|
|
|
|
case POT_BOOZE:
|
|
|
|
mon->mconf = 1;
|
|
|
|
break;
|
|
|
|
case POT_INVISIBILITY:
|
|
|
|
unpmon(mon);
|
|
|
|
mon->minvis = 1;
|
|
|
|
pmon(mon);
|
|
|
|
break;
|
|
|
|
case POT_PARALYSIS:
|
|
|
|
mon->mfroz = 1;
|
|
|
|
break;
|
|
|
|
case POT_SPEED:
|
|
|
|
mon->mspeed = MFAST;
|
|
|
|
break;
|
|
|
|
case POT_BLINDNESS:
|
|
|
|
mon->mblinded |= 64 + rn2(64);
|
|
|
|
break;
|
|
|
|
/*
|
|
|
|
* case POT_GAIN_LEVEL: case POT_LEVITATION: case
|
|
|
|
* POT_FRUIT_JUICE: case POT_MONSTER_DETECTION: case
|
|
|
|
* POT_OBJECT_DETECTION: break;
|
|
|
|
*/
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (uclose && rn2(5))
|
1993-03-21 12:45:37 +03:00
|
|
|
potionbreathe(obj);
|
|
|
|
obfree(obj, Null(obj));
|
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
potionbreathe(obj)
|
1997-10-19 20:56:41 +04:00
|
|
|
struct obj *obj;
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1997-10-19 20:56:41 +04:00
|
|
|
switch (obj->otyp) {
|
1993-03-21 12:45:37 +03:00
|
|
|
case POT_RESTORE_STRENGTH:
|
|
|
|
case POT_GAIN_STRENGTH:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.ustr < u.ustrmax)
|
|
|
|
u.ustr++, flags.botl = 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case POT_HEALING:
|
|
|
|
case POT_EXTRA_HEALING:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.uhp < u.uhpmax)
|
|
|
|
u.uhp++, flags.botl = 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case POT_SICKNESS:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (u.uhp <= 5)
|
|
|
|
u.uhp = 1;
|
|
|
|
else
|
|
|
|
u.uhp -= 5;
|
1993-03-21 12:45:37 +03:00
|
|
|
flags.botl = 1;
|
|
|
|
break;
|
|
|
|
case POT_CONFUSION:
|
|
|
|
case POT_BOOZE:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!Confusion)
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("You feel somewhat dizzy.");
|
|
|
|
Confusion += rnd(5);
|
|
|
|
break;
|
|
|
|
case POT_INVISIBILITY:
|
|
|
|
pline("For an instant you couldn't see your right hand.");
|
|
|
|
break;
|
|
|
|
case POT_PARALYSIS:
|
|
|
|
pline("Something seems to be holding you.");
|
|
|
|
nomul(-rnd(5));
|
|
|
|
break;
|
|
|
|
case POT_SPEED:
|
|
|
|
Fast += rnd(5);
|
|
|
|
pline("Your knees seem more flexible now.");
|
|
|
|
break;
|
|
|
|
case POT_BLINDNESS:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!Blind)
|
|
|
|
pline("It suddenly gets dark.");
|
1993-03-21 12:45:37 +03:00
|
|
|
Blind += rnd(5);
|
|
|
|
seeoff(0);
|
|
|
|
break;
|
1997-10-19 20:56:41 +04:00
|
|
|
/*
|
|
|
|
* case POT_GAIN_LEVEL: case POT_LEVITATION: case
|
|
|
|
* POT_FRUIT_JUICE: case POT_MONSTER_DETECTION: case
|
|
|
|
* POT_OBJECT_DETECTION: break;
|
|
|
|
*/
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
/* note: no obfree() */
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* -- rudimentary -- to do this correctly requires much more work
|
|
|
|
* -- all sharp weapons get one or more qualities derived from the potions
|
|
|
|
* -- texts on scrolls may be (partially) wiped out; do they become blank?
|
|
|
|
* -- or does their effect change, like under Confusion?
|
|
|
|
* -- all objects may be made invisible by POT_INVISIBILITY
|
|
|
|
* -- If the flask is small, can one dip a large object? Does it magically
|
|
|
|
* -- become a jug? Etc.
|
|
|
|
*/
|
1997-10-19 20:56:41 +04:00
|
|
|
int
|
|
|
|
dodip()
|
|
|
|
{
|
|
|
|
struct obj *potion, *obj;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!(obj = getobj("#", "dip")))
|
|
|
|
return (0);
|
|
|
|
if (!(potion = getobj("!", "dip into")))
|
|
|
|
return (0);
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("Interesting...");
|
1997-10-19 20:56:41 +04:00
|
|
|
if (obj->otyp == ARROW || obj->otyp == DART ||
|
|
|
|
obj->otyp == CROSSBOW_BOLT) {
|
|
|
|
if (potion->otyp == POT_SICKNESS) {
|
1993-03-21 12:45:37 +03:00
|
|
|
useup(potion);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (obj->spe < 7)
|
|
|
|
obj->spe++; /* %% */
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
return (1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
|
|
|
ghost_from_bottle()
|
|
|
|
{
|
|
|
|
struct monst *mtmp;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!(mtmp = makemon(PM_GHOST, u.ux, u.uy))) {
|
1993-03-21 12:45:37 +03:00
|
|
|
pline("This bottle turns out to be empty.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mnexto(mtmp);
|
|
|
|
pline("As you open the bottle, an enormous ghost emerges!");
|
|
|
|
pline("You are frightened to death, and unable to move.");
|
|
|
|
nomul(-3);
|
|
|
|
}
|