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-04-25 19:33:07 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-25 19:33:07 +0000
commitaadcdbed9483b1efb141d9c8e49c375cbe4b831b (patch)
treeb02c3b6a2113f4d94c0edf80f8dfc1f69a2f38be /crawl-ref/source/mon-util.cc
parente1594edc5aa04938ec3c071ffc1ed21a4f4b84ce (diff)
downloadcrawl-ref-aadcdbed9483b1efb141d9c8e49c375cbe4b831b.tar.gz
crawl-ref-aadcdbed9483b1efb141d9c8e49c375cbe4b831b.zip
Refix confusion resistance checks to include plants and zombies. For the
latter I added a check vs. undead holiness, but that may be (probably is) too general. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4634 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 4a1184fbc4..a9516af329 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -399,7 +399,10 @@ mon_holy_type mons_class_holiness(int mc)
bool mons_class_is_confusable(int mc)
{
- return (smc->resist_magic < MAG_IMMUNE);
+ return (smc->resist_magic < MAG_IMMUNE
+ && mons_holiness(mon) != MH_PLANT
+ && mons_holiness(mon) != MH_NONLIVING
+ && mons_holiness(mon) != MH_UNDEAD);
}
bool mons_class_is_slowable(int mc)
@@ -3398,7 +3401,6 @@ static bool _item_race_matches_monster(const item_def &item, monsters *mons)
&& mons_genus(mons->type) == MONS_ORC);
}
-// FIXME: Need monster body-size handling.
bool monsters::wants_armour(const item_def &item) const
{
// Returns whether this armour is the monster's size.
@@ -3463,8 +3465,7 @@ bool monsters::pickup_armour(item_def &item, int near, bool force)
if (!mslot_item(mslot) && newAC > 0)
return pickup(item, mslot, near);
- // XXX: Very simplistic armour evaluation (AC comparison) for the moment.
- // This should take resistances into account.
+ // XXX: Very simplistic armour evaluation (AC comparison).
if (const item_def *existing_armour = slot_item(eq))
{
if (!force)
@@ -3475,7 +3476,9 @@ bool monsters::pickup_armour(item_def &item, int near, bool force)
if (oldAC == newAC)
{
- // compare item value (uses resistances and such)
+ // Use shopping value as a crude estimate of resistances etc.
+ // XXX: This is not quite logical as many properties don't
+ // apply to monsters (e.g. levitation, blink, berserk).
int oldval = item_value(*existing_armour);
int newval = item_value(item);