Defines | Functions | Variables

potion.c File Reference

#include "hack.h"
Include dependency graph for potion.c:

Defines

#define POTION_OCCUPANT_CHANCE(n)   (13 + 2*(n))
#define ALCHEMY_WHITE   0
#define ALCHEMY_BLACK   8
#define ALCHEMY_GRAY   (alchemy_table2[16])
#define IS_PRIMARY_COLOR(x)   (((x)&7)==1 || ((x)&7)==2 || ((x)&7)==4)
#define IS_SECONDARY_COLOR(x)   (((x)&7)==3 || ((x)&7)==5 || ((x)&7)==6)
#define IS_LIGHT_COLOR(x)   (((x)&8)==0)
#define IS_DARK_COLOR(x)   ((x)&8)

Functions

STATIC_DCL long FDECL (itimeout,(long))
STATIC_DCL long FDECL (itimeout_incr,(long, int))
STATIC_DCL void NDECL (ghost_from_bottle)
STATIC_OVL void NDECL (alchemy_init)
STATIC_DCL short FDECL (mixtype,(struct obj *, struct obj *))
STATIC_DCL int FDECL (dip,(struct obj *, struct obj *))
STATIC_OVL long itimeout (long val)
STATIC_OVL long itimeout_incr (long old, int incr)
void set_itimeout (long *which, long val)
void incr_itimeout (long *which, int incr)
void make_confused (long xtime, boolean talk)
void make_stunned (long xtime, boolean talk)
void make_sick (long xtime, const char *cause, boolean talk, int type)
void make_vomiting (long xtime, boolean talk)
void make_blinded (long xtime, boolean talk)
boolean make_hallucinated (long xtime, boolean talk, long mask)
STATIC_OVL void ghost_from_bottle ()
int dodrink ()
int dopotion (struct obj *otmp)
int peffects (struct obj *otmp)
void healup (int nhp, int nxtra, boolean curesick, boolean cureblind)
void strange_feeling (struct obj *obj, const char *txt)
const char * bottlename ()
void potionhit (struct monst *mon, struct obj *obj, boolean your_fault)
void potionbreathe (struct obj *obj)
STATIC_OVL void alchemy_init ()
STATIC_OVL short mixtype (struct obj *o1, struct obj *o2)
boolean get_wet (struct obj *obj)
int dodip ()
int dip (struct obj *potion, struct obj *obj)
void djinni_from_bottle (struct obj *obj)
struct monstsplit_mon (struct monst *mon, struct monst *mtmp)

Variables

boolean notonhead = FALSE
static NEARDATA int nothing
static NEARDATA int unkn
static NEARDATA const char beverages [] = { POTION_CLASS, 0 }
static const char vismsg [] = "vision seems to %s for a moment but is %s now."
static const char eyemsg [] = "%s momentarily %s."
const char * bottlenames []
char alchemy_table1 [POT_VAMPIRE_BLOOD-POT_GAIN_ABILITY]
short alchemy_table2 [17]

Define Documentation

#define ALCHEMY_BLACK   8

Referenced by mixtype().

#define ALCHEMY_GRAY   (alchemy_table2[16])

Referenced by mixtype().

#define ALCHEMY_WHITE   0

Referenced by mixtype().

#define IS_DARK_COLOR (   x )    ((x)&8)

Referenced by mixtype().

#define IS_LIGHT_COLOR (   x )    (((x)&8)==0)

Referenced by mixtype().

#define IS_PRIMARY_COLOR (   x )    (((x)&7)==1 || ((x)&7)==2 || ((x)&7)==4)

Referenced by mixtype().

#define IS_SECONDARY_COLOR (   x )    (((x)&7)==3 || ((x)&7)==5 || ((x)&7)==6)

Referenced by mixtype().

#define POTION_OCCUPANT_CHANCE (   n )    (13 + 2*(n))

Function Documentation

STATIC_OVL void alchemy_init (  )

Does a one-time set up of alchemical tables.

References FALSE, OBJ_DESCR, objects, POT_GAIN_ABILITY, POT_WATER, and TRUE.

Referenced by mixtype().

Here is the caller graph for this function:

const char* bottlename (  )

References rn2(), and SIZE.

Referenced by chest_shatter_msg(), and potionhit().

Here is the call graph for this function:

Here is the caller graph for this function:

int dip ( struct obj potion,
struct obj obj 
)

Dip an arbitrary object into a potion.

References A_STR, A_WIS, Acid_resistance, AMETHYST, AMULET_OF_UNCHANGING, aobjnam(), bill_dummy_object(), bless(), Blind, body_part(), breathless, BUFSZ, catch_lit(), check_unpaid(), CORPSE, costly_spot(), curse(), cxname(), d(), monst::data, docall(), doname(), exercise(), EXPL_FIERY, explode(), FALSE, FINGER, FOOD_CLASS, get_wet(), Glib, Hallucination, haseyes, hcolor(), hold_another_object(), incr_itimeout(), index, is_ammo, is_corrodeable, is_flammable(), is_poisonable, is_rustprone, is_weptool, KILLED_BY_AN, losehp(), MAGIC_LAMP, makeknown, makeplural(), MAX_ERODE, mixtype(), mkobj(), more_than_one, NH_AMBER, NH_BLACK, NH_LIGHT_BLUE, NH_ORANGE, NH_RED, nothing_happens, obfree(), OBJ_DESCR, obj_extract_self(), OBJ_NAME, obj_resists(), objects, objclass::oc_uname, OIL_LAMP, otense(), otmp, obj::otyp, PAPER, PLASTIC, pline(), PM_LICHEN, poly_obj(), u_conduct::polypiles, POT_ACID, POT_EXTRA_HEALING, POT_FULL_HEALING, POT_HEALING, POT_INVISIBILITY, POT_OIL, POT_POLYMORPH, POT_SEE_INVISIBLE, POT_SICKNESS, POT_WATER, POTION_CLASS, potionbreathe(), prinv(), rn2(), rnd(), See_invisible, setuqwep(), setuswapwep(), setuwep(), Shk_Your(), SPE_POLYMORPH, splitobj(), Sprintf, STRANGE_OBJECT, Strcpy, The(), the(), TRUE, u, uball, you::uconduct, unbless(), uncurse(), UNICORN_HORN, update_inventory, uquiver, useup(), uskin, uswapwep, uwep, you::ux, you::uy, vowels, WAN_POLYMORPH, WEAPON_CLASS, xname(), yname(), Yname2(), youmonst, and zeroobj.

Referenced by dodip().

Here is the call graph for this function:

Here is the caller graph for this function:

void djinni_from_bottle ( struct obj obj )

References a_monnam(), Blind, FALSE, makemon(), makewish(), mongone(), Monnam(), mons, NO_MM_FLAGS, pline(), PM_DJINNI, rn2(), rnd(), set_malign(), Something, tamedog(), TRUE, u, you::ux, and you::uy.

Referenced by dodrink(), and dorub().

Here is the call graph for this function:

Here is the caller graph for this function:

int dodip (  )
int dodrink (  )
int dopotion ( struct obj otmp )

References docall(), Hallucination, makeknown, more_experienced(), nothing, objects, objclass::oc_uname, peffects(), TRUE, unkn, and useup().

Referenced by dodrink(), and eatspecial().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_DCL long FDECL ( itimeout  ,
(long)   
)
STATIC_DCL long FDECL ( itimeout_incr  ,
(long, int)   
)
STATIC_DCL short FDECL ( mixtype  ,
(struct obj *, struct obj *)   
)
STATIC_DCL int FDECL ( dip  ,
(struct obj *, struct obj *)   
)
boolean get_wet ( struct obj obj )
STATIC_OVL void ghost_from_bottle (  )

References Blind, flags, Hallucination, makemon(), mons, NO_MM_FLAGS, nomovemsg, nomul(), pline(), PM_GHOST, rndmonnam(), something, u, you::ux, you::uy, and flag::verbose.

Referenced by dodrink().

Here is the call graph for this function:

Here is the caller graph for this function:

void healup ( int  nhp,
int  nxtra,
boolean  curesick,
boolean  cureblind 
)

References flag::botl, flags, make_blinded(), make_sick(), you::mh, you::mhmax, SICK_ALL, TRUE, u, you::uhp, you::uhpmax, and Upolyd.

Referenced by artifact_hit(), peffects(), spelleffects(), and zapyourself().

Here is the call graph for this function:

Here is the caller graph for this function:

void incr_itimeout ( long *  which,
int  incr 
)

References itimeout_incr(), and set_itimeout().

Referenced by Boots_on(), dip(), eataccessory(), eatcorpse(), Gloves_on(), opentin(), peffects(), potionbreathe(), priest_talk(), use_grease(), and zapyourself().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL long itimeout ( long  val )

References TIMEOUT.

Referenced by itimeout_incr(), and set_itimeout().

Here is the caller graph for this function:

STATIC_OVL long itimeout_incr ( long  old,
int  incr 
)

References itimeout(), and TIMEOUT.

Referenced by incr_itimeout(), peffects(), and potionbreathe().

Here is the call graph for this function:

Here is the caller graph for this function:

void make_blinded ( long  xtime,
boolean  talk 
)
void make_confused ( long  xtime,
boolean  talk 
)
boolean make_hallucinated ( long  xtime,
boolean  talk,
long  mask 
)
void make_sick ( long  xtime,
const char *  cause,
boolean  talk,
int  type 
)

References A_CON, flag::botl, exercise(), FALSE, flags, pline(), set_itimeout(), Sick, Sick_resistance, TRUE, u, and you::usick_cause.

Referenced by arti_invoke(), diseasemu(), dosit(), eatcorpse(), fix_attributes_and_properties(), fix_worst_trouble(), fpostfx(), healup(), hitmu(), newman(), peffects(), polymon(), and vomit().

Here is the call graph for this function:

Here is the caller graph for this function:

void make_stunned ( long  xtime,
boolean  talk 
)
void make_vomiting ( long  xtime,
boolean  talk 
)

References set_itimeout(), and Vomiting.

Referenced by fix_attributes_and_properties(), fpostfx(), fprefx(), nh_timeout(), opentin(), and peffects().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL short mixtype ( struct obj o1,
struct obj o2 
)

Returns the potion type when object o1 is dipped into object o2

References ALCHEMY_BLACK, ALCHEMY_GRAY, alchemy_init(), ALCHEMY_WHITE, AMETHYST, IS_DARK_COLOR, IS_LIGHT_COLOR, IS_PRIMARY_COLOR, IS_SECONDARY_COLOR, OBJ_NAME, objects, POT_BLINDNESS, POT_BLOOD, POT_BOOZE, POT_CONFUSION, POT_FRUIT_JUICE, POT_GAIN_ABILITY, POT_HALLUCINATION, POT_SICKNESS, POT_VAMPIRE_BLOOD, POT_WATER, POTION_CLASS, rn2(), and UNICORN_HORN.

Referenced by dip().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void NDECL ( alchemy_init   )
STATIC_DCL void NDECL ( ghost_from_bottle   )
int peffects ( struct obj otmp )

References A_CHAOTIC, A_CON, A_DEX, A_INT, A_LAWFUL, A_MAX, A_NEUTRAL, A_STR, A_WIS, ABASE, Acid_resistance, adjalign(), adjattrib(), aggravate(), AMAX, bcsign(), BInvis, Blind, Blinded, body_part(), flag::botl, Can_rise_up(), ceiling(), COLNO, Confusion, d(), monst::data, depth(), Detect_monsters, display_nhwindow, doup(), earth_level, enlightenment(), exercise(), FACE, fall_asleep(), FALSE, Fast, Fire_resistance, fix_petrification(), Fixed_abil, flags, float_up(), FOOT, Free_action, FROMOUTSIDE, fruitname(), get_level(), GLYPH_INVISIBLE, goto_level(), Halluc_resistance, Hallucination, HConfusion, HDetect_monsters, HEAD, heal_legs(), healup(), HFast, HHallucination, HInvis, HLevitation, HSee_invisible, I_SPECIAL, incr_itimeout(), Invis, Invisible, Is_airlevel, is_demon, is_undead, is_vampire, Is_waterlevel, itimeout_incr(), KILLED_BY, KILLED_BY_AN, ledger_no(), LEG, lesshungry(), Levitation, levl, likes_fire, losehp(), LOW_PM, make_blinded(), make_confused(), make_hallucinated(), make_sick(), make_vomiting(), makeplural(), maybe_polyd, you::mh, you::mhmax, permonst::mname, MON_AT, mons, monster_detect(), you::mtimedone, multi, MUMMY_WRAPPING, newhp(), newsym(), newuhs(), nomovemsg, nomul(), NON_PM, nothing, object_detect(), on_level(), obj::otyp, pline(), pluslvl(), PM_HEALER, PM_MONK, PM_VAMPIRE, PM_VAMPIRE_BAT, PM_VAMPIRE_LORD, Poison_resistance, poisontell(), polymon(), polyself(), POT_ACID, POT_BLINDNESS, POT_BLOOD, POT_BOOZE, POT_CONFUSION, POT_ENLIGHTENMENT, POT_EXTRA_HEALING, POT_FRUIT_JUICE, POT_FULL_HEALING, POT_GAIN_ABILITY, POT_GAIN_ENERGY, POT_GAIN_LEVEL, POT_HALLUCINATION, POT_HEALING, POT_INVISIBILITY, POT_LEVITATION, POT_MONSTER_DETECTION, POT_OBJECT_DETECTION, POT_OIL, POT_PARALYSIS, POT_POLYMORPH, POT_RESTORE_ABILITY, POT_SEE_INVISIBLE, POT_SICKNESS, POT_SLEEPING, POT_SPEED, POT_VAMPIRE_BLOOD, POT_WATER, Race_if, rn1, rn2(), rnd(), rndexp(), Role_if, ROWNO, see_monsters(), self_invis_message(), set_mimic_blocking(), SICK_ALL, Sleep_resistance, SPE_DETECT_MONSTERS, SPE_DETECT_TREASURE, SPE_HASTE_SELF, SPE_INVISIBILITY, SPE_LEVITATION, SPE_RESTORE_ABILITY, spoteffects(), sstairs, STEED, Stoned, surface(), stairway::sx, stairway::sy, TRUE, align::type, u, you::ualign, uarmc, uarmh, you::uconduct, you::uen, you::uenmax, you::uexp, you::ugangr, you::uhave, you::uhp, you::uhpmax, you::uhs, you::uhunger, you::ulevel, you::ulevelmax, you::ulycn, Unchanging, unfixable_trouble_count(), unkn, unmap_object(), u_conduct::unvegan, u_conduct::unvegetarian, stairway::up, Upolyd, you::ux, you::uy, you::uz, Very_fast, violated_vegetarian(), Vomiting, WIN_MESSAGE, Wounded_legs, xname(), xupladder, xupstair, You_can_move_again, you_unwere(), you_were(), youmonst, yupladder, and yupstair.

Referenced by dopotion(), and spelleffects().

Here is the call graph for this function:

Here is the caller graph for this function:

void potionbreathe ( struct obj obj )
void potionhit ( struct monst mon,
struct obj obj,
boolean  your_fault 
)
void set_itimeout ( long *  which,
long  val 
)

References itimeout(), and TIMEOUT.

Referenced by cpostfx(), incr_itimeout(), make_blinded(), make_confused(), make_hallucinated(), make_sick(), make_stunned(), and make_vomiting().

Here is the call graph for this function:

Here is the caller graph for this function:

struct monst* split_mon ( struct monst mon,
struct monst mtmp 
) [read]

References flag::botl, BUFSZ, canspotmon, clone_mon(), cloneu(), flags, you::mhmax, monst::mhpmax, mon_nam(), Monnam(), pline(), s_suffix(), Sprintf, u, and youmonst.

Referenced by domonability(), dotrap(), drown(), minliquid(), mintrap(), passive(), passivemm(), passiveum(), potionbreathe(), and potionhit().

Here is the call graph for this function:

Here is the caller graph for this function:

void strange_feeling ( struct obj obj,
const char *  txt 
)

References flag::beginner, docall(), flags, Hallucination, objects, objclass::oc_uname, pline(), and useup().

Referenced by chwepon(), food_detect(), gold_detect(), make_blinded(), make_hallucinated(), monster_detect(), object_detect(), seffects(), and trap_detect().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char alchemy_table1[POT_VAMPIRE_BLOOD-POT_GAIN_ABILITY]
short alchemy_table2[17]
NEARDATA const char beverages[] = { POTION_CLASS, 0 } [static]

Referenced by dodip(), and dodrink().

const char* bottlenames[]
Initial value:
 {
        "bottle", "phial", "flagon", "carafe", "flask", "jar", "vial"
}
const char eyemsg[] = "%s momentarily %s." [static]
NEARDATA int nothing [static]

Referenced by dopotion(), makewish(), and peffects().

boolean notonhead = FALSE
NEARDATA int unkn

Referenced by dopotion(), and peffects().

const char vismsg[] = "vision seems to %s for a moment but is %s now." [static]