diff options
author | Raphael Langella <raphael.langella@gmail.com> | 2012-08-29 15:28:56 +0200 |
---|---|---|
committer | Raphael Langella <raphael.langella@gmail.com> | 2012-08-29 15:49:32 +0200 |
commit | a966225517d6279369af199c9ff9c48b085a7a32 (patch) | |
tree | 1e361c99253ab96977e738ac924b3704b4c5798a /crawl-ref/source/mon-movetarget.cc | |
parent | 48d7effa1ce325c579685654be5fd325eb42d7ef (diff) | |
download | crawl-ref-a966225517d6279369af199c9ff9c48b085a7a32.tar.gz crawl-ref-a966225517d6279369af199c9ff9c48b085a7a32.zip |
Prevent friendly summons from attacking out of LOS.
For a summon to be able to attack a target (by whatever mean), both it and
its target needs to be in LOS of the player. It doesn't have to be actually
visible, but it cannot be behind glass (the check is cell_see_cell_no_trans).
Aditionally, wandering friendly summons will try to stay in sight of the
player.
Diffstat (limited to 'crawl-ref/source/mon-movetarget.cc')
-rw-r--r-- | crawl-ref/source/mon-movetarget.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-movetarget.cc b/crawl-ref/source/mon-movetarget.cc index 10f33341c7..613cc2171a 100644 --- a/crawl-ref/source/mon-movetarget.cc +++ b/crawl-ref/source/mon-movetarget.cc @@ -836,6 +836,9 @@ void set_random_target(monster* mon) if (!in_bounds(newtarget)) continue; + if (!summon_can_attack(mon, newtarget)) + continue; + mon->target = newtarget; break; } |