summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2009-11-11 17:02:45 +0100
committerAdam Borowski <kilobyte@angband.pl>2009-11-12 00:58:16 +0100
commitc8f280dbc8c22e355c7536ad17f39766c8264ec3 (patch)
treecb8872eb0536efd8a09e5e3964ef42dcbc8c1799 /crawl-ref/source/item_use.cc
parente188af641bc594cd0aa025e81cd0a4d309b8a938 (diff)
downloadcrawl-ref-c8f280dbc8c22e355c7536ad17f39766c8264ec3.tar.gz
crawl-ref-c8f280dbc8c22e355c7536ad17f39766c8264ec3.zip
Crossbows of shocking, for everyone. Launchers of holy wrath, for dpeg's angels.
Neither cause additional mulching of ammo, since both the charge and blessing is temporary. Blessing and reaping cancel each other. Holy wrath launchers are a lot weaker than silver ammo, but these two stack. Plus, they're permanent while ammo is scarce.
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc55
1 files changed, 54 insertions, 1 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 60e172f553..6d132baa5c 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1898,6 +1898,39 @@ static bool _dispersal_hit_victim(bolt& beam, actor* victim, int dmg,
return (true);
}
+static bool _charged_hit_victim(bolt &beam, actor* victim, int &dmg,
+ std::string &dmg_msg)
+{
+ if (victim->airborne() || victim->res_elec() > 0 || !one_chance_in(3))
+ return (false);
+
+ dmg += 10 + random2(15);
+
+ if (!beam.is_tracer && you.can_see(victim))
+ if (victim->atype() == ACT_PLAYER)
+ dmg_msg = "You are electrocuted!";
+ else
+ dmg_msg = "There is a sudden explosion of sparks!";
+ // TODO: lightning discharge into water
+
+ return (false);
+}
+
+static bool _blessed_hit_victim(bolt &beam, actor* victim, int &dmg,
+ std::string &dmg_msg)
+{
+ if (victim->undead_or_demonic())
+ {
+ dmg += 1 + (random2(dmg * 15) / 10);
+
+ if (!beam.is_tracer && you.can_see(victim))
+ dmg_msg = victim->name(DESC_CAP_THE) + " "
+ + victim->conj_verb("convulse") + "!";
+ }
+
+ return (false);
+}
+
bool setup_missile_beam(const actor *agent, bolt &beam, item_def &item,
std::string &ammo_name, bool &returning)
{
@@ -1996,7 +2029,11 @@ bool setup_missile_beam(const actor *agent, bolt &beam, item_def &item,
const bool silver = (ammo_brand == SPMSL_SILVER);
const bool disperses = (ammo_brand == SPMSL_DISPERSAL);
const bool reaping = (bow_brand == SPWPN_REAPING
- || ammo_brand == SPMSL_REAPING);
+ || ammo_brand == SPMSL_REAPING)
+ && bow_brand != SPWPN_HOLY_WRATH;
+ const bool charged = bow_brand == SPWPN_ELECTROCUTION;
+ const bool blessed = bow_brand == SPWPN_HOLY_WRATH
+ && ammo_brand != SPMSL_REAPING;
ASSERT(!exploding || !is_artefact(item));
@@ -2065,6 +2102,10 @@ bool setup_missile_beam(const actor *agent, bolt &beam, item_def &item,
beam.hit_funcs.push_back(_reaping_hit_victim);
if (disperses)
beam.hit_funcs.push_back(_dispersal_hit_victim);
+ if (charged)
+ beam.damage_funcs.push_back(_charged_hit_victim);
+ if (blessed)
+ beam.damage_funcs.push_back(_blessed_hit_victim);
if (reaping && ammo.special != SPMSL_REAPING)
{
@@ -2096,6 +2137,18 @@ bool setup_missile_beam(const actor *agent, bolt &beam, item_def &item,
ammo_name = "silvery " + ammo_name;
}
+ if (charged)
+ {
+ beam.name = "charged " + beam.name;
+ ammo_name = "charged " + ammo_name;
+ }
+
+ if (blessed)
+ {
+ beam.name = "blessed " + beam.name;
+ ammo_name = "blessed " + ammo_name;
+ }
+
// Do this here so that we get all the name mods except for a
// redundant "exploding".
if (exploding)