summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-25 07:55:12 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-25 07:55:12 +0000
commit6a52227c0b3e1ba387ebf8f76590042f2692ff68 (patch)
treec8883801fbf5d1acb1bc179238be4409f450ec08 /crawl-ref/source/monstuff.cc
parent8370211096ebb78c16cd68b2297573ff3a7c4bc1 (diff)
downloadcrawl-ref-6a52227c0b3e1ba387ebf8f76590042f2692ff68.tar.gz
crawl-ref-6a52227c0b3e1ba387ebf8f76590042f2692ff68.zip
If a monster which is out of LOS of the player hears the player make a noise,
then make the monster move towards the player (if the player is within the monster's tracking range). Might want to make this the default behaviour of behaviour_event(mon, ME_ALERT, MHITYOU), rather than just for noises centered on the player. This doesn't change the behaviour of Projected Noise (unless the noise is centered on the player, since Projected Noise has a radius of 30 and shouting only 12). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8738 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 7ce9a04998..c6934a5945 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -78,6 +78,9 @@ static bool _is_trap_safe(const monsters *monster, const coord_def& where,
static bool _monster_move(monsters *monster);
static spell_type _map_wand_to_mspell(int wand_type);
+static bool _try_pathfind(monsters *mon, const dungeon_feature_type can_move,
+ bool potentially_blocking);
+
// [dshaligram] Doesn't need to be extern.
static coord_def mmov;
@@ -2555,6 +2558,17 @@ void behaviour_event(monsters *mon, int event, int src,
break;
mon->target = src_pos;
+
+ // XXX: Should this be done in _handle_behaviour()?
+ if (src == MHITYOU && src_pos == you.pos()
+ && !see_grid(mon->pos()))
+ {
+ const dungeon_feature_type can_move =
+ (mons_amphibious(mon)) ? DNGN_DEEP_WATER
+ : DNGN_SHALLOW_WATER;
+
+ _try_pathfind(mon, can_move, true);
+ }
}
break;