From d719be7cf755b4f66081095ee769b22bb393a40e Mon Sep 17 00:00:00 2001 From: dolorous Date: Thu, 3 Jul 2008 00:50:36 +0000 Subject: Mark unreachable areas for pacified monsters in the right place. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6360 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/monstuff.cc | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 4064f13832..d2c9e490a7 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -3315,36 +3315,32 @@ static void _handle_behaviour(monsters *mon) if (need_target) { - // If a monster that's been pacified and is leaving - // the level can't reach its target, mark its target - // as unreachable. - if (isPacified) - { - e[e_index].unreachable = true; - mon->travel_target = MTRAV_NONE; - } - else - { - mon->target_x = 10 + random2(GXM - 10); - mon->target_y = 10 + random2(GYM - 10); - } + mon->target_x = 10 + random2(GXM - 10); + mon->target_y = 10 + random2(GYM - 10); } } - // During their wanderings, monsters will eventually relax their - // guard (stupid ones will do so faster, smart monsters have - // longer memories. + // During their wanderings, monsters will eventually relax + // their guard (stupid ones will do so faster, smart + // monsters have longer memories). Pacified monsters will + // also eventually switch the place from which they want to + // leave the level, in case their current choice is blocked. if (!proxFoe && mon->foe != MHITNOT - && one_chance_in( isSmart ? 60 : 20 )) + && one_chance_in(isSmart ? 60 : 20) + || isPacified && one_chance_in(isSmart ? 40 : 120)) { new_foe = MHITNOT; - if (travelling && mon->travel_target != MTRAV_PATROL) + if (travelling && mon->travel_target != MTRAV_PATROL + || isPacified) { #ifdef DEBUG_PATHFIND mpr("It's been too long! Stop travelling."); #endif mon->travel_path.clear(); mon->travel_target = MTRAV_NONE; + + if (isPacified && e_index != -1) + e[e_index].unreachable = true; } } break; -- cgit v1.2.3-54-g00ecf