From c943df44e489ffcab58f3d47964411d8779ad2bc Mon Sep 17 00:00:00 2001 From: dolorous Date: Tue, 24 Jun 2008 19:57:19 +0000 Subject: Simplify Xom's choosing of a random potion effect more. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6126 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/xom.cc | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'crawl-ref/source/xom.cc') diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 8a7c5c0b8a..0e966f8642 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -435,28 +435,27 @@ static bool _xom_is_good(int sever) if (random2(sever) <= 1) { - potion_type pot; + potion_type pot = + static_cast( + random_choose(POT_HEALING, POT_HEAL_WOUNDS, POT_SPEED, + POT_MIGHT, POT_INVISIBILITY, POT_BERSERK_RAGE, + POT_EXPERIENCE, -1)); - do - { - pot = (potion_type)random_choose( - POT_HEALING, POT_HEAL_WOUNDS, POT_SPEED, POT_MIGHT, - POT_INVISIBILITY, POT_BERSERK_RAGE, POT_EXPERIENCE, -1); - - // 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)); + // Downplay this one a bit. + if (pot == POT_EXPERIENCE && !one_chance_in(6)) + pot = POT_BERSERK_RAGE; - if (pot == POT_BERSERK_RAGE) - you.berserk_penalty = NO_BERSERK_PENALTY; + if (pot != POT_BERSERK_RAGE || you.can_go_berserk(false)) + { + god_speaks(GOD_XOM, _get_xom_speech("potion effect")); - god_speaks(GOD_XOM, _get_xom_speech("potion effect")); + if (pot == POT_BERSERK_RAGE) + you.berserk_penalty = NO_BERSERK_PENALTY; - potion_effect(pot, 150); + potion_effect(pot, 150); - done = true; + done = true; + } } else if (random2(sever) <= 2) { -- cgit v1.2.3-54-g00ecf