From 24634ffe34a314b735492cff1ffcbc7fe22dc11c Mon Sep 17 00:00:00 2001 From: dolorous Date: Tue, 6 Jan 2009 22:30:19 +0000 Subject: Fix [2488346]: If a monster steps on an ammo-shooting trap, only poison/hurt it if the ammo actually hit it, and don't display messages like "An [ammo type] misses the [monster], but does no damage!". git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8283 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/traps.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'crawl-ref/source/traps.cc') diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index 7be9b3e3ed..d8991e9949 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -1161,7 +1161,7 @@ void trap_def::shoot_ammo(actor& act, bool was_known) } else { - // note that this uses full (not random2limit(foo,40)) + // Note that this uses full (not random2limit(foo,40)) // player_evasion. int trap_hit = (20 + (you.your_level*2)) * random2(200) / 100; int your_dodge = player_evasion() + random2(you.dex) / 3 @@ -1207,7 +1207,7 @@ void trap_def::shoot_ammo(actor& act, bool was_known) // Check whether to poison. if (poison) - poison = (hit && x_chance_in_y(50 - (3*monster->ac)/2, 100)); + poison = (x_chance_in_y(50 - (3*monster->ac)/2, 100)); if (see_grid(act.pos())) { @@ -1215,15 +1215,18 @@ void trap_def::shoot_ammo(actor& act, bool was_known) shot.name(DESC_CAP_A).c_str(), hit ? "hits" : "misses", monster->name(DESC_NOCAP_THE).c_str(), - (damage_taken == 0 - && !poison) ? ", but does no damage" : ""); + (hit && damage_taken == 0 + && !poison) ? ", but does no damage" : ""); } - if (poison) - poison_monster(monster, KC_OTHER); - // Apply damage. - monster->hurt(NULL, damage_taken); + if (hit) + { + if (poison) + poison_monster(monster, KC_OTHER); + + monster->hurt(NULL, damage_taken); + } } // Drop the item (sometimes.) -- cgit v1.2.3-54-g00ecf