summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-18 09:09:23 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-18 09:09:23 +0000
commita9dac8d2c47e177df297429746e427085e295ffa (patch)
tree4a42dbd65088d9156e5b2480e44d9fccd107916d /crawl-ref/source/fight.cc
parentf81ebd6b075237e35e1e736839610f585189feec (diff)
downloadcrawl-ref-a9dac8d2c47e177df297429746e427085e295ffa.tar.gz
crawl-ref-a9dac8d2c47e177df297429746e427085e295ffa.zip
Fix [2610764]: 5% of all misses gave 'Your armour prevents you
from hitting $MONSTER' regardless of armour. Also put in some paranoia to prevent this happening in the future. The minimum chance of hitting a monster has been reduced from 1 - 0.95^2 = 9.75% (which was a bug) to 5% (which was the intention.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9123 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 66bcf8cc8c..37da54bd34 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -1365,8 +1365,12 @@ void melee_attack::player_announce_hit()
std::string melee_attack::player_why_missed()
{
- if ((to_hit + heavy_armour_penalty/2) >= defender->melee_evasion(attacker))
+ if (heavy_armour_penalty > 0
+ && (to_hit + heavy_armour_penalty/2
+ >= defender->melee_evasion(attacker)))
+ {
return "Your armour prevents you from hitting ";
+ }
else
return "You miss ";
}