From 682efee855c84516f0f073926efb9357813b0adc Mon Sep 17 00:00:00 2001 From: Nicholas Feinberg Date: Wed, 9 Jul 2014 19:25:07 -0700 Subject: 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. --- crawl-ref/source/mon-gear.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/mon-gear.cc') 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; -- cgit v1.2.3-54-g00ecf