summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells4.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-08 00:50:13 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-08 00:50:13 +0000
commit78d87483db31afeb1848e9e47b4b46f35fdcca90 (patch)
tree1bdfab051360ad836cd0e567bc6a835728675f15 /crawl-ref/source/spells4.cc
parentd419d7dc79e02aafe700dcccba8638975a4cd2e7 (diff)
downloadcrawl-ref-78d87483db31afeb1848e9e47b4b46f35fdcca90.tar.gz
crawl-ref-78d87483db31afeb1848e9e47b4b46f35fdcca90.zip
Fix _player_hurt_monster() to handle things properly if the monster
avoided death. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8968 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells4.cc')
-rw-r--r--crawl-ref/source/spells4.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 8315ed4580..ef1c31ffb9 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -75,15 +75,21 @@ static bool _player_hurt_monster(monsters& m, int damage)
{
if (damage > 0)
{
- m.hurt(&you, damage);
+ m.hurt(&you, damage, BEAM_MISSILE, false);
+
if (m.alive())
{
print_wounds(&m);
behaviour_event(&m, ME_WHACK, MHITYOU);
}
+ else
+ {
+ monster_die(&m, KILL_YOU, NON_MONSTER);
+ return (true);
+ }
}
- return (!m.alive());
+ return (false);
}
static bool _player_hurt_monster(int monster, int damage)
@@ -2167,7 +2173,8 @@ void cast_far_strike(int pow)
damage *= dammod;
damage /= 78;
- monsters *monster = &menv[ mgrd(targ.target) ];
+ const int midx = mgrd(targ.target);
+ monsters *monster = &menv[midx];
// Apply monster's AC.
if (monster->ac > 0)
@@ -2186,9 +2193,7 @@ void cast_far_strike(int pow)
}
// Inflict the damage.
- monster->hurt(&you, damage);
- if (monster->alive())
- print_wounds(monster);
+ _player_hurt_monster(midx, damage);
}
bool cast_apportation(int pow, const coord_def& where)