summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ranged_attack.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-04-17 21:14:08 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2014-04-27 17:02:33 -0600
commitaf65ebd5ff1d82a27b1e881ec2cd63875bbbeb47 (patch)
treeaacf14d183b2f641c20b83162529c34b7b357abc /crawl-ref/source/ranged_attack.cc
parenta0b9eea05605c1024bf6387992650f60ee2fb501 (diff)
downloadcrawl-ref-af65ebd5ff1d82a27b1e881ec2cd63875bbbeb47.tar.gz
crawl-ref-af65ebd5ff1d82a27b1e881ec2cd63875bbbeb47.zip
Give M_ARCHER monsters their acc/dam bonuses back.
Sort of similar to how M_FIGHTER gets a melee accuracy bonus, I think this has a place here. The numbers are a bit complicated; the old code gave an ammoHitBonus of random2avg(HD * 4 / 3, 2) to the beam hit which is later added to the damage bonus. Since the randomisation here works differently the 4/3 is straight-up added to the to_hit and randomised when added to the damage.
Diffstat (limited to 'crawl-ref/source/ranged_attack.cc')
-rw-r--r--crawl-ref/source/ranged_attack.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/ranged_attack.cc b/crawl-ref/source/ranged_attack.cc
index 896b9858e5..67102e1c06 100644
--- a/crawl-ref/source/ranged_attack.cc
+++ b/crawl-ref/source/ranged_attack.cc
@@ -318,9 +318,22 @@ int ranged_attack::weapon_damage()
return dam;
}
+int ranged_attack::calc_mon_to_hit_base()
+{
+ ASSERT(attacker->is_monster());
+ const int hd_mult = attacker->as_monster()->is_archer() ? 15 : 9;
+ return 18 + attacker->get_experience_level() * hd_mult / 6;
+}
+
int ranged_attack::apply_damage_modifiers(int damage, int damage_max,
bool &half_ac)
{
+ ASSERT(attacker->is_monster());
+ if (attacker->as_monster()->is_archer())
+ {
+ const int bonus = attacker->get_experience_level() * 4 / 3;
+ damage += random2avg(bonus, 2);
+ }
half_ac = false;
return damage;
}