summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-16 22:34:12 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-16 22:52:01 +0100
commitaf5c601305bfdb1a1327156e9c8f1980f83d34d5 (patch)
tree50fe9e0337662897c29374900dee0c07129b63c3 /crawl-ref/source/directn.cc
parent5c93440b007ff9e1948fab8761517fccf1046fc9 (diff)
downloadcrawl-ref-af5c601305bfdb1a1327156e9c8f1980f83d34d5.tar.gz
crawl-ref-af5c601305bfdb1a1327156e9c8f1980f83d34d5.zip
Expose invisible monsters in opaque clouds.
Implements FR 2898414.
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r--crawl-ref/source/directn.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index fc9df131e7..a609856b88 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -311,6 +311,21 @@ static bool _mon_submerged_in_water(const monsters *mon)
&& !mons_flies(mon));
}
+static bool _mon_exposed_in_cloud(const monsters *mon)
+{
+ if (!mon)
+ return (false);
+
+ return (!mon->visible_to(&you)
+ && is_opaque_cloud(env.cgrid(mon->pos()))
+ && !mons_is_insubstantial(mon->type));
+}
+
+static bool _mon_exposed(const monsters* mon)
+{
+ return (_mon_submerged_in_water(mon) || _mon_exposed_in_cloud(mon));
+}
+
static bool _is_target_in_range(const coord_def& where, int range)
{
// Range doesn't matter.
@@ -1391,7 +1406,7 @@ void direction(dist& moves, targetting_type restricts,
if (!moves.isEndpoint)
{
const monsters* m = monster_at(moves.target);
- if (m && _mon_submerged_in_water(m))
+ if (m && _mon_exposed(m))
moves.isEndpoint = true;
}
moves.isValid = true;
@@ -1931,7 +1946,7 @@ static bool _mons_is_valid_target(const monsters *mon, int mode, int range)
// Also, don't target submerged monsters if there are other
// targets in sight. (This might be too restrictive.)
return (mode != TARG_FRIEND
- && _mon_submerged_in_water(mon)
+ && _mon_exposed(mon)
&& i_feel_safe(false, false, true, range));
}
@@ -3345,6 +3360,11 @@ static void _describe_cell(const coord_def& where, bool in_range)
mpr("There is a strange disturbance in the water here.",
MSGCH_EXAMINE_FILTER);
}
+ else if (_mon_exposed_in_cloud(mon))
+ {
+ mpr("There is a strange disturbance in the cloud here.",
+ MSGCH_EXAMINE_FILTER);
+ }
#if DEBUG_DIAGNOSTICS
if (!mon->visible_to(&you))