summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-22 13:19:54 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-22 13:19:54 +0000
commit2f0b704c918d91c1fccbb040dd1a472491b56ea8 (patch)
treebd729795b952652ca6e410c0482190af73291afc /crawl-ref/source
parenta12d1862eb07459daf4192933af0d84f6e3e0b83 (diff)
downloadcrawl-ref-2f0b704c918d91c1fccbb040dd1a472491b56ea8.tar.gz
crawl-ref-2f0b704c918d91c1fccbb040dd1a472491b56ea8.zip
Only force a moving monster to stay in the player's LOS if it just shouted,
as per Johanna's comments. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8696 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/monstuff.cc14
-rw-r--r--crawl-ref/source/view.cc2
2 files changed, 11 insertions, 5 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index e915034ebc..580bec1dcf 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -4777,12 +4777,14 @@ static void _handle_movement(monsters *monster)
if (crawl_state.arena)
return;
- // If the player can't see us it doesn't matter.
- if (!(monster->flags & MF_WAS_IN_VIEW))
+ // Did we just shout?
+ if (monster->seen_context != "just shouted")
return;
- // Only monsters seeking the player will shout.
- if (!mons_is_seeking(monster) || monster->foe != MHITYOU)
+ monster->seen_context.clear();
+
+ // If the player can't see us it doesn't matter.
+ if (!(monster->flags & MF_WAS_IN_VIEW))
return;
const coord_def old_pos = monster->pos();
@@ -4798,6 +4800,7 @@ static void _handle_movement(monsters *monster)
// Try to find a move that brings us closer to the player while keeping us
// in view.
+ int matches = 0;
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
{
@@ -4812,7 +4815,8 @@ static void _handle_movement(monsters *monster)
if (grid_distance(you.pos(), tmp) < old_dist && see_grid(tmp))
{
- mmov = delta;
+ if (one_chance_in(++matches))
+ mmov = delta;
break;
}
}
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index d155f10004..376017b82b 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -1196,6 +1196,8 @@ void handle_monster_shouts(monsters* monster, bool force)
const int noise_level = get_shout_noise_level(s_type);
if (noise_level > 0)
noisy(noise_level, monster->pos());
+
+ monster->seen_context = "just shouted";
}
#ifdef WIZARD