From 6977f25bb9ee1dca2c7d3947da850bd1226d6dc9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Wed, 28 May 2008 08:05:03 +0000 Subject: 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 --- crawl-ref/source/view.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/view.cc') 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, -- cgit v1.2.3-54-g00ecf