From 414b1c3e9ebefcc08531c15a2f3aa53fedcb31ef Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sat, 26 Dec 2009 16:39:47 +0100 Subject: 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. --- crawl-ref/source/beam.cc | 50 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 36 deletions(-) (limited to 'crawl-ref/source/beam.cc') 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())) -- cgit v1.2.3-54-g00ecf