diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-08-06 11:10:51 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-08-06 11:10:51 +0000 |
commit | 1116bae0494365140bb5c3873b0420090a9e7a51 (patch) | |
tree | 7c52b51f42659faf6102f0da282d032dbc02393b /crawl-ref/source/spells4.cc | |
parent | ad1ea33511379e75b2141b34eb316e76db05f057 (diff) | |
download | crawl-ref-1116bae0494365140bb5c3873b0420090a9e7a51.tar.gz crawl-ref-1116bae0494365140bb5c3873b0420090a9e7a51.zip |
Fix semicontrolled blink [2038476].
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6781 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells4.cc')
-rw-r--r-- | crawl-ref/source/spells4.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 1a32c331b8..248229f269 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -2464,7 +2464,9 @@ static int _quadrant_blink(coord_def where, int pow, int garbage) pow = 100; const int dist = random2(6) + 2; // 2-7 - coord_def orig = you.pos() + (where - you.pos()) * dist; + + // This is where you would *like* to go. + const coord_def base = you.pos() + (where - you.pos()) * dist; // This can take a while if pow is high and there's lots of translucent // walls nearby. @@ -2472,17 +2474,17 @@ static int _quadrant_blink(coord_def where, int pow, int garbage) bool found = false; for ( int i = 0; i < (pow*pow) / 500 + 1; ++i ) { - // Find a space near our target... - // First try to find a random square not adjacent to the player, + // Find a space near our base point... + // First try to find a random square not adjacent to the basepoint, // then one adjacent if that fails. - if (!random_near_space(orig, target) - && !random_near_space(orig, target, true)) + if (!random_near_space(base, target) + && !random_near_space(base, target, true)) { return 0; } - // ... which is close enough, and also far enough from us. - if (distance(orig, target) > 10 && distance(you.pos(), target) < 8) + // ... which is close enough, but also far enough from us. + if (distance(base, target) > 10 || distance(you.pos(), target) < 8) continue; if (!see_grid_no_trans(target)) |