From 1490990e8eaa75af62eae49de52c76efe2fc58d3 Mon Sep 17 00:00:00 2001 From: dis- Date: Wed, 27 Mar 2013 14:42:05 +0000 Subject: [PATCH] adjust critical_shot -- consider race/class/personality --- src/bldg.c | 10 ++++++++-- src/cmd1.c | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/bldg.c b/src/bldg.c index 0f6bcb393..d22fadf10 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -3117,10 +3117,16 @@ static void town_history(void) s16b calc_crit_ratio_shot(int weight, int plus_ammo, int plus_bow, int dam) { int i; + object_type *j_ptr = &inventory[INVEN_BOW]; /* Extract "shot" power */ - i = p_ptr->to_h_b * 4 + plus_ammo + (p_ptr->lev * 2); + i = p_ptr->to_h_b + plus_ammo; + if (p_ptr->tval_ammo == TV_BOLT) + i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ); + else + i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ); + /* Snipers can shot more critically with crossbows */ if (p_ptr->concent) i += ((i * p_ptr->concent) / 5); if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2; @@ -3130,7 +3136,7 @@ s16b calc_crit_ratio_shot(int weight, int plus_ammo, int plus_bow, int dam) if (i < 0) i = 0; - return i * 2; + return i * 5 / 3; } s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow, int dam) diff --git a/src/cmd1.c b/src/cmd1.c index 51347f531..6b883bb59 100644 --- a/src/cmd1.c +++ b/src/cmd1.c @@ -89,9 +89,16 @@ bool test_hit_norm(int chance, int ac, int vis) s16b critical_shot(int weight, int plus_ammo, int plus_bow, int dam) { int i, k; + object_type *j_ptr = &inventory[INVEN_BOW]; /* Extract "shot" power */ - i = p_ptr->to_h_b * 4 + plus_ammo + (p_ptr->lev * 2); + i = p_ptr->to_h_b + plus_ammo; + + if (p_ptr->tval_ammo == TV_BOLT) + i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ); + else + i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ); + /* Snipers can shot more critically with crossbows */ if (p_ptr->concent) i += ((i * p_ptr->concent) / 5); @@ -101,7 +108,7 @@ s16b critical_shot(int weight, int plus_ammo, int plus_bow, int dam) i += MAX(0, plus_bow - 15) * 4 * (p_ptr->concent ? p_ptr->concent + 5 : 5); /* Critical hit */ - if (randint1(5000) <= i) + if (randint1(6000) <= i) { k = weight * randint1(500); -- 2.11.0