summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-26 06:28:31 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-26 06:28:31 +0000
commitdb4441f34f048c26426a835731d4fac7fa90a02a (patch)
tree34beb80f3b478ef906fe041263b631eb29344be5 /crawl-ref/source/beam.cc
parentab2a95081c9a02d5ffaf6349db865938a7f90a3d (diff)
downloadcrawl-ref-db4441f34f048c26426a835731d4fac7fa90a02a.tar.gz
crawl-ref-db4441f34f048c26426a835731d4fac7fa90a02a.zip
Fix explosions not affecting the right grids and exploding inside walls.
Don't finish beam if it's reflected by a monster. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7978 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index f28bde46e5..db53a28b74 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1764,6 +1764,9 @@ void bolt::hit_wall()
do {
ray.regress();
} while (ray.pos() != source && grid_is_solid(ray.pos()));
+ // target is where the explosion is centered, so update it.
+ if (is_explosion)
+ target = ray.pos();
}
finish_beam();
}
@@ -3445,8 +3448,7 @@ bool bolt::misses_player()
return (false);
}
-void bolt::affect_player_enchantment()
-{
+void bolt::affect_player_enchantment() {
if ((has_saving_throw() || flavour == BEAM_POLYMORPH)
&& you_resist_magic(ench_power))
{
@@ -4279,12 +4281,14 @@ bool bolt::attempt_block(monsters* mon)
reflect();
}
else
+ {
mprf("%s blocks the %s.",
mon->name(DESC_CAP_THE).c_str(),
name.c_str());
+ finish_beam();
+ }
mon->shield_block_succeeded();
- finish_beam();
}
}
@@ -5087,7 +5091,7 @@ bool bolt::explode(bool show_more, bool hole_in_the_middle)
ASSERT(!in_explosion_phase);
ASSERT(ex_size > 0);
- real_flavour = flavour;
+ flavour = real_flavour;
const int r = std::min(ex_size, MAX_EXPLOSION_RADIUS);
in_explosion_phase = true;
@@ -5206,10 +5210,16 @@ void bolt::explosion_draw_cell(const coord_def& p)
void bolt::explosion_affect_cell(const coord_def& p)
{
+ // pos() = target during an explosion, so restore it after affecting
+ // the cell.
+ const coord_def orig_pos = target;
+
fake_flavour();
target = p;
affect_cell();
flavour = real_flavour;
+
+ target = orig_pos;
}
// Uses DFS