diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-05-29 03:21:19 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-05-29 03:21:19 +0000 |
commit | f9bb873c8b6192688281a1d738c46d19352c8d51 (patch) | |
tree | c05695f2f500261faf50f5303599a7972bcabb48 /crawl-ref/source/beam.cc | |
parent | 7c4d30f73e1bdb25458fe7e274924e7d504a316e (diff) | |
download | crawl-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/beam.cc')
-rw-r--r-- | crawl-ref/source/beam.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 5f86991643..78cd63f25e 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -1792,6 +1792,41 @@ void bolt::hit_wall() const dungeon_feature_type feat = grd(pos()); ASSERT( grid_is_solid(feat) ); + if (is_tracer && YOU_KILL(thrower) && flavour != BEAM_DIGGING + && flavour <= BEAM_LAST_REAL && pos() != target && pos() != source + && !affects_nothing && bounces == 0 && reflections == 0 + && see_grid(target) && !grid_is_solid(grd(target))) + { + // Okay, with all those tests passed, this is probably an instance + // of the player manually targetting something whose line of fire + // is blocked, even though its line of sight isn't blocked. Give + // a warning about this fact. + std::string prompt = "Your line of fire to "; + const monsters* mon = monster_at(target); + + if (mon && you.can_see(mon)) + prompt += mon->name(DESC_NOCAP_THE); + else + { + prompt += "the targeted " + + feature_description(target, false, DESC_PLAIN, false); + } + + prompt += " is blocked by " + + feature_description(pos(), false, DESC_NOCAP_A, false); + + prompt += ". Continue anyway?"; + + if (!yesno(prompt.c_str(), false, 'n')) + { + beam_cancelled = true; + finish_beam(); + return; + } + + // Well, we warned them. + } + if (affects_wall(feat)) affect_wall(); else if (is_bouncy(feat) && !in_explosion_phase) |