summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-29 03:21:19 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-29 03:21:19 +0000
commitf9bb873c8b6192688281a1d738c46d19352c8d51 (patch)
treec05695f2f500261faf50f5303599a7972bcabb48 /crawl-ref/source/directn.cc
parent7c4d30f73e1bdb25458fe7e274924e7d504a316e (diff)
downloadcrawl-ref-f9bb873c8b6192688281a1d738c46d19352c8d51.tar.gz
crawl-ref-f9bb873c8b6192688281a1d738c46d19352c8d51.zip
FR 2797173:
* When hovering the cursor/cross-hair over a visible monster which has a blocked line of fire, describe the monster as having a blocked line of fire. * If a player tracer beam is fired at a visble monster or square which has a blocked line of fire, warn the player about it and allow the player to cancel. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9845 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r--crawl-ref/source/directn.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 5f6aa57fc9..7959b19807 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -958,7 +958,8 @@ bool _dist_ok(const dist& moves, int range, targ_mode_type mode,
return (true);
}
-static bool _blocked_ray(const coord_def &where)
+static bool _blocked_ray(const coord_def &where,
+ dungeon_feature_type* feat = NULL)
{
ray_def ray;
find_ray(you.pos(), where, true, ray, 0, true);
@@ -967,7 +968,11 @@ static bool _blocked_ray(const coord_def &where)
while (ray.pos() != where)
{
if (grd(ray.pos()) <= DNGN_MINMOVE)
+ {
+ if (feat != NULL)
+ *feat = grd(ray.pos());
return (true);
+ }
ray.advance_through(where);
}
return (false);
@@ -3114,6 +3119,16 @@ static std::string _get_monster_desc(const monsters *mon)
else if (mons_enslaved_soul(mon))
text += pronoun + " is a disembodied soul.\n";
+ dungeon_feature_type blocking_feat;
+ if (_blocked_ray(mon->pos(), &blocking_feat))
+ {
+ text += "Your line of fire to " + lowercase_string(pronoun)
+ + " is blocked by "
+ + feature_description(blocking_feat, NUM_TRAPS, false,
+ DESC_NOCAP_A)
+ + "\n";
+ }
+
text += _mon_enchantments_string(mon);
return text;
}