From 6a52227c0b3e1ba387ebf8f76590042f2692ff68 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Sun, 25 Jan 2009 07:55:12 +0000 Subject: 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 --- crawl-ref/source/monstuff.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crawl-ref/source/monstuff.cc') 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; -- cgit v1.2.3-54-g00ecf