Split potion effects into separate functions
This commit is contained in:
+260
-81
@@ -9,6 +9,31 @@ static long itimeout(long);
|
|||||||
static long itimeout_incr(long, int);
|
static long itimeout_incr(long, int);
|
||||||
static void ghost_from_bottle(void);
|
static void ghost_from_bottle(void);
|
||||||
static int drink_ok(struct obj *);
|
static int drink_ok(struct obj *);
|
||||||
|
static void peffect_restore_ability(struct obj *);
|
||||||
|
static void peffect_hallucination(struct obj *);
|
||||||
|
static void peffect_water(struct obj *);
|
||||||
|
static void peffect_booze(struct obj *);
|
||||||
|
static void peffect_enlightenment(struct obj *);
|
||||||
|
static void peffect_invisibility(struct obj *);
|
||||||
|
static void peffect_see_invisible(struct obj *);
|
||||||
|
static void peffect_paralysis(struct obj *);
|
||||||
|
static void peffect_sleeping(struct obj *);
|
||||||
|
static int peffect_monster_detection(struct obj *);
|
||||||
|
static int peffect_object_detection(struct obj *);
|
||||||
|
static void peffect_sickness(struct obj *);
|
||||||
|
static void peffect_confusion(struct obj *);
|
||||||
|
static void peffect_gain_ability(struct obj *);
|
||||||
|
static void peffect_speed(struct obj *);
|
||||||
|
static void peffect_blindness(struct obj *);
|
||||||
|
static void peffect_gain_level(struct obj *);
|
||||||
|
static void peffect_healing(struct obj *);
|
||||||
|
static void peffect_extra_healing(struct obj *);
|
||||||
|
static void peffect_full_healing(struct obj *);
|
||||||
|
static void peffect_levitation(struct obj *);
|
||||||
|
static void peffect_gain_energy(struct obj *);
|
||||||
|
static void peffect_oil(struct obj *);
|
||||||
|
static void peffect_acid(struct obj *);
|
||||||
|
static void peffect_polymorph(struct obj *);
|
||||||
static boolean H2Opotion_dip(struct obj *, struct obj *, boolean,
|
static boolean H2Opotion_dip(struct obj *, struct obj *, boolean,
|
||||||
const char *);
|
const char *);
|
||||||
static short mixtype(struct obj *, struct obj *);
|
static short mixtype(struct obj *, struct obj *);
|
||||||
@@ -569,19 +594,16 @@ dopotion(struct obj *otmp)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static void
|
||||||
peffects(struct obj *otmp)
|
peffect_restore_ability(struct obj *otmp)
|
||||||
{
|
{
|
||||||
register int i, ii, lim;
|
|
||||||
|
|
||||||
switch (otmp->otyp) {
|
|
||||||
case POT_RESTORE_ABILITY:
|
|
||||||
case SPE_RESTORE_ABILITY:
|
|
||||||
g.potion_unkn++;
|
g.potion_unkn++;
|
||||||
if (otmp->cursed) {
|
if (otmp->cursed) {
|
||||||
pline("Ulch! This makes you feel mediocre!");
|
pline("Ulch! This makes you feel mediocre!");
|
||||||
break;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
int i, ii;
|
||||||
|
|
||||||
/* unlike unicorn horn, overrides Fixed_abil */
|
/* unlike unicorn horn, overrides Fixed_abil */
|
||||||
pline("Wow! This makes you feel %s!",
|
pline("Wow! This makes you feel %s!",
|
||||||
(otmp->blessed)
|
(otmp->blessed)
|
||||||
@@ -589,7 +611,8 @@ peffects(struct obj *otmp)
|
|||||||
: "good");
|
: "good");
|
||||||
i = rn2(A_MAX); /* start at a random point */
|
i = rn2(A_MAX); /* start at a random point */
|
||||||
for (ii = 0; ii < A_MAX; ii++) {
|
for (ii = 0; ii < A_MAX; ii++) {
|
||||||
lim = AMAX(i);
|
int lim = AMAX(i);
|
||||||
|
|
||||||
/* this used to adjust 'lim' for A_STR when u.uhs was
|
/* this used to adjust 'lim' for A_STR when u.uhs was
|
||||||
WEAK or worse, but that's handled via ATEMP(A_STR) now */
|
WEAK or worse, but that's handled via ATEMP(A_STR) now */
|
||||||
if (ABASE(i) < lim) {
|
if (ABASE(i) < lim) {
|
||||||
@@ -614,11 +637,14 @@ peffects(struct obj *otmp)
|
|||||||
} while (u.ulevel < u.ulevelmax && otmp->blessed);
|
} while (u.ulevel < u.ulevelmax && otmp->blessed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case POT_HALLUCINATION:
|
|
||||||
|
static void
|
||||||
|
peffect_hallucination(struct obj *otmp)
|
||||||
|
{
|
||||||
if (Halluc_resistance) {
|
if (Halluc_resistance) {
|
||||||
g.potion_nothing++;
|
g.potion_nothing++;
|
||||||
break;
|
return;
|
||||||
} else if (Hallucination) {
|
} else if (Hallucination) {
|
||||||
g.potion_nothing++;
|
g.potion_nothing++;
|
||||||
}
|
}
|
||||||
@@ -632,13 +658,16 @@ peffects(struct obj *otmp)
|
|||||||
Your("awareness re-normalizes.");
|
Your("awareness re-normalizes.");
|
||||||
exercise(A_WIS, TRUE);
|
exercise(A_WIS, TRUE);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case POT_WATER:
|
|
||||||
|
static void
|
||||||
|
peffect_water(struct obj *otmp)
|
||||||
|
{
|
||||||
if (!otmp->blessed && !otmp->cursed) {
|
if (!otmp->blessed && !otmp->cursed) {
|
||||||
pline("This tastes like %s.", hliquid("water"));
|
pline("This tastes like %s.", hliquid("water"));
|
||||||
u.uhunger += rnd(10);
|
u.uhunger += rnd(10);
|
||||||
newuhs(FALSE);
|
newuhs(FALSE);
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
g.potion_unkn++;
|
g.potion_unkn++;
|
||||||
if (is_undead(g.youmonst.data) || is_demon(g.youmonst.data)
|
if (is_undead(g.youmonst.data) || is_demon(g.youmonst.data)
|
||||||
@@ -683,8 +712,11 @@ peffects(struct obj *otmp)
|
|||||||
exercise(A_CON, FALSE);
|
exercise(A_CON, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case POT_BOOZE:
|
|
||||||
|
static void
|
||||||
|
peffect_booze(struct obj *otmp)
|
||||||
|
{
|
||||||
g.potion_unkn++;
|
g.potion_unkn++;
|
||||||
pline("Ooph! This tastes like %s%s!",
|
pline("Ooph! This tastes like %s%s!",
|
||||||
otmp->odiluted ? "watered down " : "",
|
otmp->odiluted ? "watered down " : "",
|
||||||
@@ -702,8 +734,11 @@ peffects(struct obj *otmp)
|
|||||||
g.multi = -rnd(15);
|
g.multi = -rnd(15);
|
||||||
g.nomovemsg = "You awake with a headache.";
|
g.nomovemsg = "You awake with a headache.";
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case POT_ENLIGHTENMENT:
|
|
||||||
|
static void
|
||||||
|
peffect_enlightenment(struct obj *otmp)
|
||||||
|
{
|
||||||
if (otmp->cursed) {
|
if (otmp->cursed) {
|
||||||
g.potion_unkn++;
|
g.potion_unkn++;
|
||||||
You("have an uneasy feeling...");
|
You("have an uneasy feeling...");
|
||||||
@@ -715,15 +750,18 @@ peffects(struct obj *otmp)
|
|||||||
}
|
}
|
||||||
do_enlightenment_effect();
|
do_enlightenment_effect();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case SPE_INVISIBILITY:
|
|
||||||
|
static void
|
||||||
|
peffect_invisibility(struct obj *otmp)
|
||||||
|
{
|
||||||
|
boolean is_spell = (otmp->oclass == SPBOOK_CLASS);
|
||||||
|
|
||||||
/* spell cannot penetrate mummy wrapping */
|
/* spell cannot penetrate mummy wrapping */
|
||||||
if (BInvis && uarmc->otyp == MUMMY_WRAPPING) {
|
if (is_spell && BInvis && uarmc->otyp == MUMMY_WRAPPING) {
|
||||||
You_feel("rather itchy under %s.", yname(uarmc));
|
You_feel("rather itchy under %s.", yname(uarmc));
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
/* FALLTHRU */
|
|
||||||
case POT_INVISIBILITY:
|
|
||||||
if (Invis || Blind || BInvis) {
|
if (Invis || Blind || BInvis) {
|
||||||
g.potion_nothing++;
|
g.potion_nothing++;
|
||||||
} else {
|
} else {
|
||||||
@@ -738,9 +776,11 @@ peffects(struct obj *otmp)
|
|||||||
pline("For some reason, you feel your presence is known.");
|
pline("For some reason, you feel your presence is known.");
|
||||||
aggravate();
|
aggravate();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case POT_SEE_INVISIBLE: /* tastes like fruit juice in Rogue */
|
|
||||||
case POT_FRUIT_JUICE: {
|
static void
|
||||||
|
peffect_see_invisible(struct obj *otmp)
|
||||||
|
{
|
||||||
int msg = Invisible && !Blind;
|
int msg = Invisible && !Blind;
|
||||||
|
|
||||||
g.potion_unkn++;
|
g.potion_unkn++;
|
||||||
@@ -756,7 +796,7 @@ peffects(struct obj *otmp)
|
|||||||
if (otmp->otyp == POT_FRUIT_JUICE) {
|
if (otmp->otyp == POT_FRUIT_JUICE) {
|
||||||
u.uhunger += (otmp->odiluted ? 5 : 10) * (2 + bcsign(otmp));
|
u.uhunger += (otmp->odiluted ? 5 : 10) * (2 + bcsign(otmp));
|
||||||
newuhs(FALSE);
|
newuhs(FALSE);
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
if (!otmp->cursed) {
|
if (!otmp->cursed) {
|
||||||
/* Tell them they can see again immediately, which
|
/* Tell them they can see again immediately, which
|
||||||
@@ -775,9 +815,11 @@ peffects(struct obj *otmp)
|
|||||||
You("can see through yourself, but you are visible!");
|
You("can see through yourself, but you are visible!");
|
||||||
g.potion_unkn--;
|
g.potion_unkn--;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
case POT_PARALYSIS:
|
static void
|
||||||
|
peffect_paralysis(struct obj *otmp)
|
||||||
|
{
|
||||||
if (Free_action) {
|
if (Free_action) {
|
||||||
You("stiffen momentarily.");
|
You("stiffen momentarily.");
|
||||||
} else {
|
} else {
|
||||||
@@ -793,8 +835,11 @@ peffects(struct obj *otmp)
|
|||||||
g.nomovemsg = You_can_move_again;
|
g.nomovemsg = You_can_move_again;
|
||||||
exercise(A_DEX, FALSE);
|
exercise(A_DEX, FALSE);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case POT_SLEEPING:
|
|
||||||
|
static void
|
||||||
|
peffect_sleeping(struct obj *otmp)
|
||||||
|
{
|
||||||
if (Sleep_resistance || Free_action) {
|
if (Sleep_resistance || Free_action) {
|
||||||
monstseesu(M_SEEN_SLEEP);
|
monstseesu(M_SEEN_SLEEP);
|
||||||
You("yawn.");
|
You("yawn.");
|
||||||
@@ -802,11 +847,13 @@ peffects(struct obj *otmp)
|
|||||||
You("suddenly fall asleep!");
|
You("suddenly fall asleep!");
|
||||||
fall_asleep(-rn1(10, 25 - 12 * bcsign(otmp)), TRUE);
|
fall_asleep(-rn1(10, 25 - 12 * bcsign(otmp)), TRUE);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case POT_MONSTER_DETECTION:
|
|
||||||
case SPE_DETECT_MONSTERS:
|
static int
|
||||||
|
peffect_monster_detection(struct obj *otmp)
|
||||||
|
{
|
||||||
if (otmp->blessed) {
|
if (otmp->blessed) {
|
||||||
int x, y;
|
int i, x, y;
|
||||||
|
|
||||||
if (Detect_monsters)
|
if (Detect_monsters)
|
||||||
g.potion_nothing++;
|
g.potion_nothing++;
|
||||||
@@ -832,20 +879,27 @@ peffects(struct obj *otmp)
|
|||||||
see_monsters();
|
see_monsters();
|
||||||
if (g.potion_unkn)
|
if (g.potion_unkn)
|
||||||
You_feel("lonely.");
|
You_feel("lonely.");
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (monster_detect(otmp, 0))
|
if (monster_detect(otmp, 0))
|
||||||
return 1; /* nothing detected */
|
return 1; /* nothing detected */
|
||||||
exercise(A_WIS, TRUE);
|
exercise(A_WIS, TRUE);
|
||||||
break;
|
return 0;
|
||||||
case POT_OBJECT_DETECTION:
|
}
|
||||||
case SPE_DETECT_TREASURE:
|
|
||||||
|
static int
|
||||||
|
peffect_object_detection(struct obj *otmp)
|
||||||
|
{
|
||||||
if (object_detect(otmp, 0))
|
if (object_detect(otmp, 0))
|
||||||
return 1; /* nothing detected */
|
return 1; /* nothing detected */
|
||||||
exercise(A_WIS, TRUE);
|
exercise(A_WIS, TRUE);
|
||||||
break;
|
return 0;
|
||||||
case POT_SICKNESS:
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
peffect_sickness(struct obj *otmp)
|
||||||
|
{
|
||||||
pline("Yecch! This stuff tastes like poison.");
|
pline("Yecch! This stuff tastes like poison.");
|
||||||
if (otmp->blessed) {
|
if (otmp->blessed) {
|
||||||
pline("(But in fact it was mildly stale %s.)", fruitname(TRUE));
|
pline("(But in fact it was mildly stale %s.)", fruitname(TRUE));
|
||||||
@@ -891,8 +945,11 @@ peffects(struct obj *otmp)
|
|||||||
You("are shocked back to your senses!");
|
You("are shocked back to your senses!");
|
||||||
(void) make_hallucinated(0L, FALSE, 0L);
|
(void) make_hallucinated(0L, FALSE, 0L);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case POT_CONFUSION:
|
|
||||||
|
static void
|
||||||
|
peffect_confusion(struct obj *otmp)
|
||||||
|
{
|
||||||
if (!Confusion) {
|
if (!Confusion) {
|
||||||
if (Hallucination) {
|
if (Hallucination) {
|
||||||
pline("What a trippy feeling!");
|
pline("What a trippy feeling!");
|
||||||
@@ -904,8 +961,11 @@ peffects(struct obj *otmp)
|
|||||||
make_confused(itimeout_incr(HConfusion,
|
make_confused(itimeout_incr(HConfusion,
|
||||||
rn1(7, 16 - 8 * bcsign(otmp))),
|
rn1(7, 16 - 8 * bcsign(otmp))),
|
||||||
FALSE);
|
FALSE);
|
||||||
break;
|
}
|
||||||
case POT_GAIN_ABILITY:
|
|
||||||
|
static void
|
||||||
|
peffect_gain_ability(struct obj *otmp)
|
||||||
|
{
|
||||||
if (otmp->cursed) {
|
if (otmp->cursed) {
|
||||||
pline("Ulch! That potion tasted foul!");
|
pline("Ulch! That potion tasted foul!");
|
||||||
g.potion_unkn++;
|
g.potion_unkn++;
|
||||||
@@ -913,8 +973,7 @@ peffects(struct obj *otmp)
|
|||||||
g.potion_nothing++;
|
g.potion_nothing++;
|
||||||
} else { /* If blessed, increase all; if not, try up to */
|
} else { /* If blessed, increase all; if not, try up to */
|
||||||
int itmp; /* 6 times to find one which can be increased. */
|
int itmp; /* 6 times to find one which can be increased. */
|
||||||
|
int ii, i = -1; /* increment to 0 */
|
||||||
i = -1; /* increment to 0 */
|
|
||||||
for (ii = A_MAX; ii > 0; ii--) {
|
for (ii = A_MAX; ii > 0; ii--) {
|
||||||
i = (otmp->blessed ? i + 1 : rn2(A_MAX));
|
i = (otmp->blessed ? i + 1 : rn2(A_MAX));
|
||||||
/* only give "your X is already as high as it can get"
|
/* only give "your X is already as high as it can get"
|
||||||
@@ -924,16 +983,20 @@ peffects(struct obj *otmp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case POT_SPEED:
|
|
||||||
|
static void
|
||||||
|
peffect_speed(struct obj *otmp)
|
||||||
|
{
|
||||||
|
boolean is_speed = (otmp->otyp == POT_SPEED);
|
||||||
|
|
||||||
/* skip when mounted; heal_legs() would heal steed's legs */
|
/* skip when mounted; heal_legs() would heal steed's legs */
|
||||||
if (Wounded_legs && !otmp->cursed && !u.usteed) {
|
if (is_speed && Wounded_legs && !otmp->cursed && !u.usteed) {
|
||||||
heal_legs(0);
|
heal_legs(0);
|
||||||
g.potion_unkn++;
|
g.potion_unkn++;
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
/* FALLTHRU */
|
|
||||||
case SPE_HASTE_SELF:
|
|
||||||
if (!Very_fast) { /* wwf@doe.carleton.ca */
|
if (!Very_fast) { /* wwf@doe.carleton.ca */
|
||||||
You("are suddenly moving %sfaster.", Fast ? "" : "much ");
|
You("are suddenly moving %sfaster.", Fast ? "" : "much ");
|
||||||
} else {
|
} else {
|
||||||
@@ -942,15 +1005,21 @@ peffects(struct obj *otmp)
|
|||||||
}
|
}
|
||||||
exercise(A_DEX, TRUE);
|
exercise(A_DEX, TRUE);
|
||||||
incr_itimeout(&HFast, rn1(10, 100 + 60 * bcsign(otmp)));
|
incr_itimeout(&HFast, rn1(10, 100 + 60 * bcsign(otmp)));
|
||||||
break;
|
}
|
||||||
case POT_BLINDNESS:
|
|
||||||
|
static void
|
||||||
|
peffect_blindness(struct obj *otmp)
|
||||||
|
{
|
||||||
if (Blind)
|
if (Blind)
|
||||||
g.potion_nothing++;
|
g.potion_nothing++;
|
||||||
make_blinded(itimeout_incr(Blinded,
|
make_blinded(itimeout_incr(Blinded,
|
||||||
rn1(200, 250 - 125 * bcsign(otmp))),
|
rn1(200, 250 - 125 * bcsign(otmp))),
|
||||||
(boolean) !Blind);
|
(boolean) !Blind);
|
||||||
break;
|
}
|
||||||
case POT_GAIN_LEVEL:
|
|
||||||
|
static void
|
||||||
|
peffect_gain_level(struct obj *otmp)
|
||||||
|
{
|
||||||
if (otmp->cursed) {
|
if (otmp->cursed) {
|
||||||
g.potion_unkn++;
|
g.potion_unkn++;
|
||||||
/* they went up a level */
|
/* they went up a level */
|
||||||
@@ -968,28 +1037,34 @@ peffects(struct obj *otmp)
|
|||||||
get_level(&newlevel, newlev);
|
get_level(&newlevel, newlev);
|
||||||
if (on_level(&newlevel, &u.uz)) {
|
if (on_level(&newlevel, &u.uz)) {
|
||||||
pline("It tasted bad.");
|
pline("It tasted bad.");
|
||||||
break;
|
return;
|
||||||
} else
|
} else
|
||||||
You(riseup, ceiling(u.ux, u.uy));
|
You(riseup, ceiling(u.ux, u.uy));
|
||||||
goto_level(&newlevel, FALSE, FALSE, FALSE);
|
goto_level(&newlevel, FALSE, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
You("have an uneasy feeling.");
|
You("have an uneasy feeling.");
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
pluslvl(FALSE);
|
pluslvl(FALSE);
|
||||||
/* blessed potions place you at a random spot in the
|
/* blessed potions place you at a random spot in the
|
||||||
middle of the new level instead of the low point */
|
middle of the new level instead of the low point */
|
||||||
if (otmp->blessed)
|
if (otmp->blessed)
|
||||||
u.uexp = rndexp(TRUE);
|
u.uexp = rndexp(TRUE);
|
||||||
break;
|
}
|
||||||
case POT_HEALING:
|
|
||||||
|
static void
|
||||||
|
peffect_healing(struct obj *otmp)
|
||||||
|
{
|
||||||
You_feel("better.");
|
You_feel("better.");
|
||||||
healup(d(6 + 2 * bcsign(otmp), 4), !otmp->cursed ? 1 : 0,
|
healup(d(6 + 2 * bcsign(otmp), 4), !otmp->cursed ? 1 : 0,
|
||||||
!!otmp->blessed, !otmp->cursed);
|
!!otmp->blessed, !otmp->cursed);
|
||||||
exercise(A_CON, TRUE);
|
exercise(A_CON, TRUE);
|
||||||
break;
|
}
|
||||||
case POT_EXTRA_HEALING:
|
|
||||||
|
static void
|
||||||
|
peffect_extra_healing(struct obj *otmp)
|
||||||
|
{
|
||||||
You_feel("much better.");
|
You_feel("much better.");
|
||||||
healup(d(6 + 2 * bcsign(otmp), 8),
|
healup(d(6 + 2 * bcsign(otmp), 8),
|
||||||
otmp->blessed ? 5 : !otmp->cursed ? 2 : 0, !otmp->cursed,
|
otmp->blessed ? 5 : !otmp->cursed ? 2 : 0, !otmp->cursed,
|
||||||
@@ -997,8 +1072,11 @@ peffects(struct obj *otmp)
|
|||||||
(void) make_hallucinated(0L, TRUE, 0L);
|
(void) make_hallucinated(0L, TRUE, 0L);
|
||||||
exercise(A_CON, TRUE);
|
exercise(A_CON, TRUE);
|
||||||
exercise(A_STR, TRUE);
|
exercise(A_STR, TRUE);
|
||||||
break;
|
}
|
||||||
case POT_FULL_HEALING:
|
|
||||||
|
static void
|
||||||
|
peffect_full_healing(struct obj *otmp)
|
||||||
|
{
|
||||||
You_feel("completely healed.");
|
You_feel("completely healed.");
|
||||||
healup(400, 4 + 4 * bcsign(otmp), !otmp->cursed, TRUE);
|
healup(400, 4 + 4 * bcsign(otmp), !otmp->cursed, TRUE);
|
||||||
/* Restore one lost level if blessed */
|
/* Restore one lost level if blessed */
|
||||||
@@ -1011,9 +1089,11 @@ peffects(struct obj *otmp)
|
|||||||
(void) make_hallucinated(0L, TRUE, 0L);
|
(void) make_hallucinated(0L, TRUE, 0L);
|
||||||
exercise(A_STR, TRUE);
|
exercise(A_STR, TRUE);
|
||||||
exercise(A_CON, TRUE);
|
exercise(A_CON, TRUE);
|
||||||
break;
|
}
|
||||||
case POT_LEVITATION:
|
|
||||||
case SPE_LEVITATION:
|
static void
|
||||||
|
peffect_levitation(struct obj *otmp)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* BLevitation will be set if levitation is blocked due to being
|
* BLevitation will be set if levitation is blocked due to being
|
||||||
* inside rock (currently or formerly in phazing xorn form, perhaps)
|
* inside rock (currently or formerly in phazing xorn form, perhaps)
|
||||||
@@ -1068,8 +1148,11 @@ peffects(struct obj *otmp)
|
|||||||
spoteffects(FALSE);
|
spoteffects(FALSE);
|
||||||
/* levitating blocks flying */
|
/* levitating blocks flying */
|
||||||
float_vs_flight();
|
float_vs_flight();
|
||||||
break;
|
}
|
||||||
case POT_GAIN_ENERGY: { /* M. Stephenson */
|
|
||||||
|
static void
|
||||||
|
peffect_gain_energy(struct obj *otmp)
|
||||||
|
{
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
if (otmp->cursed)
|
if (otmp->cursed)
|
||||||
@@ -1099,9 +1182,11 @@ peffects(struct obj *otmp)
|
|||||||
u.uen = 0;
|
u.uen = 0;
|
||||||
g.context.botl = 1;
|
g.context.botl = 1;
|
||||||
exercise(A_WIS, TRUE);
|
exercise(A_WIS, TRUE);
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
case POT_OIL: { /* P. Winner */
|
static void
|
||||||
|
peffect_oil(struct obj *otmp)
|
||||||
|
{
|
||||||
boolean good_for_you = FALSE, vulnerable;
|
boolean good_for_you = FALSE, vulnerable;
|
||||||
|
|
||||||
if (otmp->lamplit) {
|
if (otmp->lamplit) {
|
||||||
@@ -1134,9 +1219,11 @@ peffects(struct obj *otmp)
|
|||||||
pline("That was smooth!");
|
pline("That was smooth!");
|
||||||
}
|
}
|
||||||
exercise(A_WIS, good_for_you);
|
exercise(A_WIS, good_for_you);
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
case POT_ACID:
|
static void
|
||||||
|
peffect_acid(struct obj *otmp)
|
||||||
|
{
|
||||||
if (Acid_resistance) {
|
if (Acid_resistance) {
|
||||||
/* Not necessarily a creature who _likes_ acid */
|
/* Not necessarily a creature who _likes_ acid */
|
||||||
pline("This tastes %s.", Hallucination ? "tangy" : "sour");
|
pline("This tastes %s.", Hallucination ? "tangy" : "sour");
|
||||||
@@ -1153,11 +1240,103 @@ peffects(struct obj *otmp)
|
|||||||
if (Stoned)
|
if (Stoned)
|
||||||
fix_petrification();
|
fix_petrification();
|
||||||
g.potion_unkn++; /* holy/unholy water can burn like acid too */
|
g.potion_unkn++; /* holy/unholy water can burn like acid too */
|
||||||
break;
|
}
|
||||||
case POT_POLYMORPH:
|
|
||||||
|
static void
|
||||||
|
peffect_polymorph(struct obj *otmp UNUSED)
|
||||||
|
{
|
||||||
You_feel("a little %s.", Hallucination ? "normal" : "strange");
|
You_feel("a little %s.", Hallucination ? "normal" : "strange");
|
||||||
if (!Unchanging)
|
if (!Unchanging)
|
||||||
polyself(0);
|
polyself(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
peffects(struct obj *otmp)
|
||||||
|
{
|
||||||
|
switch (otmp->otyp) {
|
||||||
|
case POT_RESTORE_ABILITY:
|
||||||
|
case SPE_RESTORE_ABILITY:
|
||||||
|
peffect_restore_ability(otmp);
|
||||||
|
break;
|
||||||
|
case POT_HALLUCINATION:
|
||||||
|
peffect_hallucination(otmp);
|
||||||
|
break;
|
||||||
|
case POT_WATER:
|
||||||
|
peffect_water(otmp);
|
||||||
|
break;
|
||||||
|
case POT_BOOZE:
|
||||||
|
peffect_booze(otmp);
|
||||||
|
break;
|
||||||
|
case POT_ENLIGHTENMENT:
|
||||||
|
peffect_enlightenment(otmp);
|
||||||
|
break;
|
||||||
|
case SPE_INVISIBILITY:
|
||||||
|
case POT_INVISIBILITY:
|
||||||
|
peffect_invisibility(otmp);
|
||||||
|
break;
|
||||||
|
case POT_SEE_INVISIBLE: /* tastes like fruit juice in Rogue */
|
||||||
|
case POT_FRUIT_JUICE:
|
||||||
|
peffect_see_invisible(otmp);
|
||||||
|
break;
|
||||||
|
case POT_PARALYSIS:
|
||||||
|
peffect_paralysis(otmp);
|
||||||
|
break;
|
||||||
|
case POT_SLEEPING:
|
||||||
|
peffect_sleeping(otmp);
|
||||||
|
break;
|
||||||
|
case POT_MONSTER_DETECTION:
|
||||||
|
case SPE_DETECT_MONSTERS:
|
||||||
|
if (peffect_monster_detection(otmp))
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
case POT_OBJECT_DETECTION:
|
||||||
|
case SPE_DETECT_TREASURE:
|
||||||
|
if (peffect_object_detection(otmp))
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
case POT_SICKNESS:
|
||||||
|
peffect_sickness(otmp);
|
||||||
|
break;
|
||||||
|
case POT_CONFUSION:
|
||||||
|
peffect_confusion(otmp);
|
||||||
|
break;
|
||||||
|
case POT_GAIN_ABILITY:
|
||||||
|
peffect_gain_ability(otmp);
|
||||||
|
break;
|
||||||
|
case POT_SPEED:
|
||||||
|
case SPE_HASTE_SELF:
|
||||||
|
peffect_speed(otmp);
|
||||||
|
break;
|
||||||
|
case POT_BLINDNESS:
|
||||||
|
peffect_blindness(otmp);
|
||||||
|
break;
|
||||||
|
case POT_GAIN_LEVEL:
|
||||||
|
peffect_gain_level(otmp);
|
||||||
|
break;
|
||||||
|
case POT_HEALING:
|
||||||
|
peffect_healing(otmp);
|
||||||
|
break;
|
||||||
|
case POT_EXTRA_HEALING:
|
||||||
|
peffect_extra_healing(otmp);
|
||||||
|
break;
|
||||||
|
case POT_FULL_HEALING:
|
||||||
|
peffect_full_healing(otmp);
|
||||||
|
break;
|
||||||
|
case POT_LEVITATION:
|
||||||
|
case SPE_LEVITATION:
|
||||||
|
peffect_levitation(otmp);
|
||||||
|
break;
|
||||||
|
case POT_GAIN_ENERGY: /* M. Stephenson */
|
||||||
|
peffect_gain_energy(otmp);
|
||||||
|
break;
|
||||||
|
case POT_OIL: /* P. Winner */
|
||||||
|
peffect_oil(otmp);
|
||||||
|
break;
|
||||||
|
case POT_ACID:
|
||||||
|
peffect_acid(otmp);
|
||||||
|
break;
|
||||||
|
case POT_POLYMORPH:
|
||||||
|
peffect_polymorph(otmp);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
impossible("What a funny potion! (%u)", otmp->otyp);
|
impossible("What a funny potion! (%u)", otmp->otyp);
|
||||||
|
|||||||
Reference in New Issue
Block a user