From d713edeb0695c87fba2cca2d04cbd98e7982ff00 Mon Sep 17 00:00:00 2001 From: dolorous Date: Tue, 24 Jun 2008 19:35:02 +0000 Subject: 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 --- crawl-ref/source/xom.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'crawl-ref/source/xom.cc') 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); } -- cgit v1.2.3-54-g00ecf