From f9d6418d7400f03a7a3aac92f19d81e3f4e67c9e Mon Sep 17 00:00:00 2001 From: deskull Date: Sat, 14 Sep 2019 15:55:16 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20test=5Fhit=5Ffire()=20?= =?utf8?q?=E3=81=AB=20player=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92?= =?utf8?q?=E8=BF=BD=E5=8A=A0=EF=BC=8E=20/=20Add=20player=5Ftype=20*=20argu?= =?utf8?q?ment=20to=20test=5Fhit=5Ffire().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd/cmd-basic.c | 2 +- src/combat/shoot.c | 12 ++++++------ src/combat/shoot.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index b922e6e16..ddc98bd40 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -2598,7 +2598,7 @@ bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_ID hit_body = TRUE; /* Did we hit it (penalize range) */ - if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name)) + if (test_hit_fire(creature_ptr, chance - cur_dis, m_ptr, m_ptr->ml, o_name)) { bool fear = FALSE; diff --git a/src/combat/shoot.c b/src/combat/shoot.c index 6516aa23e..3f8ea1c6e 100644 --- a/src/combat/shoot.c +++ b/src/combat/shoot.c @@ -658,7 +658,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, } /* Did we hit it (penalize range) */ - if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name)) + if (test_hit_fire(shooter_ptr, chance - cur_dis, m_ptr, m_ptr->ml, o_name)) { bool fear = FALSE; int tdam = tdam_base; @@ -903,7 +903,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, * @return 命中と判定された場合TRUEを返す * @note Always miss 5%, always hit 5%, otherwise random. */ -bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name) +bool test_hit_fire(player_type *shooter_ptr, int chance, monster_type *m_ptr, int vis, char* o_name) { int k; ARMOUR_CLASS ac; @@ -913,22 +913,22 @@ bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name) k = randint1(100); /* Snipers with high-concentration reduce instant miss percentage.*/ - k += p_ptr->concent; + k += shooter_ptr->concent; /* Hack -- Instant miss or hit */ if (k <= 5) return (FALSE); if (k > 95) return (TRUE); - if (p_ptr->pseikaku == SEIKAKU_NAMAKE) + if (shooter_ptr->pseikaku == SEIKAKU_NAMAKE) if (one_in_(20)) return (FALSE); /* Never hit */ if (chance <= 0) return (FALSE); ac = r_ptr->ac; - if (p_ptr->concent) + if (shooter_ptr->concent) { - ac *= (8 - p_ptr->concent); + ac *= (8 - shooter_ptr->concent); ac /= 8; } diff --git a/src/combat/shoot.h b/src/combat/shoot.h index 96440ec25..c629ba002 100644 --- a/src/combat/shoot.h +++ b/src/combat/shoot.h @@ -3,7 +3,7 @@ */ #pragma once -extern bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name); +extern bool test_hit_fire(player_type *shooter_ptr, int chance, monster_type *m_ptr, int vis, char* o_name); extern HIT_POINT critical_shot(player_type *shooter_ptr, WEIGHT weight, int plus_ammo, int plus_bow, HIT_POINT dam); extern ENERGY bow_energy(OBJECT_SUBTYPE_VALUE sval); extern int bow_tmul(OBJECT_SUBTYPE_VALUE sval); -- 2.11.0