2 #include "projection.h"
3 #include "monster-status.h"
8 * @brief 矢弾を射撃した際のスレイ倍率をかけた結果を返す /
9 * Determines the odds of an object breaking when thrown at a monster
10 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
11 * @param tdam 計算途中のダメージ量
12 * @param m_ptr 目標モンスターの構造体参照ポインタ
13 * @return スレイ倍率をかけたダメージ量
15 static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
19 monster_race *r_ptr = &r_info[m_ptr->r_idx];
21 BIT_FLAGS flgs[TR_FLAG_SIZE];
22 object_flags(o_ptr, flgs);
24 /* Some "weapons" and "ammo" do extra damage */
31 if ((have_flag(flgs, TR_SLAY_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL))
33 if (is_original_ap_and_seen(m_ptr))
35 r_ptr->r_flags3 |= RF3_ANIMAL;
37 if (mult < 17) mult = 17;
40 if ((have_flag(flgs, TR_KILL_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL))
42 if (is_original_ap_and_seen(m_ptr))
44 r_ptr->r_flags3 |= RF3_ANIMAL;
46 if (mult < 27) mult = 27;
49 if ((have_flag(flgs, TR_SLAY_EVIL)) && (r_ptr->flags3 & RF3_EVIL))
51 if (is_original_ap_and_seen(m_ptr))
53 r_ptr->r_flags3 |= RF3_EVIL;
55 if (mult < 15) mult = 15;
58 if ((have_flag(flgs, TR_KILL_EVIL)) && (r_ptr->flags3 & RF3_EVIL))
60 if (is_original_ap_and_seen(m_ptr))
62 r_ptr->r_flags3 |= RF3_EVIL;
64 if (mult < 25) mult = 25;
67 if ((have_flag(flgs, TR_SLAY_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN))
69 if (is_original_ap_and_seen(m_ptr))
71 r_ptr->r_flags2 |= RF2_HUMAN;
73 if (mult < 17) mult = 17;
76 if ((have_flag(flgs, TR_KILL_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN))
78 if (is_original_ap_and_seen(m_ptr))
80 r_ptr->r_flags2 |= RF2_HUMAN;
82 if (mult < 27) mult = 27;
85 if ((have_flag(flgs, TR_SLAY_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD))
87 if (is_original_ap_and_seen(m_ptr))
89 r_ptr->r_flags3 |= RF3_UNDEAD;
91 if (mult < 20) mult = 20;
94 if ((have_flag(flgs, TR_KILL_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD))
96 if (is_original_ap_and_seen(m_ptr))
98 r_ptr->r_flags3 |= RF3_UNDEAD;
100 if (mult < 30) mult = 30;
103 if ((have_flag(flgs, TR_SLAY_DEMON)) && (r_ptr->flags3 & RF3_DEMON))
105 if (is_original_ap_and_seen(m_ptr))
107 r_ptr->r_flags3 |= RF3_DEMON;
109 if (mult < 20) mult = 20;
112 if ((have_flag(flgs, TR_KILL_DEMON)) && (r_ptr->flags3 & RF3_DEMON))
114 if (is_original_ap_and_seen(m_ptr))
116 r_ptr->r_flags3 |= RF3_DEMON;
118 if (mult < 30) mult = 30;
121 if ((have_flag(flgs, TR_SLAY_ORC)) && (r_ptr->flags3 & RF3_ORC))
123 if (is_original_ap_and_seen(m_ptr))
125 r_ptr->r_flags3 |= RF3_ORC;
127 if (mult < 20) mult = 20;
130 if ((have_flag(flgs, TR_KILL_ORC)) && (r_ptr->flags3 & RF3_ORC))
132 if (is_original_ap_and_seen(m_ptr))
134 r_ptr->r_flags3 |= RF3_ORC;
136 if (mult < 30) mult = 30;
139 if ((have_flag(flgs, TR_SLAY_TROLL)) && (r_ptr->flags3 & RF3_TROLL))
141 if (is_original_ap_and_seen(m_ptr))
143 r_ptr->r_flags3 |= RF3_TROLL;
146 if (mult < 20) mult = 20;
149 if ((have_flag(flgs, TR_KILL_TROLL)) && (r_ptr->flags3 & RF3_TROLL))
151 if (is_original_ap_and_seen(m_ptr))
153 r_ptr->r_flags3 |= RF3_TROLL;
155 if (mult < 30) mult = 30;
158 if ((have_flag(flgs, TR_SLAY_GIANT)) && (r_ptr->flags3 & RF3_GIANT))
160 if (is_original_ap_and_seen(m_ptr))
162 r_ptr->r_flags3 |= RF3_GIANT;
164 if (mult < 20) mult = 20;
167 if ((have_flag(flgs, TR_KILL_GIANT)) && (r_ptr->flags3 & RF3_GIANT))
169 if (is_original_ap_and_seen(m_ptr))
171 r_ptr->r_flags3 |= RF3_GIANT;
173 if (mult < 30) mult = 30;
176 if ((have_flag(flgs, TR_SLAY_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON))
178 if (is_original_ap_and_seen(m_ptr))
180 r_ptr->r_flags3 |= RF3_DRAGON;
182 if (mult < 20) mult = 20;
185 if ((have_flag(flgs, TR_KILL_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON))
187 if (is_original_ap_and_seen(m_ptr))
189 r_ptr->r_flags3 |= RF3_DRAGON;
191 if (mult < 30) mult = 30;
192 if ((o_ptr->name1 == ART_BARD_ARROW) && (m_ptr->r_idx == MON_SMAUG) &&
193 (inventory[INVEN_BOW].name1 == ART_BARD))
197 if (have_flag(flgs, TR_BRAND_ACID))
199 /* Notice immunity */
200 if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)
202 if (is_original_ap_and_seen(m_ptr))
204 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK);
209 if (mult < 17) mult = 17;
213 if (have_flag(flgs, TR_BRAND_ELEC))
215 /* Notice immunity */
216 if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
218 if (is_original_ap_and_seen(m_ptr))
220 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
225 if (mult < 17) mult = 17;
229 if (have_flag(flgs, TR_BRAND_FIRE))
231 /* Notice immunity */
232 if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
234 if (is_original_ap_and_seen(m_ptr))
236 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
239 /* Otherwise, take the damage */
242 if (r_ptr->flags3 & RF3_HURT_FIRE)
244 if (mult < 25) mult = 25;
245 if (is_original_ap_and_seen(m_ptr))
247 r_ptr->r_flags3 |= RF3_HURT_FIRE;
250 else if (mult < 17) mult = 17;
254 if (have_flag(flgs, TR_BRAND_COLD))
256 /* Notice immunity */
257 if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
259 if (is_original_ap_and_seen(m_ptr))
261 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
264 /* Otherwise, take the damage */
267 if (r_ptr->flags3 & RF3_HURT_COLD)
269 if (mult < 25) mult = 25;
270 if (is_original_ap_and_seen(m_ptr))
272 r_ptr->r_flags3 |= RF3_HURT_COLD;
275 else if (mult < 17) mult = 17;
279 if (have_flag(flgs, TR_BRAND_POIS))
281 /* Notice immunity */
282 if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
284 if (is_original_ap_and_seen(m_ptr))
286 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
289 /* Otherwise, take the damage */
292 if (mult < 17) mult = 17;
296 if ((have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
298 p_ptr->csp -= (1 + (p_ptr->msp / 30));
299 p_ptr->redraw |= (PR_MANA);
307 if (snipe_type) mult = tot_dam_aux_snipe(mult, m_ptr);
309 /* Return the total damage */
310 return (tdam * mult / 10);
316 * Fire an object from the pack or floor.
317 * @param item 射撃するオブジェクトの所持ID
318 * @param j_ptr 射撃武器のオブジェクト参照ポインタ
322 * You may only fire items that "match" your missile launcher.
323 * You must use slings + pebbles/shots, bows + arrows, xbows + bolts.
324 * See "calc_bonuses()" for more calculations and such.
325 * Note that "firing" a missile is MUCH better than "throwing" it.
326 * Note: "unseen" monsters are very hard to hit.
327 * Objects are more likely to break if they "attempt" to hit a monster.
328 * Rangers (with Bows) and Anyone (with "Extra Shots") get extra shots.
329 * The "extra shot" code works by decreasing the amount of energy
330 * required to make each shot, spreading the shots out over time.
331 * Note that when firing missiles, the launcher multiplier is applied
332 * after all the bonuses are added in, making multipliers very useful.
333 * Note that Bows of "Extra Might" get extra range and an extra bonus
334 * for the damage multiplier.
335 * Note that Bows of "Extra Shots" give an extra shot.
338 void exe_fire(INVENTORY_IDX item, object_type *j_ptr)
342 POSITION y, x, ny, nx, ty, tx, prev_y, prev_x;
343 int tdam_base, tdis, thits, tmul;
345 int cur_dis, visible;
353 bool hit_body = FALSE;
355 GAME_TEXT o_name[MAX_NLEN];
357 u16b path_g[512]; /* For calcuration of path length */
359 int msec = delay_factor * delay_factor * delay_factor;
362 bool stick_to = FALSE;
364 /* Access the item (if in the pack) */
367 o_ptr = &inventory[item];
371 o_ptr = &o_list[0 - item];
374 /* Sniper - Cannot shot a single arrow twice */
375 if ((snipe_type == SP_DOUBLE) && (o_ptr->number < 2)) snipe_type = SP_NONE;
377 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
379 /* Use the proper number of shots */
380 thits = p_ptr->num_fire;
382 /* Use a base distance */
385 /* Base damage from thrown object plus launcher bonus */
386 tdam_base = damroll(o_ptr->dd, o_ptr->ds) + o_ptr->to_d + j_ptr->to_d;
388 /* Actually "fire" the object */
389 bonus = (p_ptr->to_h_b + o_ptr->to_h + j_ptr->to_h);
390 if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW))
391 chance = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + bonus) * BTH_PLUS_ADJ);
393 chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + bonus) * BTH_PLUS_ADJ);
395 p_ptr->energy_use = bow_energy(j_ptr->sval);
396 tmul = bow_tmul(j_ptr->sval);
398 /* Get extra "power" from "extra might" */
399 if (p_ptr->xtra_might) tmul++;
401 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
403 /* Boost the damage */
408 tdis = 13 + tmul / 80;
409 if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW))
412 tdis -= (5 - (p_ptr->concent + 1) / 2);
417 project_length = tdis + 1;
419 /* Get a direction (or cancel) */
420 if (!get_aim_dir(&dir))
422 p_ptr->energy_use = 0;
424 if (snipe_type == SP_AWAY) snipe_type = SP_NONE;
426 /* need not to reset project_length (already did)*/
431 /* Predict the "target" location */
432 tx = p_ptr->x + 99 * ddx[dir];
433 ty = p_ptr->y + 99 * ddy[dir];
435 /* Check for "target request" */
436 if ((dir == 5) && target_okay())
442 /* Get projection path length */
443 tdis = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_PATH | PROJECT_THRU) - 1;
445 project_length = 0; /* reset to default */
447 /* Don't shoot at my feet */
448 if (tx == p_ptr->x && ty == p_ptr->y)
450 p_ptr->energy_use = 0;
452 /* project_length is already reset to 0 */
458 /* Take a (partial) turn */
459 p_ptr->energy_use = (p_ptr->energy_use / thits);
462 /* Sniper - Difficult to shot twice at 1 turn */
463 if (snipe_type == SP_DOUBLE) p_ptr->concent = (p_ptr->concent + 1) / 2;
465 /* Sniper - Repeat shooting when double shots */
466 for (i = 0; i < ((snipe_type == SP_DOUBLE) ? 2 : 1); i++)
469 /* Start at the player */
474 /* Obtain a local object */
475 object_copy(q_ptr, o_ptr);
480 /* Reduce and describe inventory */
483 inven_item_increase(item, -1);
484 inven_item_describe(item);
485 inven_item_optimize(item);
488 /* Reduce and describe floor item */
491 floor_item_increase(0 - item, -1);
492 floor_item_optimize(0 - item);
498 /* Save the old location */
502 /* The shot does not hit yet */
505 /* Travel until stopped */
506 for (cur_dis = 0; cur_dis <= tdis; )
510 /* Hack -- Stop at the target */
511 if ((y == ty) && (x == tx)) break;
513 /* Calculate the new location (see "project()") */
516 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
519 if (snipe_type == SP_KILL_WALL)
521 c_ptr = &cave[ny][nx];
523 if (cave_have_flag_grid(c_ptr, FF_HURT_ROCK) && !c_ptr->m_idx)
525 if (c_ptr->info & (CAVE_MARK)) msg_print(_("岩が砕け散った。", "Wall rocks were shattered."));
526 /* Forget the wall */
527 c_ptr->info &= ~(CAVE_MARK);
528 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
530 /* Destroy the wall */
531 cave_alter_feat(ny, nx, FF_HURT_ROCK);
538 /* Stopped by walls/doors */
539 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && !cave[ny][nx].m_idx) break;
541 /* Advance the distance */
545 if (snipe_type == SP_LITE)
547 cave[ny][nx].info |= (CAVE_GLOW);
552 /* The player can see the (on screen) missile */
553 if (panel_contains(ny, nx) && player_can_see_bold(ny, nx))
555 char c = object_char(q_ptr);
556 byte a = object_attr(q_ptr);
558 /* Draw, Hilite, Fresh, Pause, Erase */
559 print_rel(c, a, ny, nx);
560 move_cursor_relative(ny, nx);
562 Term_xtra(TERM_XTRA_DELAY, msec);
567 /* The player cannot see the missile */
570 /* Pause anyway, for consistancy */
571 Term_xtra(TERM_XTRA_DELAY, msec);
575 if (snipe_type == SP_KILL_TRAP)
577 project(0, 0, ny, nx, 0, GF_KILL_TRAP,
578 (PROJECT_JUMP | PROJECT_HIDE | PROJECT_GRID | PROJECT_ITEM), -1);
582 if (snipe_type == SP_EVILNESS)
584 cave[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK);
589 /* Save the old location */
593 /* Save the new location */
597 /* Monster here, Try to hit it */
598 if (cave[y][x].m_idx)
600 cave_type *c_mon_ptr = &cave[y][x];
602 monster_type *m_ptr = &m_list[c_mon_ptr->m_idx];
603 monster_race *r_ptr = &r_info[m_ptr->r_idx];
605 /* Check the visibility */
608 /* Note the collision */
611 if (MON_CSLEEP(m_ptr))
613 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
614 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
617 if ((r_ptr->level + 10) > p_ptr->lev)
619 int now_exp = p_ptr->weapon_exp[0][j_ptr->sval];
620 if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval])
623 if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
624 else if (now_exp < WEAPON_EXP_SKILLED) amount = 25;
625 else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 10;
626 else if (p_ptr->lev > 34) amount = 2;
627 p_ptr->weapon_exp[0][j_ptr->sval] += amount;
628 p_ptr->update |= (PU_BONUS);
634 if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING])
635 && ((p_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < r_info[m_list[p_ptr->riding].r_idx].level)
638 p_ptr->skill_exp[GINOU_RIDING] += 1;
639 p_ptr->update |= (PU_BONUS);
643 /* Did we hit it (penalize range) */
644 if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name))
647 int tdam = tdam_base;
649 /* Get extra damage from concentration */
650 if (p_ptr->concent) tdam = boost_concentration_damage(tdam);
652 /* Handle unseen monster */
655 /* Invisible monster */
656 msg_format(_("%sが敵を捕捉した。", "The %s finds a mark."), o_name);
659 /* Handle visible monster */
662 GAME_TEXT m_name[MAX_NLEN];
664 /* Get "the monster" or "it" */
665 monster_desc(m_name, m_ptr, 0);
667 msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
671 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
672 health_track(c_mon_ptr->m_idx);
676 if (snipe_type == SP_NEEDLE)
678 if ((randint1(randint1(r_ptr->level / (3 + p_ptr->concent)) + (8 - p_ptr->concent)) == 1)
679 && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
681 GAME_TEXT m_name[MAX_NLEN];
683 /* Get "the monster" or "it" */
684 monster_desc(m_name, m_ptr, 0);
686 tdam = m_ptr->hp + 1;
687 msg_format(_("%sの急所に突き刺さった!", "Your shot sticked on a fatal spot of %s!"), m_name);
693 /* Apply special damage */
694 tdam = tot_dam_aux_shot(q_ptr, tdam, m_ptr);
695 tdam = critical_shot(q_ptr->weight, q_ptr->to_h, j_ptr->to_h, tdam);
697 /* No negative damage */
698 if (tdam < 0) tdam = 0;
700 /* Modify the damage */
701 tdam = mon_damage_mod(m_ptr, tdam, FALSE);
704 msg_format_wizard(CHEAT_MONSTER,
705 _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
706 tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
709 if (snipe_type == SP_EXPLODE)
711 u16b flg = (PROJECT_STOP | PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID);
713 sound(SOUND_EXPLODE); /* No explode sound - use breath fire instead */
714 project(0, ((p_ptr->concent + 1) / 2 + 1), ny, nx, tdam, GF_MISSILE, flg, -1);
719 if (snipe_type == SP_HOLYNESS)
721 cave[ny][nx].info |= (CAVE_GLOW);
726 /* Hit the monster, check for death */
727 if (mon_take_hit(c_mon_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
736 if (object_is_fixed_artifact(q_ptr) &&
737 (p_ptr->pclass != CLASS_SNIPER || p_ptr->concent == 0))
739 GAME_TEXT m_name[MAX_NLEN];
741 monster_desc(m_name, m_ptr, 0);
744 msg_format(_("%sは%sに突き刺さった!", "%^s have stuck into %s!"), o_name, m_name);
747 message_pain(c_mon_ptr->m_idx, tdam);
749 /* Anger the monster */
750 if (tdam > 0) anger_monster(m_ptr);
752 if (fear && m_ptr->ml)
754 GAME_TEXT m_name[MAX_NLEN];
756 monster_desc(m_name, m_ptr, 0);
757 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
760 set_target(m_ptr, p_ptr->y, p_ptr->x);
763 if (snipe_type == SP_RUSH)
765 int n = randint1(5) + 3;
766 MONSTER_IDX m_idx = c_mon_ptr->m_idx;
768 for (; cur_dis <= tdis; )
775 /* Calculate the new location (see "project()") */
776 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
778 /* Stopped by wilderness boundary */
779 if (!in_bounds2(ny, nx)) break;
781 /* Stopped by walls/doors */
782 if (!player_can_enter(cave[ny][nx].feat, 0)) break;
784 /* Stopped by monsters */
785 if (!cave_empty_bold(ny, nx)) break;
787 cave[ny][nx].m_idx = m_idx;
788 cave[oy][ox].m_idx = 0;
793 update_monster(c_mon_ptr->m_idx, TRUE);
799 Term_xtra(TERM_XTRA_DELAY, msec);
811 if (snipe_type == SP_PIERCE)
813 if (p_ptr->concent < 1) break;
823 /* Chance of breakage (during attacks) */
824 j = (hit_body ? breakage_chance(q_ptr) : 0);
828 MONSTER_IDX m_idx = cave[y][x].m_idx;
829 monster_type *m_ptr = &m_list[m_idx];
830 OBJECT_IDX o_idx = o_pop();
834 msg_format(_("%sはどこかへ行った。", "The %s have gone to somewhere."), o_name);
835 if (object_is_fixed_artifact(q_ptr))
837 a_info[j_ptr->name1].cur_num = 0;
842 o_ptr = &o_list[o_idx];
843 object_copy(o_ptr, q_ptr);
846 o_ptr->marked &= OM_TOUCHED;
848 /* Forget location */
849 o_ptr->iy = o_ptr->ix = 0;
851 /* Memorize monster */
852 o_ptr->held_m_idx = m_idx;
855 o_ptr->next_o_idx = m_ptr->hold_o_idx;
858 m_ptr->hold_o_idx = o_idx;
860 else if (cave_have_flag_bold(y, x, FF_PROJECT))
862 /* Drop (or break) near that location */
863 (void)drop_near(q_ptr, j, y, x);
867 /* Drop (or break) near that location */
868 (void)drop_near(q_ptr, j, prev_y, prev_x);
871 /* Sniper - Repeat shooting when double shots */
874 /* Sniper - Loose his/her concentration after any shot */
875 if (p_ptr->concent) reset_concentration(FALSE);
880 * @brief プレイヤーからモンスターへの射撃命中判定 /
881 * Determine if the player "hits" a monster (normal combat).
882 * @param chance 基本命中値
883 * @param m_ptr モンスターの構造体参照ポインタ
884 * @param vis 目標を視界に捕らえているならばTRUEを指定
885 * @param o_name メッセージ表示時のモンスター名
886 * @return 命中と判定された場合TRUEを返す
887 * @note Always miss 5%, always hit 5%, otherwise random.
889 bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
893 monster_race *r_ptr = &r_info[m_ptr->r_idx];
895 /* Percentile dice */
898 /* Snipers with high-concentration reduce instant miss percentage.*/
901 /* Hack -- Instant miss or hit */
902 if (k <= 5) return (FALSE);
903 if (k > 95) return (TRUE);
905 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
906 if (one_in_(20)) return (FALSE);
909 if (chance <= 0) return (FALSE);
914 ac *= (8 - p_ptr->concent);
918 if (m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
920 /* Invisible monsters are harder to hit */
921 if (!vis) chance = (chance + 1) / 2;
923 /* Power competes against armor */
924 if (randint0(chance) < (ac * 3 / 4))
926 if (m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
928 GAME_TEXT m_name[MAX_NLEN];
930 /* Extract monster name */
931 monster_desc(m_name, m_ptr, 0);
932 msg_format(_("%sは%sを斬り捨てた!", "%s cuts down %s!"), m_name, o_name);
945 * @brief プレイヤーからモンスターへの射撃クリティカル判定 /
946 * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level.
947 * @param weight 矢弾の重量
948 * @param plus_ammo 矢弾の命中修正
949 * @param plus_bow 弓の命中修正
950 * @param dam 現在算出中のダメージ値
951 * @return クリティカル修正が入ったダメージ値
953 HIT_POINT critical_shot(WEIGHT weight, int plus_ammo, int plus_bow, HIT_POINT dam)
956 object_type *j_ptr = &inventory[INVEN_BOW];
958 /* Extract "shot" power */
959 i = p_ptr->to_h_b + plus_ammo;
961 if (p_ptr->tval_ammo == TV_BOLT)
962 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
964 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
967 /* Snipers can shot more critically with crossbows */
968 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
969 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
971 /* Good bow makes more critical */
972 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
975 if (randint1(10000) <= i)
977 k = weight * randint1(500);
981 msg_print(_("手ごたえがあった!", "It was a good hit!"));
986 msg_print(_("かなりの手ごたえがあった!", "It was a great hit!"));
991 msg_print(_("会心の一撃だ!", "It was a superb hit!"));