summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-03 00:50:36 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-03 00:50:36 +0000
commitd719be7cf755b4f66081095ee769b22bb393a40e (patch)
treecda9ba92c73963d542110340e3c4f16dddf58bb0
parent1d715e59047e4c69d76fdca9976e850f0c57f9ed (diff)
downloadcrawl-ref-d719be7cf755b4f66081095ee769b22bb393a40e.tar.gz
crawl-ref-d719be7cf755b4f66081095ee769b22bb393a40e.zip
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
-rw-r--r--crawl-ref/source/monstuff.cc32
1 files changed, 14 insertions, 18 deletions
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;