summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/potion.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-28 05:03:37 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-28 13:32:04 +0100
commitd9906b209d6724df140a647e2404923c794d4e6b (patch)
tree456d3aad4fcfb4114ed657cebf44827dc7df01fc /crawl-ref/source/potion.cc
parent258349bf421d47072b0442af59fd2c5063d566a1 (diff)
downloadcrawl-ref-d9906b209d6724df140a647e2404923c794d4e6b.tar.gz
crawl-ref-d9906b209d6724df140a647e2404923c794d4e6b.zip
Don't waste potions of speed, flight or invis.
Invis can be drank while contaminated which isn't going to do anything good, but it has a non-zero effect.
Diffstat (limited to 'crawl-ref/source/potion.cc')
-rw-r--r--crawl-ref/source/potion.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc
index 9750aaa087..a4b4bc0bfd 100644
--- a/crawl-ref/source/potion.cc
+++ b/crawl-ref/source/potion.cc
@@ -164,6 +164,12 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
break;
case POT_SPEED:
+ if (potion && was_known && you.stasis(false))
+ {
+ mpr("This potion can't work under stasis.");
+ return false;
+ }
+
if (haste_player((40 + random2(pow)) / factor))
did_god_conduct(DID_HASTY, 10, was_known);
break;
@@ -230,7 +236,11 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
case POT_FLIGHT:
if (!flight_allowed())
+ {
+ if (potion && was_known)
+ return false;
break;
+ }
you.attribute[ATTR_FLIGHT_UNCANCELLABLE] = 1;
fly_player(pow);
@@ -287,6 +297,12 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
case POT_INVISIBILITY:
if (you.haloed() || you.glows_naturally())
{
+ if (potion && was_known)
+ {
+ mpr("You cannot become invisible while glowing.");
+ return false;
+ }
+
// You can't turn invisible while haloed or glowing
// naturally, but identify the effect anyway.
mpr("You briefly turn translucent.");