summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authorabrahamwl <abrahamwl@gmail.com>2009-10-27 22:04:57 -0700
committerAdam Borowski <kilobyte@angband.pl>2009-10-28 14:54:38 +0100
commit1cd5f5996970da48788b3bdc615652ed66763b70 (patch)
tree29022993b49c92c1c5070b4f9ecc02331f3688c3 /crawl-ref/source/beam.cc
parent67ab2ff904da3b6a3f426ee6d6a6b8e4116f199a (diff)
downloadcrawl-ref-1cd5f5996970da48788b3bdc615652ed66763b70.tar.gz
crawl-ref-1cd5f5996970da48788b3bdc615652ed66763b70.zip
Electrocution discharge in water ala FR 1637214
Weapons of electrocution now discharge in water, if the target is touching the water and not rElec, hitting all adjacent water-touching non-rElec creatures for about half the normal electrocution damage. Particularly notable new code is the implementation of an area-of-effect callback for beams, as well as a function and structure for weapon effects that should only happen after the target would have died, if it was going to die, and therefore cannot safely make use of its data. Issues that still need to be decided: - How doe Xom feel about this? (eg. If creatures hurt themselves this way.) - Should it ask you if you want to attack when you know the discharge will hit yourself?
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 89b038d6dd..9e2153d18c 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -5661,8 +5661,15 @@ void bolt::determine_affected_cells(explosion_map& m, const coord_def& delta,
if (feat_is_solid(dngn_feat) && !feat_is_wall(dngn_feat) && stop_at_statues)
return;
- // Hmm, I think we're OK.
- m(delta + centre) = std::min(count, m(delta + centre));
+ // Check if it passes the callback functions.
+ bool hits = true;
+ for (unsigned int i = 0; i < aoe_funcs.size(); ++i)
+ hits = (*aoe_funcs[i])(*this, loc) && hits;
+
+ if (hits) {
+ // Hmm, I think we're OK.
+ m(delta + centre) = std::min(count, m(delta + centre));
+ }
// Now recurse in every direction.
for (int i = 0; i < 8; ++i)
@@ -5785,7 +5792,7 @@ bolt::bolt() : range(-2), type('*'),
is_explosion(false), is_big_cloud(false), aimed_at_spot(false),
aux_source(), affects_nothing(false), affects_items(true),
effect_known(true), draw_delay(15), special_explosion(NULL),
- range_funcs(), damage_funcs(), hit_funcs(),
+ range_funcs(), damage_funcs(), hit_funcs(), aoe_funcs(),
obvious_effect(false), seen(false), path_taken(), range_used(0),
is_tracer(false), aimed_at_feet(false), msg_generated(false),
passed_target(false), in_explosion_phase(false),