2 * @(#)potions.c 3.1 3.1 5/7/81
3 * Function(s) for dealing with potions
5 * Rogue: Exploring the Dungeons of Doom
6 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
9 * See the file LICENSE.TXT for full copyright and licensing information.
19 register struct object
*obj
;
20 register struct linked_list
*item
, *titem
;
21 register struct thing
*th
;
24 item
= get_item("quaff", POTION
);
26 * Make certain that it is somethings that we want to drink
30 obj
= (struct object
*) ldata(item
);
31 if (obj
->o_type
!= POTION
)
34 msg("Yuk! Why would you want to drink that?");
36 msg("That's undrinkable");
39 if (obj
== cur_weapon
)
43 * Calculate the effect it has on the poor guy.
48 if (off(player
, ISHUH
))
49 msg("Wait, what's going on here. Huh? What? Who?");
51 if (on(player
, ISHUH
))
52 lengthen(unconfuse
, rnd(8)+HUHDURATION
);
54 fuse(unconfuse
, 0, rnd(8)+HUHDURATION
, AFTER
);
56 player
.t_flags
|= ISHUH
;
57 p_know
[P_CONFUSE
] = TRUE
;
59 if (!ISWEARING(R_SUSTSTR
))
62 msg("You feel very sick now.");
65 msg("You feel momentarily sick");
66 p_know
[P_POISON
] = TRUE
;
68 if ((pstats
.s_hpt
+= roll(pstats
.s_lvl
, 4)) > max_hp
)
69 pstats
.s_hpt
= ++max_hp
;
70 msg("You begin to feel better.");
72 p_know
[P_HEALING
] = TRUE
;
74 msg("You feel stronger, now. What bulging muscles!");
76 p_know
[P_STRENGTH
] = TRUE
;
79 * Potion of monster detection, if there are monters, detect them
86 "You begin to sense the presence of monsters.--More--");
87 p_know
[P_MFIND
] = TRUE
;
90 msg("You have a strange feeling for a moment, then it passes.");
93 * Potion of magic detection. Show the potions and scrolls
97 struct linked_list
*mobj
;
103 for (mobj
= lvl_obj
; mobj
!= NULL
; mobj
= next(mobj
))
105 tp
= (struct object
*) ldata(mobj
);
109 mvwaddch(hw
, tp
->o_pos
.y
, tp
->o_pos
.x
, MAGIC
);
111 p_know
[P_TFIND
] = TRUE
;
113 for (titem
= mlist
; titem
!= NULL
; titem
= next(titem
))
115 register struct linked_list
*pitem
;
117 th
= (struct thing
*) ldata(titem
);
118 for (pitem
= th
->t_pack
; pitem
!= NULL
; pitem
= next(pitem
))
120 if (is_magic(ldata(pitem
)))
123 mvwaddch(hw
, th
->t_pos
.y
, th
->t_pos
.x
, MAGIC
);
125 p_know
[P_TFIND
] = TRUE
;
131 "You sense the presence of magic on this level.--More--");
135 msg("You have a strange feeling for a moment, then it passes.");
137 msg("You can't move.");
138 no_command
= HOLDTIME
;
139 p_know
[P_PARALYZE
] = TRUE
;
141 msg("This potion tastes like %s juice.", fruit
);
142 if (off(player
, CANSEE
))
144 player
.t_flags
|= CANSEE
;
145 fuse(unsee
, 0, SEEDURATION
, AFTER
);
150 msg("You suddenly feel much more skillful");
151 p_know
[P_RAISE
] = TRUE
;
154 if ((pstats
.s_hpt
+= roll(pstats
.s_lvl
, 8)) > max_hp
)
155 pstats
.s_hpt
= ++max_hp
;
156 msg("You begin to feel much better.");
157 p_know
[P_XHEAL
] = TRUE
;
161 msg("You feel yourself moving much faster.");
162 p_know
[P_HASTE
] = TRUE
;
164 msg("Hey, this tastes great. It make you feel warm all over.");
165 if (pstats
.s_str
.st_str
< max_stats
.s_str
.st_str
||
166 (pstats
.s_str
.st_str
== 18 &&
167 pstats
.s_str
.st_add
< max_stats
.s_str
.st_add
))
168 pstats
.s_str
= max_stats
.s_str
;
170 msg("A cloak of darkness falls around you.");
171 if (off(player
, ISBLIND
))
173 player
.t_flags
|= ISBLIND
;
174 fuse(sight
, 0, SEEDURATION
, AFTER
);
177 p_know
[P_BLIND
] = TRUE
;
179 msg("This potion tastes extremely dull.");
181 msg("What an odd tasting potion!");
185 if (p_know
[obj
->o_which
] && p_guess
[obj
->o_which
])
187 free(p_guess
[obj
->o_which
]);
188 p_guess
[obj
->o_which
] = NULL
;
190 else if (!p_know
[obj
->o_which
] && askme
&& p_guess
[obj
->o_which
] == NULL
)
192 msg(terse
? "Call it: " : "What do you want to call it? ");
193 if (get_str(buf
, cw
) == NORM
)
195 p_guess
[obj
->o_which
] = malloc((unsigned int) strlen(buf
) + 1);
196 if (p_guess
[obj
->o_which
] != NULL
)
197 strcpy(p_guess
[obj
->o_which
], buf
);
201 * Throw the item away
204 if (obj
->o_count
> 1)