summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monster.cc
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-19 06:29:42 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-19 06:31:39 -0600
commit117cfdbc3934adfed89079b242e47c350aa7808d (patch)
treebcce9d14879e16d63e563717fc5ca8ec350bffc6 /crawl-ref/source/monster.cc
parent88bcacdbb333e702aee3ed20710ffdb8cc66ca81 (diff)
downloadcrawl-ref-117cfdbc3934adfed89079b242e47c350aa7808d.tar.gz
crawl-ref-117cfdbc3934adfed89079b242e47c350aa7808d.zip
And update what monsters can wield one more time, in a better way.
Currently, there are no unclean weapons, and Fedhas gives no monsters as gifts that can wield weapons, but cover those cases anyway, just in case.
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r--crawl-ref/source/monster.cc30
1 files changed, 24 insertions, 6 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index fccd00e155..7f5a262627 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -614,21 +614,39 @@ bool monsters::could_wield(const item_def &item, bool ignore_brand,
return (false);
// Holy monsters and monsters that are gifts of good gods won't
- // use unholy or evil weapons.
- if ((is_holy() || is_good_god(god))
- && (is_unholy_item(item) || is_evil_item(item)))
+ // use unholy weapons.
+ if ((is_holy() || is_good_god(god)) && is_unholy_item(item))
+ return (false);
+
+ // Holy monsters that aren't gifts of chaotic gods and monsters
+ // that are gifts of good gods or Fedhas won't use potentially
+ // evil weapons.
+ if (((is_holy() && !is_chaotic_god(god))
+ || (is_good_god(god) || god == GOD_FEDHAS))
+ && is_potentially_evil_item(item))
+ {
+ return (false);
+ }
+
+ // Holy monsters and monsters that are gifts of good gods or
+ // Fedhas won't use evil weapons.
+ if (((is_holy() || is_good_god(god)) || god == GOD_FEDHAS)
+ && is_evil_item(item))
{
return (false);
}
// Holy monsters that aren't gifts of chaotic gods and monsters
- // that are gifts of good gods won't use unclean or chaotic
- // weapons.
+ // that are gifts of good gods won't use chaotic weapons.
if (((is_holy() && !is_chaotic_god(god)) || is_good_god(god))
- && (is_unclean_item(item) || is_chaotic_item(item)))
+ && is_chaotic_item(item))
{
return (false);
}
+
+ // Monsters that are gifts of Zin won't use unclean weapons.
+ if (god == GOD_ZIN && is_unclean_item(item))
+ return (false);
}
return (true);