diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-06 22:30:19 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-06 22:30:19 +0000 |
commit | 24634ffe34a314b735492cff1ffcbc7fe22dc11c (patch) | |
tree | 62fc34942c4023e1275515a5f028bde1259a8c75 /crawl-ref/source/traps.cc | |
parent | a2df2a7e984468efba235d355daa9d00ed54103f (diff) | |
download | crawl-ref-24634ffe34a314b735492cff1ffcbc7fe22dc11c.tar.gz crawl-ref-24634ffe34a314b735492cff1ffcbc7fe22dc11c.zip |
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
Diffstat (limited to 'crawl-ref/source/traps.cc')
-rw-r--r-- | crawl-ref/source/traps.cc | 19 |
1 files changed, 11 insertions, 8 deletions
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.) |