summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/view.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-28 08:05:03 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-28 08:05:03 +0000
commit6977f25bb9ee1dca2c7d3947da850bd1226d6dc9 (patch)
tree8e3434831f3eb078169a2c740fa0b540aaa0fac2 /crawl-ref/source/view.cc
parent7aff33edc63728798297f82e51437cdbf556d5b9 (diff)
downloadcrawl-ref-6977f25bb9ee1dca2c7d3947da850bd1226d6dc9.tar.gz
crawl-ref-6977f25bb9ee1dca2c7d3947da850bd1226d6dc9.zip
Modify mon_enemies_around() logic to allow friends to also cast spells
if they have a foe but you don't, i.e. if their foe is out of your LOS. Don't allow patrolling to a target grid that is occupied by a monster in case it's a stationary monster (plant or sleeping). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5311 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/view.cc')
-rw-r--r--crawl-ref/source/view.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 86e18f81bf..b44b8588e5 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -3611,10 +3611,21 @@ bool mons_near(const monsters *monster, unsigned int foe)
bool mon_enemies_around(const monsters *monster)
{
+ // If the monster has a foe, return true.
+ if (monster->foe != MHITNOT && monster->foe != MHITYOU)
+ return (true);
+
if (mons_friendly(monster))
- return (!mons_near(monster) || !i_feel_safe());
+ {
+ // Additionally, if an ally is nearby and *you* have a foe, consider
+ // it as the ally's enemy too.
+ return (mons_near(monster) && !i_feel_safe());
+ }
else
+ {
+ // For hostile monsters *you* are the main enemy.
return (mons_near(monster));
+ }
}
bool see_grid( const env_show_grid &show,