OSDN Git Service

[Refactor] #39963 Separated spells-effect-util.c/h from spells.h/spells1.c
[hengband/hengband.git] / src / combat / shoot.c
index 59b613d..e9a30f2 100644 (file)
@@ -1,7 +1,8 @@
 #include "angband.h"
 #include "core.h"
 #include "util.h"
-#include "term.h"
+#include "main/sound-definitions-table.h"
+#include "gameterm.h"
 
 #include "monster.h"
 #include "monster-status.h"
 #include "object-broken.h"
 #include "floor.h"
 #include "grid.h"
-#include "spells.h"
 #include "object-flavor.h"
 
 #include "shoot.h"
 #include "snipe.h"
-#include "view-mainwindow.h"
-#include "objectkind.h"
+#include "view/display-main-window.h"
+#include "object/object-kind.h"
 #include "targeting.h"
+#include "effect/spells-effect-util.h"
 
 /*!
  * @brief 矢弾を射撃した際のスレイ倍率をかけた結果を返す /
@@ -51,7 +52,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
        {
                if ((have_flag(flgs, TR_SLAY_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_ANIMAL;
                        }
@@ -60,7 +61,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_KILL_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_ANIMAL;
                        }
@@ -69,7 +70,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_SLAY_EVIL)) && (r_ptr->flags3 & RF3_EVIL))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_EVIL;
                        }
@@ -78,7 +79,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_KILL_EVIL)) && (r_ptr->flags3 & RF3_EVIL))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_EVIL;
                        }
@@ -87,7 +88,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_SLAY_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags2 |= RF2_HUMAN;
                        }
@@ -96,7 +97,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_KILL_HUMAN)) && (r_ptr->flags2 & RF2_HUMAN))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags2 |= RF2_HUMAN;
                        }
@@ -105,7 +106,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_SLAY_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_UNDEAD;
                        }
@@ -114,7 +115,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_KILL_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_UNDEAD;
                        }
@@ -123,7 +124,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_SLAY_DEMON)) && (r_ptr->flags3 & RF3_DEMON))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_DEMON;
                        }
@@ -132,7 +133,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_KILL_DEMON)) && (r_ptr->flags3 & RF3_DEMON))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_DEMON;
                        }
@@ -141,7 +142,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_SLAY_ORC)) && (r_ptr->flags3 & RF3_ORC))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_ORC;
                        }
@@ -150,7 +151,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_KILL_ORC)) && (r_ptr->flags3 & RF3_ORC))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_ORC;
                        }
@@ -159,7 +160,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_SLAY_TROLL)) && (r_ptr->flags3 & RF3_TROLL))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_TROLL;
                        }
@@ -169,7 +170,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_KILL_TROLL)) && (r_ptr->flags3 & RF3_TROLL))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_TROLL;
                        }
@@ -178,7 +179,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_SLAY_GIANT)) && (r_ptr->flags3 & RF3_GIANT))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_GIANT;
                        }
@@ -187,7 +188,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_KILL_GIANT)) && (r_ptr->flags3 & RF3_GIANT))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_GIANT;
                        }
@@ -196,7 +197,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_SLAY_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_DRAGON;
                        }
@@ -205,7 +206,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
 
                if ((have_flag(flgs, TR_KILL_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON))
                {
-                       if (is_original_ap_and_seen(m_ptr))
+                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                        {
                                r_ptr->r_flags3 |= RF3_DRAGON;
                        }
@@ -220,7 +221,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
                        /* Notice immunity */
                        if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)
                        {
-                               if (is_original_ap_and_seen(m_ptr))
+                               if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                                {
                                        r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK);
                                }
@@ -236,7 +237,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
                        /* Notice immunity */
                        if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
                        {
-                               if (is_original_ap_and_seen(m_ptr))
+                               if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                                {
                                        r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
                                }
@@ -252,7 +253,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
                        /* Notice immunity */
                        if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
                        {
-                               if (is_original_ap_and_seen(m_ptr))
+                               if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                                {
                                        r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
                                }
@@ -263,7 +264,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
                                if (r_ptr->flags3 & RF3_HURT_FIRE)
                                {
                                        if (mult < 25) mult = 25;
-                                       if (is_original_ap_and_seen(m_ptr))
+                                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                                        {
                                                r_ptr->r_flags3 |= RF3_HURT_FIRE;
                                        }
@@ -277,7 +278,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
                        /* Notice immunity */
                        if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
                        {
-                               if (is_original_ap_and_seen(m_ptr))
+                               if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                                {
                                        r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
                                }
@@ -288,7 +289,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
                                if (r_ptr->flags3 & RF3_HURT_COLD)
                                {
                                        if (mult < 25) mult = 25;
-                                       if (is_original_ap_and_seen(m_ptr))
+                                       if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                                        {
                                                r_ptr->r_flags3 |= RF3_HURT_COLD;
                                        }
@@ -302,7 +303,7 @@ static MULTIPLY tot_dam_aux_shot(player_type *sniper_ptr, object_type *o_ptr, HI
                        /* Notice immunity */
                        if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
                        {
-                               if (is_original_ap_and_seen(m_ptr))
+                               if (is_original_ap_and_seen(sniper_ptr, m_ptr))
                                {
                                        r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
                                }
@@ -395,7 +396,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
        /* Sniper - Cannot shot a single arrow twice */
        if ((snipe_type == SP_DOUBLE) && (o_ptr->number < 2)) snipe_type = SP_NONE;
 
-       object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
+       object_desc(shooter_ptr, o_name, o_ptr, OD_OMIT_PREFIX);
 
        /* Use the proper number of shots */
        thits = shooter_ptr->num_fire;
@@ -438,7 +439,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
        project_length = tdis + 1;
 
        /* Get a direction (or cancel) */
-       if (!get_aim_dir(&dir))
+       if (!get_aim_dir(shooter_ptr, &dir))
        {
                free_turn(shooter_ptr);
 
@@ -454,14 +455,14 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
        ty = shooter_ptr->y + 99 * ddy[dir];
 
        /* Check for "target request" */
-       if ((dir == 5) && target_okay())
+       if ((dir == 5) && target_okay(shooter_ptr))
        {
                tx = target_col;
                ty = target_row;
        }
 
        /* Get projection path length */
-       tdis = project_path(shooter_ptr->current_floor_ptr, path_g, project_length, shooter_ptr->y, shooter_ptr->x, ty, tx, PROJECT_PATH | PROJECT_THRU) - 1;
+       tdis = project_path(shooter_ptr, path_g, project_length, shooter_ptr->y, shooter_ptr->x, ty, tx, PROJECT_PATH | PROJECT_THRU) - 1;
 
        project_length = 0; /* reset to default */
 
@@ -496,10 +497,10 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                /* Single object */
                q_ptr->number = 1;
 
-               vary_item(item, -1);
+               vary_item(shooter_ptr, item, -1);
 
                sound(SOUND_SHOOT);
-               handle_stuff();
+               handle_stuff(shooter_ptr);
 
                prev_y = y;
                prev_x = x;
@@ -533,7 +534,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                        shooter_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
 
                                        /* Destroy the wall */
-                                       cave_alter_feat(ny, nx, FF_HURT_ROCK);
+                                       cave_alter_feat(shooter_ptr, ny, nx, FF_HURT_ROCK);
 
                                        hit_body = TRUE;
                                        break;
@@ -550,8 +551,8 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                        if (snipe_type == SP_LITE)
                        {
                                shooter_ptr->current_floor_ptr->grid_array[ny][nx].info |= (CAVE_GLOW);
-                               note_spot(ny, nx);
-                               lite_spot(ny, nx);
+                               note_spot(shooter_ptr, ny, nx);
+                               lite_spot(shooter_ptr, ny, nx);
                        }
 
                        /* The player can see the (on screen) missile */
@@ -565,7 +566,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                move_cursor_relative(ny, nx);
                                Term_fresh();
                                Term_xtra(TERM_XTRA_DELAY, msec);
-                               lite_spot(ny, nx);
+                               lite_spot(shooter_ptr, ny, nx);
                                Term_fresh();
                        }
 
@@ -587,8 +588,8 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                        if (snipe_type == SP_EVILNESS)
                        {
                                shooter_ptr->current_floor_ptr->grid_array[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK);
-                               note_spot(ny, nx);
-                               lite_spot(ny, nx);
+                               note_spot(shooter_ptr, ny, nx);
+                               lite_spot(shooter_ptr, ny, nx);
                        }
 
                        prev_y = y;
@@ -666,14 +667,14 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                                GAME_TEXT m_name[MAX_NLEN];
 
                                                /* Get "the monster" or "it" */
-                                               monster_desc(m_name, m_ptr, 0);
+                                               monster_desc(shooter_ptr, m_name, m_ptr, 0);
 
                                                msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
 
                                                if (m_ptr->ml)
                                                {
-                                                       if (!shooter_ptr->image) monster_race_track(m_ptr->ap_r_idx);
-                                                       health_track(c_mon_ptr->m_idx);
+                                                       if (!shooter_ptr->image) monster_race_track(shooter_ptr, m_ptr->ap_r_idx);
+                                                       health_track(shooter_ptr, c_mon_ptr->m_idx);
                                                }
                                        }
 
@@ -685,10 +686,10 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                                        GAME_TEXT m_name[MAX_NLEN];
 
                                                        /* Get "the monster" or "it" */
-                                                       monster_desc(m_name, m_ptr, 0);
+                                                       monster_desc(shooter_ptr, m_name, m_ptr, 0);
 
                                                        tdam = m_ptr->hp + 1;
-                                                       msg_format(_("%sの急所に突き刺さった!", "Your shot sticked on a fatal spot of %s!"), m_name);
+                                                       msg_format(_("%sの急所に突き刺さった!", "Your shot hit a fatal spot of %s!"), m_name);
                                                }
                                                else tdam = 1;
                                        }
@@ -702,7 +703,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                                if (tdam < 0) tdam = 0;
 
                                                /* Modify the damage */
-                                               tdam = mon_damage_mod(m_ptr, tdam, FALSE);
+                                               tdam = mon_damage_mod(shooter_ptr, m_ptr, tdam, FALSE);
                                        }
 
                                        msg_format_wizard(CHEAT_MONSTER,
@@ -723,12 +724,12 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                        if (snipe_type == SP_HOLYNESS)
                                        {
                                                shooter_ptr->current_floor_ptr->grid_array[ny][nx].info |= (CAVE_GLOW);
-                                               note_spot(ny, nx);
-                                               lite_spot(ny, nx);
+                                               note_spot(shooter_ptr, ny, nx);
+                                               lite_spot(shooter_ptr, ny, nx);
                                        }
 
                                        /* Hit the monster, check for death */
-                                       if (mon_take_hit(c_mon_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
+                                       if (mon_take_hit(shooter_ptr, c_mon_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
                                        {
                                                /* Dead monster */
                                        }
@@ -742,22 +743,22 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                                {
                                                        GAME_TEXT m_name[MAX_NLEN];
 
-                                                       monster_desc(m_name, m_ptr, 0);
+                                                       monster_desc(shooter_ptr, m_name, m_ptr, 0);
 
                                                        stick_to = TRUE;
-                                                       msg_format(_("%sは%sに突き刺さった!", "%^s have stuck into %s!"), o_name, m_name);
+                                                       msg_format(_("%sは%sに突き刺さった!", "%^s is stuck in %s!"), o_name, m_name);
                                                }
 
-                                               message_pain(c_mon_ptr->m_idx, tdam);
+                                               message_pain(shooter_ptr, c_mon_ptr->m_idx, tdam);
 
                                                /* Anger the monster */
-                                               if (tdam > 0) anger_monster(m_ptr);
+                                               if (tdam > 0) anger_monster(shooter_ptr, m_ptr);
 
                                                if (fear && m_ptr->ml)
                                                {
                                                        GAME_TEXT m_name[MAX_NLEN];
                                                        sound(SOUND_FLEE);
-                                                       monster_desc(m_name, m_ptr, 0);
+                                                       monster_desc(shooter_ptr, m_name, m_ptr, 0);
                                                        msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
                                                }
 
@@ -786,7 +787,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                                                if (!player_can_enter(shooter_ptr, shooter_ptr->current_floor_ptr->grid_array[ny][nx].feat, 0)) break;
 
                                                                /* Stopped by monsters */
-                                                               if (!cave_empty_bold(shooter_ptr->current_floor_ptr, ny, nx)) break;
+                                                               if (!is_cave_empty_bold(shooter_ptr, ny, nx)) break;
 
                                                                shooter_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
                                                                shooter_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
@@ -796,8 +797,8 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
 
                                                                update_monster(shooter_ptr, c_mon_ptr->m_idx, TRUE);
 
-                                                               lite_spot(ny, nx);
-                                                               lite_spot(oy, ox);
+                                                               lite_spot(shooter_ptr, ny, nx);
+                                                               lite_spot(shooter_ptr, oy, ox);
 
                                                                Term_fresh();
                                                                Term_xtra(TERM_XTRA_DELAY, msec);
@@ -825,7 +826,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                }
 
                /* Chance of breakage (during attacks) */
-               j = (hit_body ? breakage_chance(q_ptr, shooter_ptr->pclass == CLASS_ARCHER, snipe_type) : 0);
+               j = (hit_body ? breakage_chance(shooter_ptr, q_ptr, shooter_ptr->pclass == CLASS_ARCHER, snipe_type) : 0);
 
                if (stick_to)
                {
@@ -835,7 +836,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
 
                        if (!o_idx)
                        {
-                               msg_format(_("%sはどこかへ行った。", "The %s have gone to somewhere."), o_name);
+                               msg_format(_("%sはどこかへ行った。", "The %s went somewhere."), o_name);
                                if (object_is_fixed_artifact(q_ptr))
                                {
                                        a_info[j_ptr->name1].cur_num = 0;
@@ -903,14 +904,14 @@ bool test_hit_fire(player_type *shooter_ptr, int chance, monster_type *m_ptr, in
        k += shooter_ptr->concent;
 
        /* Hack -- Instant miss or hit */
-       if (k <= 5) return (FALSE);
-       if (k > 95) return (TRUE);
+       if (k <= 5) return FALSE;
+       if (k > 95) return TRUE;
 
        if (shooter_ptr->pseikaku == SEIKAKU_NAMAKE)
-               if (one_in_(20)) return (FALSE);
+               if (one_in_(20)) return FALSE;
 
        /* Never hit */
-       if (chance <= 0) return (FALSE);
+       if (chance <= 0) return FALSE;
 
        ac = r_ptr->ac;
        if (shooter_ptr->concent)
@@ -930,14 +931,14 @@ bool test_hit_fire(player_type *shooter_ptr, int chance, monster_type *m_ptr, in
                if (m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
                {
                        GAME_TEXT m_name[MAX_NLEN];
-                       monster_desc(m_name, m_ptr, 0);
+                       monster_desc(shooter_ptr, m_name, m_ptr, 0);
                        msg_format(_("%sは%sを斬り捨てた!", "%s cuts down %s!"), m_name, o_name);
                }
-               return (FALSE);
+               return FALSE;
        }
 
        /* Assume hit */
-       return (TRUE);
+       return TRUE;
 }
 
 
@@ -1193,6 +1194,7 @@ HIT_POINT calc_expect_crit_shot(player_type *shooter_ptr, WEIGHT weight, int plu
 
 /*!
  * @brief 攻撃時クリティカルによるダメージ期待値修正計算(重量と毒針処理) / critical happens at i / 10000
+ * @param shooter_ptr プレーヤーへの参照ポインタ
  * @param weight 武器の重量
  * @param plus 武器のダメージ修正
  * @param dam 基本ダメージ
@@ -1200,14 +1202,12 @@ HIT_POINT calc_expect_crit_shot(player_type *shooter_ptr, WEIGHT weight, int plu
  * @param dokubari 毒針処理か否か
  * @return ダメージ期待値
  */
-HIT_POINT calc_expect_crit(WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari)
+HIT_POINT calc_expect_crit(player_type *shooter_ptr, WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari)
 {
        u32b k, num;
-       int i;
-
        if (dokubari) return dam;
 
-       i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
+       int i = (weight + (meichuu * 3 + plus * 5) + shooter_ptr->skill_thn);
        if (i < 0) i = 0;
 
        k = weight;
@@ -1220,7 +1220,7 @@ HIT_POINT calc_expect_crit(WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu,
        if (k > (1300 - 650))                                   num += (7 * dam / 2 + 25) * MIN(650, k - (1300 - 650));
 
        num /= 650;
-       if (p_ptr->pclass == CLASS_NINJA)
+       if (shooter_ptr->pclass == CLASS_NINJA)
        {
                num *= i;
                num += (4444 - i) * dam;