MCPcopy Index your code
hub / github.com/NetHack/NetHack / potionbreathe

Function potionbreathe

src/potion.c:1931–2118  ·  view source on GitHub ↗

vapors are inhaled or get in your eyes */

Source from the content-addressed store, hash-verified

1929
1930/* vapors are inhaled or get in your eyes */
1931void
1932potionbreathe(struct obj *obj)
1933{
1934 int i, ii, isdone, kn = 0;
1935 boolean cureblind = FALSE;
1936 unsigned already_in_use = obj->in_use;
1937
1938 /* potion of unholy water might be wielded; prevent
1939 you_were() -> drop_weapon() from dropping it so that it
1940 remains in inventory where our caller expects it to be */
1941 obj->in_use = 1;
1942
1943 /* wearing a wet towel protects both eyes and breathing, even when
1944 the breath effect might be beneficial; we still pass down to the
1945 naming opportunity in case potion was thrown at hero by a monster */
1946 switch (Half_gas_damage ? TOWEL : obj->otyp) {
1947 case TOWEL:
1948 pline("Some vapor passes harmlessly around you.");
1949 break;
1950 case POT_RESTORE_ABILITY:
1951 case POT_GAIN_ABILITY:
1952 if (obj->cursed) {
1953 if (!breathless(gy.youmonst.data)) {
1954 pline("Ulch! That potion smells terrible!");
1955 } else if (haseyes(gy.youmonst.data)) {
1956 const char *eyes = body_part(EYE);
1957
1958 if (eyecount(gy.youmonst.data) != 1)
1959 eyes = makeplural(eyes);
1960 Your("%s %s!", eyes, vtense(eyes, "sting"));
1961 }
1962 break;
1963 } else {
1964 i = rn2(A_MAX); /* start at a random point */
1965 for (isdone = ii = 0; !isdone && ii < A_MAX; ii++) {
1966 if (ABASE(i) < AMAX(i)) {
1967 ABASE(i)++;
1968 /* only first found if not blessed */
1969 isdone = !(obj->blessed);
1970 disp.botl = TRUE;
1971 }
1972 if (++i >= A_MAX)
1973 i = 0;
1974 }
1975 }
1976 break;
1977 case POT_FULL_HEALING:
1978 if (Upolyd && u.mh < u.mhmax)
1979 u.mh++, disp.botl = TRUE;
1980 if (u.uhp < u.uhpmax)
1981 u.uhp++, disp.botl = TRUE;
1982 cureblind = TRUE;
1983 FALLTHROUGH;
1984 /*FALLTHRU*/
1985 case POT_EXTRA_HEALING:
1986 if (Upolyd && u.mh < u.mhmax)
1987 u.mh++, disp.botl = TRUE;
1988 if (u.uhp < u.uhpmax)

Callers 6

potionhitFunction · 0.85
dip_potion_explosionFunction · 0.85
breakobjFunction · 0.85
chest_shatter_msgFunction · 0.85
maybe_destroy_itemFunction · 0.85
dipsinkFunction · 0.85

Calls 15

body_partFunction · 0.85
makepluralFunction · 0.85
YourFunction · 0.85
vtenseFunction · 0.85
rn2Function · 0.85
make_blindedFunction · 0.85
make_deafFunction · 0.85
exerciseFunction · 0.85
YouFunction · 0.85
You_feelFunction · 0.85
make_confusedFunction · 0.85
itimeout_incrFunction · 0.85

Tested by

no test coverage detected