From fada7cc9c6c230526a737d34e8f04cf22969b7f7 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 19 Jun 2008 12:59:48 +0000 Subject: Fix 1996837: Allow equipping spellcasters with ammunition on generation. Fix 1997179: Merge zombies correctly in the monster list. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5977 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mon-util.cc | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'crawl-ref/source/mon-util.cc') diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 620b0e30ec..e6b522f2d0 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1892,7 +1892,7 @@ static std::string _str_monam(const monsters& mon, description_level_type desc, std::string mons_type_name(int type, description_level_type desc ) { std::string result; - if ( !mons_is_unique(type) ) + if (!mons_is_unique(type)) { switch (desc) { @@ -1914,6 +1914,7 @@ std::string mons_type_name(int type, description_level_type desc ) { result.insert(1, "n"); } + return result; } @@ -3883,26 +3884,30 @@ bool monsters::pickup_missile(item_def &item, int near, bool force) { const item_def *miss = missiles(); - if (item.sub_type == MI_THROWING_NET) - { - // Monster may not pick up trapping net. - if (mons_is_caught(this) && item_is_stationary(item)) - return (false); - } - else // None of these exceptions hold for throwing nets. + if (!force) { - // Spellcasters should not waste time with ammunition. - if (mons_has_ranged_spell(this)) - return (false); - - // Monsters in a fight will only pick up missiles if doing so - // is worthwhile. - if (!mons_is_wandering(this) && (!mons_friendly(this) || foe != MHITYOU) - && (item.quantity < 5 || miss && miss->quantity >= 7)) + if (item.sub_type == MI_THROWING_NET) { - return (false); + // Monster may not pick up trapping net. + if (mons_is_caught(this) && item_is_stationary(item)) + return (false); + } + else // None of these exceptions hold for throwing nets. + { + // Spellcasters should not waste time with ammunition. + if (mons_has_ranged_spell(this)) + return (false); + + // Monsters in a fight will only pick up missiles if doing so + // is worthwhile. + if (!mons_is_wandering(this) && (!mons_friendly(this) || foe != MHITYOU) + && (item.quantity < 5 || miss && miss->quantity >= 7)) + { + return (false); + } } } + if (miss && items_stack(*miss, item)) return (pickup(item, MSLOT_MISSILE, near)); -- cgit v1.2.3-54-g00ecf