summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.h
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-14 12:00:48 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-14 12:00:48 +0000
commit85e11d2d3c892c2ffcd53b0bf55c0e83ce13fb9d (patch)
treec3a0a555a4e2e046ac138f75f1c3bfd76c4357f9 /crawl-ref/source/beam.h
parentb83cbbcaed12c8df8422b0fda6465189757ce1c9 (diff)
downloadcrawl-ref-85e11d2d3c892c2ffcd53b0bf55c0e83ce13fb9d.tar.gz
crawl-ref-85e11d2d3c892c2ffcd53b0bf55c0e83ce13fb9d.zip
Implented some ranged brands from FR #2006917 and #1891231: shadow and
penetration (not phasing) for launchers and shadow, penetration, dispersal, exploding, steel and silver for ammo. Never randomly generated. If a launcher of venom is used to launch flame or ice ammo then the resulting bolt will be poisoned, just like poisoned ammo launched from a launcer of flame or frost. Put missile beam setup code that's common to monsters and the player in setup_missile_beam(). Removed mons_thrown_object_destroyed(), thrown_object_destroyed() is now used for both monsters and the player. The bolt struct has several new callback fields that can be set to alter the beam's behaviour; currently only used by the brands implemented in this commit, but they should be general enough to be used by anything. The bolt struct has the new field "special_explosion" which can be used to cause an explosion with flavour and/or damage dice different than the rest of the beam. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8449 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.h')
-rw-r--r--crawl-ref/source/beam.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index 924e1cd7c4..48e77b0dd4 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -46,8 +46,19 @@ struct tracer_info
tracer_info();
void reset();
+
+ const tracer_info &operator += (const tracer_info &other);
};
+struct bolt;
+
+typedef bool (*range_used_func)(const bolt& beam, const actor* victim,
+ int &used);
+typedef bool (*beam_damage_func)(bolt& beam, actor* victim, int &dmg,
+ std::string &dmg_msg);
+typedef bool (*beam_hit_func)(bolt& beam, actor* victim, int dmg,
+ int corpse);
+
struct bolt
{
// INPUT parameters set by caller
@@ -82,6 +93,15 @@ struct bolt
int draw_delay; // delay used when drawing beam.
+ bolt* special_explosion; // For exploding with a different
+ // flavour/damage/etc than the beam
+ // itself.
+
+ // Various callbacks.
+ std::vector<range_used_func> range_funcs;
+ std::vector<beam_damage_func> damage_funcs;
+ std::vector<beam_hit_func> hit_funcs;
+
// OUTPUT parameters (tracing, ID)
bool obvious_effect; // did an 'obvious' effect happen?
@@ -173,7 +193,7 @@ private:
bool found_player() const;
int beam_source_as_target() const;
- int range_used_on_hit() const;
+ int range_used_on_hit(const actor* victim) const;
std::string zapper() const;
@@ -182,6 +202,10 @@ private:
void step();
void hit_wall();
+ bool apply_hit_funcs(actor* victim, int dmg, int corpse = -1);
+ bool apply_dmg_funcs(actor* victim, int &dmg,
+ std::vector<std::string> &messages);
+
// Functions which handle actually affecting things. They all
// operate on the beam's current position (i.e., whatever pos()
// returns.)
@@ -209,7 +233,8 @@ public:
void update_hurt_or_helped(monsters *mon);
bool attempt_block(monsters* mon);
void handle_stop_attack_prompt(monsters* mon);
- bool determine_damage(monsters* mon, int& preac, int& postac, int& final);
+ bool determine_damage(monsters* mon, int& preac, int& postac, int& final,
+ std::vector<std::string> &messages);
void monster_post_hit(monsters* mon, int dmg);
bool misses_player();