summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ghost.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-07-30 23:27:44 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-07-30 23:27:44 -0700
commiteb356de990b0ac8c5ac42f8f0e9628d351dff34f (patch)
tree589cf2b33ccb5971e970064cbb8486c957948f88 /crawl-ref/source/ghost.cc
parentd30bd84d52ff34eb7c52daeb11240b929ba14574 (diff)
downloadcrawl-ref-eb356de990b0ac8c5ac42f8f0e9628d351dff34f.tar.gz
crawl-ref-eb356de990b0ac8c5ac42f8f0e9628d351dff34f.zip
Refactor _random_special_pan_lord_brand()
Also remove the small chance of getting SPWPN_NORMAL, which I suspect was unintentional.
Diffstat (limited to 'crawl-ref/source/ghost.cc')
-rw-r--r--crawl-ref/source/ghost.cc39
1 files changed, 18 insertions, 21 deletions
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 3a2ac6d69e..f4d7b852d9 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -172,29 +172,26 @@ void ghost_demon::reset()
acting_part = MONS_0;
}
+/**
+ * Choose a random brand for a pandemonium lord's melee attacks.
+ *
+ * @return A random valid brand type (not holy wrath, protection, etc)
+ */
static brand_type _random_special_pan_lord_brand()
{
- brand_type brand;
-
- do
- {
- brand = static_cast<brand_type>(random2(MAX_PAN_LORD_BRANDS));
- // some brands inappropriate (e.g. holy wrath)
- }
- while (brand == SPWPN_HOLY_WRATH
-#if TAG_MAJOR_VERSION == 34
- || brand == SPWPN_ORC_SLAYING
- || brand == SPWPN_RETURNING
- || brand == SPWPN_REACHING
- || brand == SPWPN_FLAME
- || brand == SPWPN_FROST
- || brand == SPWPN_DRAGON_SLAYING
-#endif
- || brand == SPWPN_PROTECTION
- || brand == SPWPN_EVASION
- );
-
- return brand;
+ return random_choose(SPWPN_FLAMING,
+ SPWPN_FREEZING,
+ SPWPN_ELECTROCUTION,
+ SPWPN_VENOM,
+ SPWPN_DRAINING,
+ SPWPN_SPEED,
+ SPWPN_VORPAL,
+ SPWPN_VAMPIRISM,
+ SPWPN_PAIN,
+ SPWPN_ANTIMAGIC,
+ SPWPN_DISTORTION,
+ SPWPN_CHAOS,
+ -1);
}
void ghost_demon::init_random_demon()