summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-act.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-07-14 19:39:44 -0400
committerNeil Moore <neil@s-z.org>2014-07-14 19:46:57 -0400
commitd3366e803b08706624eee4c4368abebb6c57100d (patch)
treec84caec65e78e28b39e45ec96a65ebbdde749cc8 /crawl-ref/source/mon-act.cc
parentacb6860397ceb554fb726fecdda2bbfb0233295f (diff)
downloadcrawl-ref-d3366e803b08706624eee4c4368abebb6c57100d.tar.gz
crawl-ref-d3366e803b08706624eee4c4368abebb6c57100d.zip
Don't make adjacent archers melee 1/9 of the time (#8795, Grunt)
They'll still switch to melee if they run out of ammo etc.
Diffstat (limited to 'crawl-ref/source/mon-act.cc')
-rw-r--r--crawl-ref/source/mon-act.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index 2787cb1c37..6b5101a22e 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -1545,24 +1545,27 @@ bool handle_throw(monster* mons, bolt & beem, bool teleport, bool check_only)
const bool liquefied = mons->liquefied_ground();
- // Highly-specialised archers are more likely to shoot than talk. (?)
- // If we're standing on liquefied ground, try to stand and fire!
- // (Particularly archers.)
- if (!teleport
- && ((liquefied && !archer && one_chance_in(9))
- || (!liquefied && one_chance_in(archer ? 9 : 5))))
- {
- return false;
- }
-
// Don't allow offscreen throwing for now.
if (mons->foe == MHITYOU && !mons_near(mons))
return false;
// Monsters won't shoot in melee range, largely for balance reasons.
// Specialist archers are an exception to this rule.
- if (!archer && adjacent(beem.target, mons->pos()))
+ if (adjacent(beem.target, mons->pos()))
+ {
+ if (!archer)
+ return false;
+ // If adjacent, archers should always shoot (otherwise they would
+ // try to melee). Hence the else if below.
+ }
+ else if (!teleport && ((liquefied && !archer && one_chance_in(9))
+ || (!liquefied && one_chance_in(archer ? 9 : 5))))
+ {
+ // Highly-specialised archers are more likely to shoot than talk.
+ // If we're standing on liquefied ground, try to stand and fire!
+ // (Particularly archers.)
return false;
+ }
// Don't let fleeing (or pacified creatures) stop to shoot at things
if (mons_is_fleeing(mons) || mons->pacified())