summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/throw.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-01-22 22:06:56 -0700
committerSteve Melenchuk <smelenchuk@gmail.com>2014-01-22 22:06:56 -0700
commit934f89028ea657c131806b0c683771e182617a37 (patch)
tree5de9cd658f231f6c1ff764e0feb48717dfd12e68 /crawl-ref/source/throw.cc
parent317cdd5a35c0f4166581cb1254b176f4894cbb1d (diff)
downloadcrawl-ref-934f89028ea657c131806b0c683771e182617a37.tar.gz
crawl-ref-934f89028ea657c131806b0c683771e182617a37.zip
Trigger grand avatar on ranged attacks (tenofswords).
Also contains some merging of duplicate code.
Diffstat (limited to 'crawl-ref/source/throw.cc')
-rw-r--r--crawl-ref/source/throw.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/crawl-ref/source/throw.cc b/crawl-ref/source/throw.cc
index 9071e26990..15f172da88 100644
--- a/crawl-ref/source/throw.cc
+++ b/crawl-ref/source/throw.cc
@@ -37,6 +37,7 @@
#include "religion.h"
#include "shout.h"
#include "skills2.h"
+#include "spl-summoning.h"
#include "state.h"
#include "stuff.h"
#include "teleport.h"
@@ -2114,6 +2115,9 @@ bool mons_throw(monster* mons, bolt &beam, int msl)
mons->lose_energy(EUT_MISSILE);
const int throw_energy = mons->action_energy(EUT_MISSILE);
+ actor* victim = actor_at(beam.target);
+ const int old_hp = (victim) ? victim->stat_hp() : 0;
+
// Dropping item copy, since the launched item might be different.
item_def item = mitm[msl];
item.quantity = 1;
@@ -2454,6 +2458,14 @@ bool mons_throw(monster* mons, bolt &beam, int msl)
if (beam.special_explosion != NULL)
delete beam.special_explosion;
+ if (mons->has_ench(ENCH_GRAND_AVATAR))
+ {
+ // We want this to be a ranged attack, like the spell mirroring,
+ // so any spell that fires a battlesphere will do here.
+ // XXX: make triggering of this less hacky
+ trigger_grand_avatar(mons, victim, SPELL_MAGIC_DART, old_hp);
+ }
+
return true;
}