OSDN Git Service

[Refactor] #38997 identify_fully() にplayer_type * 引数を追加 / Added player_type * argumen...
[hengband/hengband.git] / src / cmd / cmd-activate.c
index 030b267..e76347d 100644 (file)
@@ -37,6 +37,7 @@
 #include "player-race.h"
 #include "player-class.h"
 #include "view-mainwindow.h"
+#include "world.h"
 
 /*!
  * @brief 装備耐性に準じたブレス効果の選択テーブル /
@@ -343,7 +344,7 @@ const activation_type activation_info[] =
  * <pre>
  * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
  * But one could, for example, easily make an activatable "Ring of Plasma".
- * Note that it always takes a current_world_ptr->game_turn to activate an artifact, even if
+ * Note that it always takes a turn to activate an artifact, even if
  * the user hits "escape" at the "direction" prompt.
  * </pre>
  */
@@ -355,7 +356,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
        object_type *o_ptr;
        bool success;
 
-       o_ptr = REF_ITEM(user_ptr, current_floor_ptr, item);
+       o_ptr = REF_ITEM(user_ptr, user_ptr->current_floor_ptr, item);
        take_turn(user_ptr, 100);
        lev = k_info[o_ptr->k_idx].level;
 
@@ -441,7 +442,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
        else if (o_ptr->tval == TV_WHISTLE)
        {
                if (music_singing_any(user_ptr)) stop_singing(user_ptr);
-               if (hex_spelling_any(user_ptr)) stop_hex_spell_all();
+               if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
 
                {
                        MONSTER_IDX pet_ctr, i;
@@ -450,12 +451,12 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                        u16b dummy_why;
 
                        /* Allocate the "who" array */
-                       C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX);
+                       C_MAKE(who, current_world_ptr->max_m_idx, MONSTER_IDX);
 
                        /* Process the monsters (backwards) */
-                       for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
+                       for (pet_ctr = user_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
                        {
-                               if (is_pet(&current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
+                               if (is_pet(&user_ptr->current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
                                  who[max_pet++] = pet_ctr;
                        }
 
@@ -465,11 +466,11 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                        for (i = 0; i < max_pet; i++)
                        {
                                pet_ctr = who[i];
-                               teleport_monster_to(pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
+                               teleport_monster_to(user_ptr, pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
                        }
 
                        /* Free the "who" array */
-                       C_KILL(who, current_floor_ptr->max_m_idx, MONSTER_IDX);
+                       C_KILL(who, current_world_ptr->max_m_idx, MONSTER_IDX);
                }
                o_ptr->timeout = 100 + randint1(100);
                return;
@@ -487,7 +488,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                        }
                        target_pet = old_target_pet;
 
-                       if(fire_ball(GF_CAPTURE, dir, 0, 0))
+                       if(fire_ball(user_ptr, GF_CAPTURE, dir, 0, 0))
                        {
                                o_ptr->pval = (PARAMETER_VALUE)cap_mon;
                                o_ptr->xtra3 = (XTRA8)cap_mspeed;
@@ -535,15 +536,15 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                else
                {
                        success = FALSE;
-                       if (!get_direction(&dir, FALSE, FALSE)) return;
+                       if (!get_direction(user_ptr, &dir, FALSE, FALSE)) return;
                        if (monster_can_enter(user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
                        {
                                if (place_monster_aux(0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
                                {
-                                       if (o_ptr->xtra3) current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
-                                       if (o_ptr->xtra5) current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
-                                       if (o_ptr->xtra4) current_floor_ptr->m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
-                                       current_floor_ptr->m_list[hack_m_idx_ii].maxhp = current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp;
+                                       if (o_ptr->xtra3) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
+                                       if (o_ptr->xtra5) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
+                                       if (o_ptr->xtra4) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
+                                       user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].maxhp = user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp;
                                        if (o_ptr->inscription)
                                        {
                                                char buf[80];
@@ -585,7 +586,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                                                                s--;
 #endif
                                                        *s = '\0';
-                                                       current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
+                                                       user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
                                                        t = quark_str(o_ptr->inscription);
                                                        s = buf;
                                                        while(*t && (*t != '#'))
@@ -618,6 +619,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
 
 /*!
  * @brief 装備を発動するコマンドのメインルーチン /
+ * @param user_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
 void do_cmd_activate(player_type *user_ptr)
@@ -638,7 +640,7 @@ void do_cmd_activate(player_type *user_ptr)
        q = _("どのアイテムを始動させますか? ", "Activate which item? ");
        s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
 
-       if (!choose_object(p_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
+       if (!choose_object(user_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
 
        /* Activate the item */
        exe_activate(user_ptr, item);
@@ -647,6 +649,7 @@ void do_cmd_activate(player_type *user_ptr)
 /*!
 * @brief 発動によるブレスの属性をアイテムの耐性から選択し、実行を処理する。/ Dragon breath activation
 * @details 対象となる耐性は dragonbreath_info テーブルを参照のこと。
+* @param user_ptr プレーヤーへの参照ポインタ
 * @param o_ptr 対象のオブジェクト構造体ポインタ
 * @return 発動実行の是非を返す。
 */
@@ -675,11 +678,11 @@ static bool activate_dragon_breath(player_type *user_ptr, object_type *o_ptr)
 
        /* Stop speaking */
        if (music_singing_any(user_ptr)) stop_singing(user_ptr);
-       if (hex_spelling_any(user_ptr)) stop_hex_spell_all();
+       if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
 
        t = randint0(n);
        msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
-       fire_breath(type[t], dir, 250, 4);
+       fire_breath(user_ptr, type[t], dir, 250, 4);
 
        return TRUE;
 }
@@ -687,6 +690,7 @@ static bool activate_dragon_breath(player_type *user_ptr, object_type *o_ptr)
 
 /*!
  * @brief アイテムの発動効果を処理する。
+ * @param user_ptr プレーヤーへの参照ポインタ
  * @param o_ptr 対象のオブジェクト構造体ポインタ
  * @return 発動実行の是非を返す。
  */
@@ -710,7 +714,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (!get_aim_dir(&dir)) return FALSE;
                msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
-               (void)lite_line(dir, damroll(6, 8));
+               (void)lite_line(user_ptr, dir, damroll(6, 8));
                break;
        }
 
@@ -718,7 +722,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは眩しいくらいに明るく輝いている...", "It glows extremely brightly..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt(GF_MISSILE, dir, damroll(2, 6));
+               fire_bolt(user_ptr, GF_MISSILE, dir, damroll(2, 6));
                break;
        }
 
@@ -726,7 +730,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは濃緑色に脈動している...", "It throbs deep green..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_POIS, dir, 12, 3);
+               fire_ball(user_ptr, GF_POIS, dir, 12, 3);
                break;
        }
 
@@ -734,7 +738,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは火花に覆われた...", "It is covered in sparks..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt(GF_ELEC, dir, damroll(4, 8));
+               fire_bolt(user_ptr, GF_ELEC, dir, damroll(4, 8));
                break;
        }
 
@@ -742,7 +746,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは酸に覆われた...", "It is covered in acid..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt(GF_ACID, dir, damroll(5, 8));
+               fire_bolt(user_ptr, GF_ACID, dir, damroll(5, 8));
                break;
        }
 
@@ -750,7 +754,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt(GF_COLD, dir, damroll(6, 8));
+               fire_bolt(user_ptr, GF_COLD, dir, damroll(6, 8));
                break;
        }
 
@@ -758,7 +762,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは炎に覆われた...", "It is covered in fire..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt(GF_FIRE, dir, damroll(9, 8));
+               fire_bolt(user_ptr, GF_FIRE, dir, damroll(9, 8));
                break;
        }
 
@@ -766,7 +770,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_COLD, dir, 48, 2);
+               fire_ball(user_ptr, GF_COLD, dir, 48, 2);
                break;
        }
 
@@ -774,7 +778,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは青く激しく輝いた...", "It glows an intense blue..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_COLD, dir, 100, 2);
+               fire_ball(user_ptr, GF_COLD, dir, 100, 2);
                break;
        }
 
@@ -782,7 +786,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("明るく白色に輝いている...", "It glows bright white..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_COLD, dir, 400, 3);
+               fire_ball(user_ptr, GF_COLD, dir, 400, 3);
                break;
        }
 
@@ -790,7 +794,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_FIRE, dir, 72, 2);
+               fire_ball(user_ptr, GF_FIRE, dir, 72, 2);
                break;
        }
 
@@ -798,7 +802,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("%sから炎が吹き出した...", "The %s rages in fire..."), name);
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_FIRE, dir, 120, 3);
+               fire_ball(user_ptr, GF_FIRE, dir, 120, 3);
                break;
        }
 
@@ -806,7 +810,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("深赤色に輝いている...", "It glows deep red..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_FIRE, dir, 300, 3);
+               fire_ball(user_ptr, GF_FIRE, dir, 300, 3);
                break;
        }
 
@@ -814,7 +818,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_FIRE, dir, 100, 2);
+               fire_ball(user_ptr, GF_FIRE, dir, 100, 2);
                break;
        }
 
@@ -822,7 +826,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("電気がパチパチ音を立てた...", "It crackles with electricity..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_ELEC, dir, 100, 3);
+               fire_ball(user_ptr, GF_ELEC, dir, 100, 3);
                break;
        }
 
@@ -830,7 +834,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("深青色に輝いている...", "It glows deep blue..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_ELEC, dir, 500, 3);
+               fire_ball(user_ptr, GF_ELEC, dir, 500, 3);
                break;
        }
 
@@ -838,7 +842,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは黒く激しく輝いた...", "It glows an intense black..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_ACID, dir, 100, 2);
+               fire_ball(user_ptr, GF_ACID, dir, 100, 2);
                break;
        }
 
@@ -846,7 +850,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("それは緑に激しく輝いた...", "It glows an intense green..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_NUKE, dir, 100, 2);
+               fire_ball(user_ptr, GF_NUKE, dir, 100, 2);
                break;
        }
 
@@ -854,7 +858,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
                if (!get_aim_dir(&dir)) return FALSE;
-               if (hypodynamic_bolt(dir, 100))
+               if (hypodynamic_bolt(user_ptr, dir, 100))
                        break;
        }
 
@@ -862,7 +866,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("黒く輝いている...", "It glows black..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               hypodynamic_bolt(dir, 120);
+               hypodynamic_bolt(user_ptr, dir, 120);
                break;
        }
 
@@ -871,7 +875,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                if (!get_aim_dir(&dir)) return FALSE;
                for (dummy = 0; dummy < 3; dummy++)
                {
-                       if (hypodynamic_bolt(dir, 50))
+                       if (hypodynamic_bolt(user_ptr, dir, 50))
                                hp_player(user_ptr, 50);
                }
                break;
@@ -881,13 +885,13 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("魔法のトゲが現れた...", "It grows magical spikes..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt(GF_ARROW, dir, 150);
+               fire_bolt(user_ptr, GF_ARROW, dir, 150);
                break;
        }
 
        case ACT_WHIRLWIND:
        {
-               massacre();
+               massacre(user_ptr);
                break;
        }
 
@@ -896,7 +900,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                if (!get_aim_dir(&dir)) return FALSE;
                for (dummy = 0; dummy < 3; dummy++)
                {
-                       if (hypodynamic_bolt(dir, 100))
+                       if (hypodynamic_bolt(user_ptr, dir, 100))
                                hp_player(user_ptr, 100);
                }
                break;
@@ -906,7 +910,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_CALL_CHAOS:
        {
                msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
-               call_chaos();
+               call_chaos(user_ptr);
                break;
        }
 
@@ -914,14 +918,14 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (!get_aim_dir(&dir)) return FALSE;
                msg_print(_("ロケットを発射した!", "You launch a rocket!"));
-               fire_ball(GF_ROCKET, dir, 250 + plev * 3, 2);
+               fire_ball(user_ptr, GF_ROCKET, dir, 250 + plev * 3, 2);
                break;
        }
 
        case ACT_DISP_EVIL:
        {
                msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
-               dispel_evil(user_ptr->lev * 5);
+               dispel_evil(user_ptr, user_ptr->lev * 5);
                break;
        }
 
@@ -929,14 +933,14 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (!get_aim_dir(&dir)) return FALSE;
                msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
-               fire_breath(GF_MISSILE, dir, 300, 4);
+               fire_breath(user_ptr, GF_MISSILE, dir, 300, 4);
                break;
        }
 
        case ACT_DISP_GOOD:
        {
                msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
-               dispel_good(user_ptr->lev * 5);
+               dispel_good(user_ptr, user_ptr->lev * 5);
                break;
        }
 
@@ -944,7 +948,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("%sに魔法のトゲが現れた...", "The %s grows magical spikes..."), name);
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_bolt(GF_ARROW, dir, 150);
+               fire_bolt(user_ptr, GF_ARROW, dir, 150);
                break;
        }
 
@@ -952,7 +956,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("%sが深い青色に鼓動している...", "The %s throbs deep blue..."), name);
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_WATER, dir, 200, 3);
+               fire_ball(user_ptr, GF_WATER, dir, 200, 3);
                break;
        }
 
@@ -960,7 +964,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("%sが深い闇に覆われた...", "The %s is coverd in pitch-darkness..."), name);
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_DARK, dir, 250, 4);
+               fire_ball(user_ptr, GF_DARK, dir, 250, 4);
                break;
        }
 
@@ -968,22 +972,22 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_ball(GF_MANA, dir, 250, 4);
+               fire_ball(user_ptr, GF_MANA, dir, 250, 4);
                break;
        }
 
        case ACT_PESTICIDE:
        {
                msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
-               (void)dispel_monsters(4);
+               (void)dispel_monsters(user_ptr, 4);
                break;
        }
 
        case ACT_BLINDING_LIGHT:
        {
                msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
-               fire_ball(GF_LITE, 0, 300, 6);
-               confuse_monsters(3 * user_ptr->lev / 2);
+               fire_ball(user_ptr, GF_LITE, 0, 300, 6);
+               confuse_monsters(user_ptr, 3 * user_ptr->lev / 2);
                break;
        }
 
@@ -991,7 +995,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("%sは漆黒に輝いた...", "The %s glows intensely black..."), name);
                if (!get_aim_dir(&dir)) return FALSE;
-               ring_of_power(dir);
+               ring_of_power(user_ptr, dir);
                break;
        }
 
@@ -1007,12 +1011,12 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
                        while (attempts--)
                        {
-                               scatter(&y, &x, user_ptr->y, user_ptr->x, 4, 0);
-                               if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
-                               if (!player_bold(y, x)) break;
+                               scatter(user_ptr->current_floor_ptr, &y, &x, user_ptr->y, user_ptr->x, 4, 0);
+                               if (!cave_have_flag_bold(user_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
+                               if (!player_bold(user_ptr, y, x)) break;
                        }
 
-                       project(0, 3, y, x, 150, GF_ELEC,
+                       project(user_ptr, 0, 3, y, x, 150, GF_ELEC,
                                (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
                }
 
@@ -1023,7 +1027,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (!get_aim_dir(&dir)) return FALSE;
                msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
-               fire_breath(GF_MISSILE, dir, 300, 4);
+               fire_breath(user_ptr, GF_MISSILE, dir, 300, 4);
                msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
                (void)set_afraid(user_ptr, 0);
                (void)set_hero(user_ptr, randint1(50) + 50, FALSE);
@@ -1040,7 +1044,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_BR_FIRE:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_breath(GF_FIRE, dir, 200, 2);
+               fire_breath(user_ptr, GF_FIRE, dir, 200, 2);
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
                {
                        (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
@@ -1051,7 +1055,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_BR_COLD:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_breath(GF_COLD, dir, 200, 2);
+               fire_breath(user_ptr, GF_COLD, dir, 200, 2);
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
                {
                        (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
@@ -1077,32 +1081,32 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_SLEEP:
        {
                msg_print(_("深青色に輝いている...", "It glows deep blue..."));
-               sleep_monsters_touch();
+               sleep_monsters_touch(user_ptr);
                break;
        }
 
        case ACT_QUAKE:
        {
-               earthquake(user_ptr->y, user_ptr->x, 5, 0);
+               earthquake(user_ptr, user_ptr->y, user_ptr->x, 5, 0);
                break;
        }
 
        case ACT_TERROR:
        {
-               turn_monsters(40 + user_ptr->lev);
+               turn_monsters(user_ptr, 40 + user_ptr->lev);
                break;
        }
 
        case ACT_TELE_AWAY:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               (void)fire_beam(GF_AWAY_ALL, dir, plev);
+               (void)fire_beam(user_ptr, GF_AWAY_ALL, dir, plev);
                break;
        }
 
        case ACT_BANISH_EVIL:
        {
-               if (banish_evil(100))
+               if (banish_evil(user_ptr, 100))
                {
                        msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
                }
@@ -1112,24 +1116,24 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_GENOCIDE:
        {
                msg_print(_("深青色に輝いている...", "It glows deep blue..."));
-               (void)symbol_genocide(200, TRUE);
+               (void)symbol_genocide(user_ptr, 200, TRUE);
                break;
        }
 
        case ACT_MASS_GENO:
        {
                msg_print(_("ひどく鋭い音が流れ出た...", "It lets out a long, shrill note..."));
-               (void)mass_genocide(200, TRUE);
+               (void)mass_genocide(user_ptr, 200, TRUE);
                break;
        }
 
        case ACT_SCARE_AREA:
        {
                if (music_singing_any(user_ptr)) stop_singing(user_ptr);
-               if (hex_spelling_any(user_ptr)) stop_hex_spell_all();
+               if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
                msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!",
                        "You wind a mighty blast; your enemies tremble!"));
-               (void)turn_monsters((3 * user_ptr->lev / 2) + 10);
+               (void)turn_monsters(user_ptr, (3 * user_ptr->lev / 2) + 10);
                break;
        }
 
@@ -1143,7 +1147,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                {
                        msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
                }
-               aggravate_monsters(0);
+               aggravate_monsters(user_ptr, 0);
                break;
        }
 
@@ -1152,33 +1156,33 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_CHARM_ANIMAL:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               (void)charm_animal(dir, plev);
+               (void)charm_animal(user_ptr, dir, plev);
                break;
        }
 
        case ACT_CHARM_UNDEAD:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               (void)control_one_undead(dir, plev);
+               (void)control_one_undead(user_ptr, dir, plev);
                break;
        }
 
        case ACT_CHARM_OTHER:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               (void)charm_monster(dir, plev * 2);
+               (void)charm_monster(user_ptr, dir, plev * 2);
                break;
        }
 
        case ACT_CHARM_ANIMALS:
        {
-               (void)charm_animals(plev * 2);
+               (void)charm_animals(user_ptr, plev * 2);
                break;
        }
 
        case ACT_CHARM_OTHERS:
        {
-               charm_monsters(plev * 2);
+               charm_monsters(user_ptr, plev * 2);
                break;
        }
 
@@ -1191,7 +1195,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_SUMMON_PHANTOM:
        {
                msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
-               (void)summon_specific(-1, user_ptr->y, user_ptr->x, current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(-1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
@@ -1201,7 +1205,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        case ACT_SUMMON_DEMON:
        {
-               cast_summon_demon((plev * 3) / 2);
+               cast_summon_demon(user_ptr, (plev * 3) / 2);
                break;
        }
 
@@ -1216,7 +1220,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_SUMMON_DAWN:
        {
                msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
-               (void)summon_specific(-1, user_ptr->y, user_ptr->x, current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(-1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
                break;
        }
 
@@ -1229,7 +1233,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_CHOIR_SINGS:
        {
                msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
-               (void)cure_critical_wounds(777);
+               (void)cure_critical_wounds(user_ptr, 777);
                (void)set_hero(user_ptr, randint1(25) + 25, FALSE);
                break;
        }
@@ -1244,7 +1248,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_CURE_MW:
        {
                msg_print(_("深紫色の光を発している...", "It radiates deep purple..."));
-               (void)cure_serious_wounds(4, 8);
+               (void)cure_serious_wounds(user_ptr, 4, 8);
                break;
        }
 
@@ -1266,7 +1270,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_REST_ALL:
        {
                msg_print(_("濃緑色に輝いている...", "It glows a deep green..."));
-               (void)restore_all_status();
+               (void)restore_all_status(user_ptr);
                (void)restore_level(user_ptr);
                break;
        }
@@ -1275,7 +1279,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("深青色に輝いている...", "It glows deep blue..."));
                msg_print(_("体内に暖かい鼓動が感じられる...", "You feel a warm tingling inside..."));
-               (void)cure_critical_wounds(700);
+               (void)cure_critical_wounds(user_ptr, 700);
                break;
        }
 
@@ -1283,21 +1287,21 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("白く明るく輝いている...", "It glows a bright white..."));
                msg_print(_("ひじょうに気分がよい...", "You feel much better..."));
-               (void)cure_critical_wounds(1000);
+               (void)cure_critical_wounds(user_ptr, 1000);
                break;
        }
 
        case ACT_CURING:
        {
                msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
-               true_healing(0);
+               true_healing(user_ptr, 0);
                break;
        }
 
        case ACT_CURE_MANA_FULL:
        {
                msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
-               restore_mana(TRUE);
+               restore_mana(user_ptr, TRUE);
                break;
        }
 
@@ -1311,7 +1315,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        case ACT_BERSERK:
        {
-               (void)berserk(randint1(25) + 25);
+               (void)berserk(user_ptr, randint1(25) + 25);
                break;
        }
 
@@ -1362,14 +1366,14 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        case ACT_HERO:
        {
-               (void)heroism(25);
+               (void)heroism(user_ptr, 25);
                break;
        }
 
        case ACT_HERO_SPEED:
        {
                (void)set_fast(user_ptr, randint1(50) + 50, FALSE);
-               (void)heroism(50);
+               (void)heroism(user_ptr, 50);
                break;
        }
 
@@ -1379,7 +1383,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
                {
                        if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_ACID, dir, 100, 2);
+                       fire_ball(user_ptr, GF_ACID, dir, 100, 2);
                }
                (void)set_oppose_acid(user_ptr, randint1(20) + 20, FALSE);
                break;
@@ -1391,7 +1395,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
                {
                        if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_FIRE, dir, 100, 2);
+                       fire_ball(user_ptr, GF_FIRE, dir, 100, 2);
                }
                (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
                break;
@@ -1403,7 +1407,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
                {
                        if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_COLD, dir, 100, 2);
+                       fire_ball(user_ptr, GF_COLD, dir, 100, 2);
                }
                (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
                break;
@@ -1415,7 +1419,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
                {
                        if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_ELEC, dir, 100, 2);
+                       fire_ball(user_ptr, GF_ELEC, dir, 100, 2);
                }
                (void)set_oppose_elec(user_ptr, randint1(20) + 20, FALSE);
                break;
@@ -1433,15 +1437,15 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_LIGHT:
        {
                msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
-               lite_area(damroll(2, 15), 3);
+               lite_area(user_ptr, damroll(2, 15), 3);
                break;
        }
 
        case ACT_MAP_LIGHT:
        {
                msg_print(_("眩しく輝いた...", "It shines brightly..."));
-               map_area(DETECT_RAD_MAP);
-               lite_area(damroll(2, 15), 3);
+               map_area(user_ptr, DETECT_RAD_MAP);
+               lite_area(user_ptr, damroll(2, 15), 3);
                break;
        }
 
@@ -1449,43 +1453,43 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("白く明るく輝いている...", "It glows bright white..."));
                msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
-               detect_all(DETECT_RAD_DEFAULT);
+               detect_all(user_ptr, DETECT_RAD_DEFAULT);
                break;
        }
 
        case ACT_DETECT_XTRA:
        {
                msg_print(_("明るく輝いている...", "It glows brightly..."));
-               detect_all(DETECT_RAD_DEFAULT);
-               probing();
-               identify_fully(FALSE);
+               detect_all(user_ptr, DETECT_RAD_DEFAULT);
+               probing(user_ptr);
+               identify_fully(user_ptr, FALSE);
                break;
        }
 
        case ACT_ID_FULL:
        {
                msg_print(_("黄色く輝いている...", "It glows yellow..."));
-               identify_fully(FALSE);
+               identify_fully(user_ptr, FALSE);
                break;
        }
 
        case ACT_ID_PLAIN:
        {
-               if (!ident_spell(FALSE)) return FALSE;
+               if (!ident_spell(user_ptr, FALSE)) return FALSE;
                break;
        }
 
        case ACT_RUNE_EXPLO:
        {
                msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
-               explosive_rune();
+               explosive_rune(user_ptr->current_floor_ptr, user_ptr->y, user_ptr->x);
                break;
        }
 
        case ACT_RUNE_PROT:
        {
                msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
-               warding_glyph();
+               warding_glyph(user_ptr);
                break;
        }
 
@@ -1498,7 +1502,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_DEST_DOOR:
        {
                msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
-               destroy_doors_touch();
+               destroy_doors_touch(user_ptr);
                break;
        }
 
@@ -1506,20 +1510,20 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("鼓動している...", "It pulsates..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               wall_to_mud(dir, 20 + randint1(30));
+               wall_to_mud(user_ptr, dir, 20 + randint1(30));
                break;
        }
 
        case ACT_RECHARGE:
        {
-               recharge(130);
+               recharge(user_ptr, 130);
                break;
        }
 
        case ACT_ALCHEMY:
        {
                msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
-               (void)alchemy();
+               (void)alchemy(user_ptr);
                break;
        }
 
@@ -1534,7 +1538,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_TELEPORT:
        {
                msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
-               teleport_player(100, 0L);
+               teleport_player(user_ptr, 100, 0L);
                break;
        }
 
@@ -1550,14 +1554,14 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                msg_format(_("%sは赤く明るく光った!", "The %s flashes bright red!"), name);
                chg_virtue(user_ptr, V_KNOWLEDGE, 1);
                chg_virtue(user_ptr, V_ENLIGHTEN, 1);
-               wiz_lite(FALSE);
+               wiz_lite(user_ptr, FALSE);
 
                msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
                take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
 
-               (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
-               (void)detect_doors(DETECT_RAD_DEFAULT);
-               (void)detect_stairs(DETECT_RAD_DEFAULT);
+               (void)detect_traps(user_ptr, DETECT_RAD_DEFAULT, TRUE);
+               (void)detect_doors(user_ptr, DETECT_RAD_DEFAULT);
+               (void)detect_stairs(user_ptr, DETECT_RAD_DEFAULT);
 
                if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
                {
@@ -1571,7 +1575,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (!get_aim_dir(&dir)) return FALSE;
                msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
-               fetch(dir, 500, TRUE);
+               fetch(user_ptr, dir, 500, TRUE);
                break;
        }
 
@@ -1582,9 +1586,9 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                monster_race *r_ptr;
                msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
                /* Process the monsters (backwards) */
-               for (i = current_floor_ptr->m_max - 1; i >= 1; i--)
+               for (i = user_ptr->current_floor_ptr->m_max - 1; i >= 1; i--)
                {
-                       m_ptr = &current_floor_ptr->m_list[i];
+                       m_ptr = &user_ptr->current_floor_ptr->m_list[i];
 
                        /* Ignore "dead" monsters */
                        if (!monster_is_valid(m_ptr)) continue;
@@ -1604,18 +1608,18 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                switch (randint1(13))
                {
                case 1: case 2: case 3: case 4: case 5:
-                       teleport_player(10, 0L);
+                       teleport_player(user_ptr, 10, 0L);
                        break;
                case 6: case 7: case 8: case 9: case 10:
-                       teleport_player(222, 0L);
+                       teleport_player(user_ptr, 222, 0L);
                        break;
                case 11: case 12:
-                       (void)stair_creation();
+                       (void)stair_creation(user_ptr);
                        break;
                default:
                        if (get_check(_("この階を去りますか?", "Leave this level? ")))
                        {
-                               if (autosave_l) do_cmd_save_game(TRUE);
+                               if (autosave_l) do_cmd_save_game(user_ptr, TRUE);
                                user_ptr->leaving = TRUE;
                        }
                }
@@ -1625,22 +1629,22 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_DISP_CURSE_XTRA:
        {
                msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
-               (void)remove_all_curse();
-               (void)probing();
+               (void)remove_all_curse(user_ptr);
+               (void)probing(user_ptr);
                break;
        }
 
        case ACT_BRAND_FIRE_BOLTS:
        {
                msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
-               (void)brand_bolts();
+               brand_bolts(user_ptr);
                break;
        }
 
        case ACT_RECHARGE_XTRA:
        {
                msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
-               if (!recharge(1000)) return FALSE;
+               if (!recharge(user_ptr, 1000)) return FALSE;
                break;
        }
 
@@ -1654,20 +1658,20 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
                (void)set_afraid(user_ptr, 0);
                (void)set_hero(user_ptr, randint1(20) + 20, FALSE);
-               dispel_evil(user_ptr->lev * 3);
+               dispel_evil(user_ptr, user_ptr->lev * 3);
                break;
        }
 
        case ACT_PHASE_DOOR:
        {
-               teleport_player(10, 0L);
+               teleport_player(user_ptr, 10, 0L);
                break;
        }
 
        case ACT_DETECT_ALL_MONS:
        {
-               (void)detect_monsters_invis(255);
-               (void)detect_monsters_normal(255);
+               (void)detect_monsters_invis(user_ptr, 255);
+               (void)detect_monsters_normal(user_ptr, 255);
                break;
        }
 
@@ -1695,21 +1699,21 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("あなたは妖刀に魅入られた…", "You are enchanted by cursed blade..."));
                msg_print(_("「狂ほしく 血のごとき 月はのぼれり 秘めおきし 魔剣 いずこぞや」", "'Behold the blade arts.'"));
-               massacre();
+               massacre(user_ptr);
                break;
        }
 
        case ACT_GRAND_CROSS:
        {
                msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'"));
-               project(0, 8, user_ptr->y, user_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
+               project(user_ptr, 0, 8, user_ptr->y, user_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
                break;
        }
 
        case ACT_TELEPORT_LEVEL:
        {
                if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return FALSE;
-               teleport_level(0);
+               teleport_level(user_ptr, 0);
                break;
        }
 
@@ -1728,7 +1732,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                break;
 
        case ACT_INROU:
-               mitokohmon();
+               mitokohmon(user_ptr);
                break;
 
        case ACT_MURAMASA:
@@ -1742,7 +1746,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                        if (one_in_(2))
                        {
                                msg_print(_("村正は壊れた!", "The Muramasa is destroyed!"));
-                               curse_weapon_object(TRUE, o_ptr);
+                               curse_weapon_object(user_ptr, TRUE, o_ptr);
                        }
                }
                break;
@@ -1762,7 +1766,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_CRIMSON:
                if (o_ptr->name1 != ART_CRIMSON) return FALSE;
                msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
-               if (!fire_crimson()) return FALSE;
+               if (!fire_crimson(user_ptr)) return FALSE;
                break;
 
        default: