summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-19 12:59:48 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-19 12:59:48 +0000
commitfada7cc9c6c230526a737d34e8f04cf22969b7f7 (patch)
treedd7146f60eac45627220860d5ab3289466f9d025 /crawl-ref/source/mon-util.cc
parentda3bf95551a8e8ccc61035857608f6a1213ccf39 (diff)
downloadcrawl-ref-fada7cc9c6c230526a737d34e8f04cf22969b7f7.tar.gz
crawl-ref-fada7cc9c6c230526a737d34e8f04cf22969b7f7.zip
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
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc39
1 files changed, 22 insertions, 17 deletions
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));