summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabrahamwl <abrahamwl@gmail.com>2009-10-28 11:02:12 -0700
committerAdam Borowski <kilobyte@angband.pl>2009-10-28 19:07:59 +0100
commit06bf811e45f13eddea2dd1c1f4b3554c68e09553 (patch)
tree5476c6b283ec1cf705ed46041d80f71ba57836fa
parent4e14802376eeb4770861592e171b9b8dcedacb16 (diff)
downloadcrawl-ref-06bf811e45f13eddea2dd1c1f4b3554c68e09553.tar.gz
crawl-ref-06bf811e45f13eddea2dd1c1f4b3554c68e09553.zip
Beams can be assigned custom hit verbs now
If a beam is not, old behavior is default.
-rw-r--r--crawl-ref/source/beam.cc18
-rw-r--r--crawl-ref/source/beam.h4
-rw-r--r--crawl-ref/source/effects.cc7
3 files changed, 20 insertions, 9 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 9e2153d18c..fff34b7ecb 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3953,9 +3953,12 @@ void bolt::affect_player()
if (misses_player())
return;
- const bool engulfs = (is_explosion || is_big_cloud);
- mprf("The %s %s you!",
- name.c_str(), engulfs ? "engulfs" : "hits");
+ const bool engulfs = is_explosion || is_big_cloud;
+ if (hit_verb.empty())
+ {
+ hit_verb = engulfs ? "engulfs" : "hits";
+ }
+ mprf("The %s %s you!", name.c_str(), hit_verb.c_str());
// FIXME: Lots of duplicated code here (compare handling of
// monsters)
@@ -4736,9 +4739,14 @@ void bolt::affect_monster(monsters* mon)
// The beam hit.
if (mons_near(mon))
{
+ if (hit_verb.empty())
+ {
+ hit_verb = (is_explosion || is_big_cloud)
+ ? "engulfs" : "hits";
+ }
mprf("The %s %s %s.",
name.c_str(),
- engulfs ? "engulfs" : "hits",
+ hit_verb.c_str(),
you.can_see(mon) ?
mon->name(DESC_NOCAP_THE).c_str() : "something");
@@ -5788,7 +5796,7 @@ bolt::bolt() : range(-2), type('*'),
flavour(BEAM_MAGIC), real_flavour(BEAM_MAGIC), drop_item(false),
item(NULL), source(), target(), damage(0, 0),
ench_power(0), hit(0), thrower(KILL_MISC), ex_size(0),
- beam_source(MHITNOT), name(), short_name(), is_beam(false),
+ beam_source(MHITNOT), name(), short_name(), hit_verb(), is_beam(false),
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),
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index 281641cf90..f9103d8924 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -83,6 +83,10 @@ struct bolt
int beam_source; // NON_MONSTER or monster index #
std::string name;
std::string short_name;
+ std::string hit_verb; // The verb to use when this beam hits
+ // something. If not set, will use
+ // "engulfs" if an explosion or cloud
+ // and "hits" otherwise.
bool is_beam; // beams? (can hits multiple targets?)
bool is_explosion;
bool is_big_cloud; // expands into big_cloud at endpoint
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 6dc8b2dbcf..6d53393bbd 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -408,8 +408,6 @@ static bool _conduct_electricity_aoe(bolt& beam, const coord_def& target)
void conduct_electricity(coord_def where, actor *attacker)
{
- const char *aux = "arcing electricity";
-
bolt beam;
beam.flavour = BEAM_ELECTRICITY;
@@ -417,8 +415,9 @@ void conduct_electricity(coord_def where, actor *attacker)
beam.damage = dice_def(1, 15);
beam.target = where;
beam.name = "electric current";
- beam.colour = LIGHTCYAN;
- beam.aux_source = aux;
+ beam.hit_verb = "shocks";
+ beam.colour = ETC_ELECTRICITY;
+ beam.aux_source = "arcing electricity";
beam.ex_size = 1;
beam.is_explosion = true;
beam.effect_known = true;