summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-act.cc
diff options
context:
space:
mode:
authorJohanna Ploog <j-p-e-g@users.sourceforge.net>2010-01-13 13:40:41 +0100
committerJohanna Ploog <j-p-e-g@users.sourceforge.net>2010-01-13 15:52:25 +0100
commit598f36ee1bca9a725456665c8d0f999851fb96de (patch)
tree1ba732216c4a98a079bf221a8d4fae134025b85e /crawl-ref/source/mon-act.cc
parented8f8e0dbefef13fc35572729c5f6b5cf70ebc1b (diff)
downloadcrawl-ref-598f36ee1bca9a725456665c8d0f999851fb96de.tar.gz
crawl-ref-598f36ee1bca9a725456665c8d0f999851fb96de.zip
Don't allow spellcasters to throw items at you.
I had two orc priests throw their spears at me instead of smiting me. Monsters with a ranged attack were prevented from picking up missiles but not from throwing their melee weapons. If we want e.g. mermaids to be able to throw stuff at the player, we will have to tweak the check to ignore some los abilities.
Diffstat (limited to 'crawl-ref/source/mon-act.cc')
-rw-r--r--crawl-ref/source/mon-act.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index bc15130cc4..da7b274724 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -1461,7 +1461,7 @@ static bool _handle_throw(monsters *monster, bolt & beem)
return (false);
const bool archer = mons_class_flag(monster->type, M_ARCHER);
- // Highly-specialised archers are more likely to shoot than talk.
+ // Highly-specialised archers are more likely to shoot than talk. (?)
if (one_chance_in(archer? 9 : 5))
return (false);
@@ -1474,6 +1474,10 @@ static bool _handle_throw(monsters *monster, bolt & beem)
if (!archer && adjacent(beem.target, monster->pos()))
return (false);
+ // If the monster is a spellcaster, don't bother throwing stuff.
+ if (mons_has_ranged_spell(monster, true, false))
+ return (false);
+
// Greatly lowered chances if the monster is fleeing or pacified and
// leaving the level.
if ((mons_is_fleeing(monster) || monster->pacified())