summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells1.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-03 16:17:52 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-03 16:17:52 +0000
commit5511b48771d9a12e3e622e375220091cf94023dd (patch)
treee5c031833bd5c88b0fbeb120667d66fc05a5e83b /crawl-ref/source/spells1.cc
parentae0c5cb4ea464e174d3ff287532d316d32b9df24 (diff)
downloadcrawl-ref-5511b48771d9a12e3e622e375220091cf94023dd.tar.gz
crawl-ref-5511b48771d9a12e3e622e375220091cf94023dd.zip
* Make movement restrictions when beheld also apply to blinking and
controlled teleport. * Highlight restricted grids when beheld (ASCII only): - main screen: restricted grids in LOS are darkgrey - X screen: unrestricted grids in view around the mermaid(s) are lightgrey * switch xx command back to leaving examine mode git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7105 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells1.cc')
-rw-r--r--crawl-ref/source/spells1.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 0ebd200152..65a83236b9 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -111,6 +111,29 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink)
return (-1); // early return {dlb}
}
+ if (!wizard_blink && you.duration[DUR_BEHELD])
+ {
+ bool blocked_movement = false;
+ for (unsigned int i = 0; i < you.beheld_by.size(); i++)
+ {
+ monsters& mon = menv[you.beheld_by[i]];
+ const int olddist = grid_distance(you.pos(), mon.pos());
+ const int newdist = grid_distance(beam.target, mon.pos());
+
+ if (olddist < newdist)
+ {
+ mprf("You cannot blink away from %s!",
+ mon.name(DESC_NOCAP_THE, true).c_str());
+
+ blocked_movement = true;
+ break;
+ }
+ }
+
+ if (blocked_movement)
+ continue;
+ }
+
// Wizard blink can move past translucent walls.
if (see_grid_no_trans(beam.target))
break;