summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/xom.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-24 19:35:02 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-24 19:35:02 +0000
commitd713edeb0695c87fba2cca2d04cbd98e7982ff00 (patch)
treebec26f8a7c2c1bd3f3feeeff9737dee11d63a10f /crawl-ref/source/xom.cc
parentbff6fca5d958cb98958e3f534d1ec9572dc23e92 (diff)
downloadcrawl-ref-d713edeb0695c87fba2cca2d04cbd98e7982ff00.tar.gz
crawl-ref-d713edeb0695c87fba2cca2d04cbd98e7982ff00.zip
Simplify Xom's choosing of a random potion effect.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6125 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/xom.cc')
-rw-r--r--crawl-ref/source/xom.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 09f1c831ce..8a7c5c0b8a 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -435,25 +435,26 @@ static bool _xom_is_good(int sever)
if (random2(sever) <= 1)
{
- potion_type type = (potion_type)random_choose(
- POT_HEALING, POT_HEAL_WOUNDS, POT_SPEED, POT_MIGHT,
- POT_INVISIBILITY, POT_BERSERK_RAGE, POT_EXPERIENCE, -1);
+ potion_type pot;
- // Downplay this one a bit.
- if (type == POT_EXPERIENCE && !one_chance_in(6))
- type = POT_BERSERK_RAGE;
-
- if (type == POT_BERSERK_RAGE)
+ do
{
- if (!you.can_go_berserk(false)) // No message.
- goto try_again;
+ pot = (potion_type)random_choose(
+ POT_HEALING, POT_HEAL_WOUNDS, POT_SPEED, POT_MIGHT,
+ POT_INVISIBILITY, POT_BERSERK_RAGE, POT_EXPERIENCE, -1);
- you.berserk_penalty = NO_BERSERK_PENALTY;
+ // Downplay this one a bit.
+ if (pot == POT_EXPERIENCE && !one_chance_in(6))
+ pot = POT_BERSERK_RAGE;
}
+ while (pot == POT_BERSERK_RAGE && !you.can_go_berserk(false));
+
+ if (pot == POT_BERSERK_RAGE)
+ you.berserk_penalty = NO_BERSERK_PENALTY;
god_speaks(GOD_XOM, _get_xom_speech("potion effect"));
- potion_effect(type, 150);
+ potion_effect(pot, 150);
done = true;
}
@@ -718,7 +719,6 @@ static bool _xom_is_good(int sever)
done = true;
}
-try_again:
return (done);
}