diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-11-27 23:05:25 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-11-27 23:35:20 +0100 |
commit | 5d6eb580c3c0b527c756a8ed95ffbd7f11c6d019 (patch) | |
tree | 11006dd77aca6e992b74dfc88c2ba623c80c12d5 /crawl-ref/source/potion.cc | |
parent | 6191413d03046740e03c1705ac16103c18c0301c (diff) | |
download | crawl-ref-5d6eb580c3c0b527c756a8ed95ffbd7f11c6d019.tar.gz crawl-ref-5d6eb580c3c0b527c756a8ed95ffbd7f11c6d019.zip |
Abort drinking known potions of a few types when they'd have no effect.
Only a few types of potions for the moment ({cure ,,beneficial }mutation,
berserk, lignify) as I suspect this commit might be reverted.
Mostly, I'd want to hear if this is a good idea.
Diffstat (limited to 'crawl-ref/source/potion.cc')
-rw-r--r-- | crawl-ref/source/potion.cc | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc index 4621af88de..4591728782 100644 --- a/crawl-ref/source/potion.cc +++ b/crawl-ref/source/potion.cc @@ -48,7 +48,7 @@ * * @return If the potion was identified. */ -void potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_known, +bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_known, bool from_fountain) { pow = min(pow, 150); @@ -280,7 +280,7 @@ void potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know // You can't turn invisible while haloed or glowing // naturally, but identify the effect anyway. mpr("You briefly turn translucent."); - return; + return true; } else if (you.backlit()) { @@ -399,6 +399,9 @@ void potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know } case POT_BERSERK_RAGE: + if (potion && was_known && !you.can_go_berserk(true, drank_it, false)) + return false; + if (you.species == SP_VAMPIRE && you.hunger_state <= HS_SATIATED) { mpr("You feel slightly irritated."); @@ -412,6 +415,12 @@ void potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know break; case POT_CURE_MUTATION: + if (potion && was_known && undead_mutation_rot(true)) + { + mpr(you.form == TRAN_LICH ? "You cannot mutate at present." + : "You cannot mutate."); + return false; + } mpr("It has a very clean taste."); for (int i = 0; i < 7; i++) if (random2(9) >= i) @@ -419,6 +428,13 @@ void potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know break; case POT_MUTATION: + if (potion && was_known && undead_mutation_rot(true)) + { + mpr(you.form == TRAN_LICH ? "You cannot mutate at present." + : "You cannot mutate."); + return false; + } + mpr("You feel extremely strange."); for (int i = 0; i < 3; i++) mutate(RANDOM_MUTATION, "potion of mutation", false); @@ -430,6 +446,13 @@ void potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know case POT_BENEFICIAL_MUTATION: if (undead_mutation_rot(true)) { + if (potion && was_known) + { + mpr(you.form == TRAN_LICH ? "You cannot mutate at present." + : "You cannot mutate."); + return false; + } + mpr("You feel dead inside."); mutate(RANDOM_GOOD_MUTATION, "potion of beneficial mutation", true, false, false, true); @@ -454,6 +477,12 @@ void potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know break; case POT_LIGNIFY: + if (potion && was_known && !transform(0, TRAN_TREE, false, true)) + { + mpr("You can't become a tree right now."); + return false; + } + if (transform(30, TRAN_TREE, !was_known)) { you.transform_uncancellable = true; @@ -470,4 +499,6 @@ void potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know set_ident_type(*potion, ID_KNOWN_TYPE); mpr("It was a " + potion->name(DESC_QUALNAME) + "."); } + + return true; } |