summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-22 11:17:11 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-22 11:17:11 +0000
commit50dd7b84736b4c1c87908cae1030419f773e638d (patch)
treeb694a983e57a8a5a28925961208b3091cf55462b /crawl-ref
parentbf946a85fe99dda39802fd242474264101ddd14f (diff)
downloadcrawl-ref-50dd7b84736b4c1c87908cae1030419f773e638d.tar.gz
crawl-ref-50dd7b84736b4c1c87908cae1030419f773e638d.zip
For [2625984], disallow caught monsters from submerging.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9147 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/mon-util.cc2
-rw-r--r--crawl-ref/source/monstuff.cc17
-rw-r--r--crawl-ref/source/tiles.h2
3 files changed, 10 insertions, 11 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 0d679856c9..5fd8269d1c 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -6548,7 +6548,7 @@ static bool _prepare_del_ench(monsters* mon, const mon_enchant &me)
coord_def target_square;
int okay_squares = 0;
- for ( adjacent_iterator ai; ai; ++ai )
+ for (adjacent_iterator ai; ai; ++ai)
if (mgrd(*ai) == NON_MONSTER && *ai != you.pos()
&& monster_can_submerge(mon, grd(*ai))
&& one_chance_in(++okay_squares))
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index e94825f761..17be1297f9 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5117,6 +5117,7 @@ static void _handle_nearby_ability(monsters *monster)
// Okay then, don't speak.
if (monster_can_submerge(monster, grd(monster->pos()))
+ && !monster->caught() // No submerging while caught.
&& !player_mesmerised_by(monster) // No submerging if player entranced.
&& !mons_is_lurking(monster) // Handled elsewhere.
&& monster->wants_submerge())
@@ -7061,6 +7062,7 @@ static void _handle_monster_move(monsters *monster)
// Submerging monsters will hide from clouds.
if (avoid_cloud
&& monster_can_submerge(monster, grd(monster->pos()))
+ && !monster->caught()
&& !monster->submerged())
{
monster->add_ench(ENCH_SUBMERGED);
@@ -8186,18 +8188,15 @@ static bool _monster_move(monsters *monster)
if (mons_is_submerged(monster))
return (false);
- // Trapdoor spiders hide if they can't see their target.
- bool can_see;
-
- if (monster->foe == MHITNOT)
- can_see = false;
- else if (monster->foe == MHITYOU)
- can_see = monster->can_see(&you);
- else
- can_see = monster->can_see(&menv[monster->foe]);
+ // Trapdoor spiders hide if they can't see their foe.
+ // (Note that friendly trapdoor spiders will thus hide even
+ // if they can see you.)
+ const actor *foe = monster->get_foe();
+ const bool can_see = foe && monster->can_see(foe);
if (monster_can_submerge(monster, grd(monster->pos()))
&& !can_see && !mons_is_confused(monster)
+ && !monster->caught()
&& !monster->has_ench(ENCH_BERSERK))
{
monster->add_ench(ENCH_SUBMERGED);
diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h
index 38f0f8d2de..a9712379ea 100644
--- a/crawl-ref/source/tiles.h
+++ b/crawl-ref/source/tiles.h
@@ -208,5 +208,5 @@ enum
TILE_Y = 32
};
-#endif // USE_TILES
+#endif
#endif