summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-12-26 16:39:47 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-12-26 16:45:10 +0100
commit414b1c3e9ebefcc08531c15a2f3aa53fedcb31ef (patch)
tree5f9e83dcaa26141f0ddf92cd099ab83ff1ba55d1 /crawl-ref/source/beam.cc
parente5e6474f335d47ce81f0d33d5adf95b4dd64ba46 (diff)
downloadcrawl-ref-414b1c3e9ebefcc08531c15a2f3aa53fedcb31ef.tar.gz
crawl-ref-414b1c3e9ebefcc08531c15a2f3aa53fedcb31ef.zip
Revert beams to not affect the source cell.
The change was originally done to allow hostile oklobs to target the player if he happens to be standing in the same cell, but they appear to do that successfully regardless. Fixes issue #133, issue #246.
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc50
1 files changed, 14 insertions, 36 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 2888e091c0..cdeefc8204 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1995,7 +1995,7 @@ bool bolt::hit_wall()
return (false);
}
-void bolt::affect_cell(bool avoid_self)
+void bolt::affect_cell()
{
// Shooting through clouds affects accuracy.
if (env.cgrid(pos()) != EMPTY_CLOUD)
@@ -2006,25 +2006,14 @@ void bolt::affect_cell(bool avoid_self)
const coord_def old_pos = pos();
const bool was_solid = feat_is_solid(grd(pos()));
- bool avoid_monster = false;
- bool avoid_player = false;
-
- if (avoid_self)
- {
- if (YOU_KILL(thrower))
- avoid_player = true;
- else if (MON_KILL(thrower))
- avoid_monster = true;
- }
-
if (was_solid)
{
// Some special casing.
if (monsters* mon = monster_at(pos()))
{
- if (can_affect_wall_monster(mon) && !avoid_monster)
+ if (can_affect_wall_monster(mon))
affect_monster(mon);
- else if (!avoid_monster)
+ else
{
mprf("The %s protects %s from harm.",
raw_feature_description(grd(mon->pos())).c_str(),
@@ -2040,26 +2029,19 @@ void bolt::affect_cell(bool avoid_self)
return;
}
- const bool still_wall = (was_solid && old_pos == pos());
-
- bool hit_player = false;
// If the player can ever walk through walls, this will need
// special-casing too.
- if (found_player() && !avoid_player)
- {
+ bool hit_player = found_player();
+ if (hit_player)
affect_player();
- hit_player = true;
- }
- // We don't want to hit a monster in a wall square twice. Also,
+ // We don't want to hit a monster in a wall square twice. Also,
// stop single target beams from affecting a monster if they already
// affected the player on this square. -cao
- if ((!hit_player || is_beam || is_explosion)
- && !still_wall && !avoid_monster)
- {
- if (monsters* m = monster_at(pos()) )
+ const bool still_wall = (was_solid && old_pos == pos());
+ if ((!hit_player || is_beam || is_explosion) && !still_wall)
+ if (monsters* m = monster_at(pos()))
affect_monster(m);
- }
if (!feat_is_solid(grd(pos())))
affect_ground();
@@ -2167,12 +2149,12 @@ void bolt::do_fire()
}
#endif
- bool avoid_self = (!aimed_at_feet && (!is_explosion || !in_explosion_phase));
-
msg_generated = false;
if (!aimed_at_feet)
{
choose_ray();
+ // Take *one* step, so as not to hurt the source.
+ ray.advance();
}
#if defined(TARGET_OS_WINDOWS) && !defined(USE_TILE)
@@ -2187,11 +2169,9 @@ void bolt::do_fire()
path_taken.push_back(pos());
if (!affects_nothing)
- affect_cell(avoid_self);
-
- if (!avoid_self)
- range_used++;
+ affect_cell();
+ range_used++;
if (range_used >= range)
break;
@@ -2205,7 +2185,7 @@ void bolt::do_fire()
break;
}
- ASSERT((!feat_is_solid(grd(pos())) || avoid_self)
+ ASSERT(!feat_is_solid(grd(pos()))
|| is_tracer && affects_wall(grd(pos())));
const bool was_seen = seen;
@@ -2228,8 +2208,6 @@ void bolt::do_fire()
draw(pos());
ray.advance();
-
- avoid_self = false;
}
if (!map_bounds(pos()))