4 * @brief プレイヤーからモンスターへの射撃命中判定 /
5 * Determine if the player "hits" a monster (normal combat).
7 * @param m_ptr モンスターの構造体参照ポインタ
8 * @param vis 目標を視界に捕らえているならばTRUEを指定
9 * @param o_name メッセージ表示時のモンスター名
10 * @return 命中と判定された場合TRUEを返す
11 * @note Always miss 5%, always hit 5%, otherwise random.
13 bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
17 monster_race *r_ptr = &r_info[m_ptr->r_idx];
22 /* Snipers with high-concentration reduce instant miss percentage.*/
25 /* Hack -- Instant miss or hit */
26 if (k <= 5) return (FALSE);
27 if (k > 95) return (TRUE);
29 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
30 if (one_in_(20)) return (FALSE);
33 if (chance <= 0) return (FALSE);
38 ac *= (8 - p_ptr->concent);
42 if (m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
44 /* Invisible monsters are harder to hit */
45 if (!vis) chance = (chance + 1) / 2;
47 /* Power competes against armor */
48 if (randint0(chance) < (ac * 3 / 4))
50 if (m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
54 /* Extract monster name */
55 monster_desc(m_name, m_ptr, 0);
56 msg_format(_("%sは%sを斬り捨てた!", "%s cuts down %s!"), m_name, o_name);
69 * @brief プレイヤーからモンスターへの射撃クリティカル判定 /
70 * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level.
72 * @param plus_ammo 矢弾の命中修正
73 * @param plus_bow 弓の命中修正
74 * @param dam 現在算出中のダメージ値
75 * @return クリティカル修正が入ったダメージ値
77 HIT_POINT critical_shot(WEIGHT weight, int plus_ammo, int plus_bow, HIT_POINT dam)
80 object_type *j_ptr = &inventory[INVEN_BOW];
82 /* Extract "shot" power */
83 i = p_ptr->to_h_b + plus_ammo;
85 if (p_ptr->tval_ammo == TV_BOLT)
86 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
88 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
91 /* Snipers can shot more critically with crossbows */
92 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
93 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
95 /* Good bow makes more critical */
96 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
99 if (randint1(10000) <= i)
101 k = weight * randint1(500);
105 msg_print(_("手ごたえがあった!", "It was a good hit!"));
110 msg_print(_("かなりの手ごたえがあった!", "It was a great hit!"));
115 msg_print(_("会心の一撃だ!", "It was a superb hit!"));