diff options
author | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-07-09 19:25:07 -0700 |
---|---|---|
committer | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-07-09 19:25:07 -0700 |
commit | 682efee855c84516f0f073926efb9357813b0adc (patch) | |
tree | 50677162db4cee40a9cda51c6eba26e0ac8f03ae /crawl-ref/source/mon-gear.cc | |
parent | d32eec0d69ecfa2875473e2f6806323ca6585114 (diff) | |
download | crawl-ref-682efee855c84516f0f073926efb9357813b0adc.tar.gz crawl-ref-682efee855c84516f0f073926efb9357813b0adc.zip |
Refactor weapon property code
Mainly relevant to chaos champions (should mean that melee_only
champions no longer spawn with slings, as a bonus), but also
in preparation for adding more weapon types.
Diffstat (limited to 'crawl-ref/source/mon-gear.cc')
-rw-r--r-- | crawl-ref/source/mon-gear.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/crawl-ref/source/mon-gear.cc b/crawl-ref/source/mon-gear.cc index 04dcafc6a1..0dde89b418 100644 --- a/crawl-ref/source/mon-gear.cc +++ b/crawl-ref/source/mon-gear.cc @@ -1420,16 +1420,12 @@ static void _give_weapon(monster* mon, int level, bool melee_only = false, item.base_type = OBJ_WEAPONS; do item.sub_type = random2(NUM_WEAPONS); - while ((melee_only && (item.sub_type == WPN_BLOWGUN - || item.sub_type == WPN_CROSSBOW - || item.sub_type == WPN_SHORTBOW - || item.sub_type == WPN_LONGBOW)) - || item.sub_type == WPN_STAFF - || item.sub_type == WPN_ROD - || item.sub_type == WPN_HAMMER + while (melee_only && is_ranged_weapon_type(item.sub_type) + || is_blessed_weapon_type(item.sub_type) + || is_magic_weapon_type(item.sub_type) || is_giant_club_type(item.sub_type) - || item.sub_type > WPN_SLING); // the last of these checks for - // blessed base weapon types + || item.sub_type == WPN_HAMMER); + if (one_chance_in(100)) { force_item = true; |