OSDN Git Service

[Refactor] #37353 chest_traps を trap.c へ移動。
[hengband/hengband.git] / src / cmd2.c
index 90b4c00..c5e3e64 100644 (file)
@@ -1,6 +1,8 @@
-/* File: cmd2.c */
-
-/*
+/*!
+ *  @file cmd2.c
+ *  @brief プレイヤーのコマンド処理2 / Movement commands (part 2)
+ *  @date 2014/01/02
+ *  @author
  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
  *
  * This software may be copied and distributed for educational, research,
  * are included in all such copies.  Other copyrights may also apply.
  */
 
-/* Purpose: Movement commands (part 2) */
-
 #include "angband.h"
+#include "chest.h"
+#include "trap.h"
+#include "floor.h"
+#include "melee.h"
+#include "object-hook.h"
+#include "projection.h"
+#include "spells-summon.h"
+#include "spells-status.h"
+#include "monster-status.h"
+#include "quest.h"
+#include "artifact.h"
+#include "avatar.h"
+#include "player-status.h"
+#include "realm-hex.h"
+#include "geometry.h"
+#include "wild.h"
+#include "grid.h"
+#include "feature.h"
+#include "player-move.h"
+#include "object-broken.h"
+
+/*!
+ * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
+ * @param down_stair TRUEならば階段を降りる処理、FALSEなら階段を昇る処理による内容
+ * @return フロア移動を実際に行うならTRUE、キャンセルする場合はFALSE
+ */
+static bool confirm_leave_level(bool down_stair)
+{
+       quest_type *q_ptr = &quest[p_ptr->inside_quest];
+
+       /* Confirm leaving from once only quest */
+       if (confirm_quest && p_ptr->inside_quest &&
+           (q_ptr->type == QUEST_TYPE_RANDOM ||
+            (q_ptr->flags & QUEST_FLAG_ONCE &&
+                                               q_ptr->status != QUEST_STATUS_COMPLETED) ||
+                (q_ptr->flags & QUEST_FLAG_TOWER &&
+                                               ((q_ptr->status != QUEST_STATUS_STAGE_COMPLETED) ||
+                                                (down_stair && (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))))))
+       {
+               msg_print(_("この階を一度去ると二度と戻って来られません。", "You can't come back here once you leave this floor."));
+               if (get_check(_("本当にこの階を去りますか?", "Really leave this floor? "))) return TRUE;
+       }
+       else
+       {
+               return TRUE;
+       }
+       return FALSE;
+}
+
+/*!
+ * @brief 魔法系コマンドが制限されているかを返す。
+ * @return 魔法系コマンドを使用可能ならFALSE、不可能ならば理由をメッセージ表示してTRUEを返す。
+ */
+bool cmd_limit_cast(player_type *creature_ptr)
+{
+       if (current_floor_ptr->dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
+       {
+               msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
+               msg_print(NULL);
+               return TRUE;
+       }
+       else if (creature_ptr->anti_magic)
+       {
+               msg_print(_("反魔法バリアが魔法を邪魔した!", "An anti-magic shell disrupts your magic!"));
+               return TRUE;
+       }
+       else if (creature_ptr->shero)
+       {
+               msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
+               return TRUE;
+       }
+       else
+               return FALSE;
+}
+
+bool cmd_limit_confused(player_type *creature_ptr)
+{
+       if (creature_ptr->confused)
+       {
+               msg_print(_("混乱していてできない!", "You are too confused!"));
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_image(player_type *creature_ptr)
+{
+       if (creature_ptr->image)
+       {
+               msg_print(_("幻覚が見えて集中できない!", "You are too hallucinated!"));
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_stun(player_type *creature_ptr)
+{
+       if (creature_ptr->stun)
+       {
+               msg_print(_("頭が朦朧としていて集中できない!", "You are too stuned!"));
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_arena(player_type *creature_ptr)
+{
+       if (creature_ptr->inside_arena)
+       {
+               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
+               msg_print(NULL);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_blind(player_type *creature_ptr)
+{
+       if (creature_ptr->blind)
+       {
+               msg_print(_("目が見えない。", "You can't see anything."));
+               return TRUE;
+       }
+       if (no_lite())
+       {
+               msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
+               return TRUE;
+       }
+       return FALSE;
+}
 
+bool cmd_limit_time_walk(player_type *creature_ptr)
+{
+       if (creature_ptr->timewalk)
+       {
+               if (flush_failure) flush();
+               msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
+               sound(SOUND_FAIL);
+               return TRUE;
+       }
+       return FALSE;
+}
 
-/*
- * Go up one level
+/*!
+ * @brief 階段を使って階層を昇る処理 / Go up one level
+ * @return なし
  */
 void do_cmd_go_up(void)
 {
        bool go_up = FALSE;
 
        /* Player grid */
-       cave_type *c_ptr = &cave[py][px];
-       feature_type *f_ptr = &f_info[c_ptr->feat];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        int up_num = 0;
 
@@ -34,87 +176,67 @@ void do_cmd_go_up(void)
        /* Verify stairs */
        if (!have_flag(f_ptr->flags, FF_LESS))
        {
-#ifdef JP
-               msg_print("¤³¤³¤Ë¤Ï¾å¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-               msg_print("I see no up staircase here.");
-#endif
-
+               msg_print(_("ここには上り階段が見当たらない。", "I see no up staircase here."));
                return;
        }
 
        /* Quest up stairs */
        if (have_flag(f_ptr->flags, FF_QUEST))
        {
+               /* Cancel the command */
+               if (!confirm_leave_level(FALSE)) return;
+       
+               
                /* Success */
-#ifdef JP
                if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-                       msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
+                       msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
                else
-                       msg_print("¾å¤Î³¬¤ËÅФä¿¡£");
-#else
-               msg_print("You enter the up staircase.");
-#endif
+                       msg_print(_("上の階に登った。", "You enter the up staircase."));
 
                leave_quest_check();
 
-               p_ptr->inside_quest = c_ptr->special;
+               p_ptr->inside_quest = g_ptr->special;
 
                /* Activate the quest */
                if (!quest[p_ptr->inside_quest].status)
                {
+                       if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
+                       {
+                               init_flags = INIT_ASSIGN;
+                               process_dungeon_file("q_info.txt", 0, 0, 0, 0);
+                       }
                        quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
                }
 
                /* Leaving a quest */
                if (!p_ptr->inside_quest)
                {
-                       dun_level = 0;
+                       current_floor_ptr->dun_level = 0;
                }
-
-               /* Leaving */
                p_ptr->leaving = TRUE;
 
                p_ptr->oldpx = 0;
                p_ptr->oldpy = 0;
+               
+               take_turn(p_ptr, 100);
 
                /* End the command */
                return;
        }
 
-       if (!dun_level)
+       if (!current_floor_ptr->dun_level)
        {
                go_up = TRUE;
        }
        else
        {
-               quest_type *q_ptr = &quest[p_ptr->inside_quest];
-
-               /* Confirm leaving from once only quest */
-               if (confirm_quest && p_ptr->inside_quest &&
-                   (q_ptr->type == QUEST_TYPE_RANDOM ||
-                    (q_ptr->flags & QUEST_FLAG_ONCE &&
-                     q_ptr->status != QUEST_STATUS_COMPLETED)))
-               {
-#ifdef JP
-                       msg_print("¤³¤Î³¬¤ò°ìÅÙµî¤ë¤ÈÆóÅÙ¤ÈÌá¤Ã¤ÆÍè¤é¤ì¤Þ¤»¤ó¡£");
-                       if (get_check("ËÜÅö¤Ë¤³¤Î³¬¤òµî¤ê¤Þ¤¹¤«¡©")) go_up = TRUE;
-#else
-                       msg_print("You can't come back here once you leave this floor.");
-                       if (get_check("Really leave this floor? ")) go_up = TRUE;
-#endif
-               }
-               else
-               {
-                       go_up = TRUE;
-               }
+               go_up = confirm_leave_level(FALSE);
        }
 
        /* Cancel the command */
        if (!go_up) return;
 
-       /* Hack -- take a turn */
-       energy_use = 100;
+       take_turn(p_ptr, 100);
 
        if (autosave_l) do_cmd_save_game(TRUE);
 
@@ -133,8 +255,8 @@ void do_cmd_go_up(void)
        {
                leave_quest_check();
 
-               p_ptr->inside_quest = c_ptr->special;
-               dun_level = 0;
+               p_ptr->inside_quest = g_ptr->special;
+               current_floor_ptr->dun_level = 0;
                up_num = 0;
        }
 
@@ -158,44 +280,31 @@ void do_cmd_go_up(void)
                }
 
                /* Get out from current dungeon */
-               if (dun_level - up_num < d_info[dungeon_type].mindepth)
-                       up_num = dun_level;
+               if (current_floor_ptr->dun_level - up_num < d_info[p_ptr->dungeon_idx].mindepth)
+                       up_num = current_floor_ptr->dun_level;
        }
-
-#ifdef JP
-       if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "³¬Ãʤò¾å¤Ã¤¿");
-#else
-       if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "climbed up the stairs to");
-#endif
+       if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
 
        /* Success */
-#ifdef JP
        if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-               msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
-       else if (up_num == dun_level)
-               msg_print("ÃϾå¤ËÌá¤Ã¤¿¡£");
+               msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
+       else if (up_num == current_floor_ptr->dun_level)
+               msg_print(_("地上に戻った。", "You go back to the surface."));
        else
-               msg_print("³¬Ãʤò¾å¤Ã¤Æ¿·¤¿¤Ê¤ë̵ܤؤÈ­¤òƧ¤ßÆþ¤ì¤¿¡£");
-#else
-       if (up_num == dun_level)
-               msg_print("You go back to the surface.");
-       else
-               msg_print("You enter a maze of up staircases.");
-#endif
-
-       /* Leaving */
+               msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases."));
        p_ptr->leaving = TRUE;
 }
 
 
-/*
- * Go down one level
+/*!
+ * @brief 階段を使って階層を降りる処理 / Go down one level
+ * @return なし
  */
 void do_cmd_go_down(void)
 {
        /* Player grid */
-       cave_type *c_ptr = &cave[py][px];
-       feature_type *f_ptr = &f_info[c_ptr->feat];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        bool fall_trap = FALSE;
        int down_num = 0;
@@ -208,12 +317,7 @@ void do_cmd_go_down(void)
        /* Verify stairs */
        if (!have_flag(f_ptr->flags, FF_MORE))
        {
-#ifdef JP
-               msg_print("¤³¤³¤Ë¤Ï²¼¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-               msg_print("I see no down staircase here.");
-#endif
-
+               msg_print(_("ここには下り階段が見当たらない。", "I see no down staircase here."));
                return;
        }
 
@@ -228,71 +332,66 @@ void do_cmd_go_down(void)
        /* Quest down stairs */
        else if (have_flag(f_ptr->flags, FF_QUEST))
        {
-#ifdef JP
+               /* Confirm Leaving */
+               if(!confirm_leave_level(TRUE)) return;
+               
                if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-                       msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
+                       msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
                else
-                       msg_print("²¼¤Î³¬¤Ë¹ß¤ê¤¿¡£");
-#else
-                       msg_print("You enter the down staircase.");
-#endif
-
+                       msg_print(_("下の階に降りた。", "You enter the down staircase."));
 
                leave_quest_check();
+               leave_tower_check();
 
-               p_ptr->inside_quest = c_ptr->special;
+               p_ptr->inside_quest = g_ptr->special;
 
                /* Activate the quest */
                if (!quest[p_ptr->inside_quest].status)
                {
+                       if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
+                       {
+                               init_flags = INIT_ASSIGN;
+                               process_dungeon_file("q_info.txt", 0, 0, 0, 0);
+                       }
                        quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
                }
 
                /* Leaving a quest */
                if (!p_ptr->inside_quest)
                {
-                       dun_level = 0;
+                       current_floor_ptr->dun_level = 0;
                }
-
-               /* Leaving */
                p_ptr->leaving = TRUE;
-
                p_ptr->oldpx = 0;
                p_ptr->oldpy = 0;
+               
+               take_turn(p_ptr, 100);
        }
 
        else
        {
-               int target_dungeon = 0;
+               DUNGEON_IDX target_dungeon = 0;
 
-               if (!dun_level)
+               if (!current_floor_ptr->dun_level)
                {
-                       target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? c_ptr->special : DUNGEON_ANGBAND;
+                       target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? g_ptr->special : DUNGEON_ANGBAND;
 
                        if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND))
                        {
-#ifdef JP
-                               msg_print("¥À¥ó¥¸¥ç¥ó¤ÎÆþ¸ý¤ÏºÉ¤¬¤ì¤Æ¤¤¤ë¡ª");
-#else
-                               msg_print("The entrance of this dungeon is closed!");
-#endif
+                               msg_print(_("ダンジョンの入口は塞がれている!", "The entrance of this dungeon is closed!"));
                                return;
                        }
                        if (!max_dlv[target_dungeon])
                        {
-#ifdef JP
-                               msg_format("¤³¤³¤Ë¤Ï%s¤ÎÆþ¤ê¸ý(%d³¬ÁêÅö)¤¬¤¢¤ê¤Þ¤¹", d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
-                               if (!get_check("ËÜÅö¤Ë¤³¤Î¥À¥ó¥¸¥ç¥ó¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return;
-#else
-                               msg_format("There is the entrance of %s (Danger level: %d)", d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
-                               if (!get_check("Do you really get in this dungeon? ")) return;
-#endif
+                               msg_format(_("ここには%sの入り口(%d階相当)があります", "There is the entrance of %s (Danger level: %d)"),
+                                                       d_name+d_info[target_dungeon].name, d_info[target_dungeon].mindepth);
+                               if (!get_check(_("本当にこのダンジョンに入りますか?", "Do you really get in this dungeon? "))) return;
                        }
 
                        /* Save old player position */
-                       p_ptr->oldpx = px;
-                       p_ptr->oldpy = py;
-                       dungeon_type = (byte)target_dungeon;
+                       p_ptr->oldpx = p_ptr->x;
+                       p_ptr->oldpy = p_ptr->y;
+                       p_ptr->dungeon_idx = target_dungeon;
 
                        /*
                         * Clear all saved floors
@@ -301,8 +400,7 @@ void do_cmd_go_down(void)
                        prepare_change_floor_mode(CFM_FIRST_FLOOR);
                }
 
-               /* Hack -- take a turn */
-               energy_use = 100;
+               take_turn(p_ptr, 100);
 
                if (autosave_l) do_cmd_save_game(TRUE);
 
@@ -310,58 +408,39 @@ void do_cmd_go_down(void)
                if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
                else down_num += 1;
 
-               if (!dun_level)
+               if (!current_floor_ptr->dun_level)
                {
                        /* Enter the dungeon just now */
                        p_ptr->enter_dungeon = TRUE;
-                       down_num = d_info[dungeon_type].mindepth;
+                       down_num = d_info[p_ptr->dungeon_idx].mindepth;
                }
 
                if (record_stair)
                {
-#ifdef JP
-                       if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "Í¸Í¤ËÍî¤Á¤¿");
-                       else do_cmd_write_nikki(NIKKI_STAIR, down_num, "³¬Ãʤò²¼¤ê¤¿");
-#else
-                       if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "fell through a trap door");
-                       else do_cmd_write_nikki(NIKKI_STAIR, down_num, "climbed down the stairs to");
-#endif
+                       if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, _("落とし戸に落ちた", "fell through a trap door"));
+                       else do_cmd_write_nikki(NIKKI_STAIR, down_num, _("階段を下りた", "climbed down the stairs to"));
                }
 
                if (fall_trap)
                {
-#ifdef JP
-                       msg_print("¤ï¤¶¤ÈÍ¸Í¤ËÍî¤Á¤¿¡£");
-#else
-                       msg_print("You deliberately jump through the trap door.");
-#endif
+                       msg_print(_("わざと落とし戸に落ちた。", "You deliberately jump through the trap door."));
                }
                else
                {
                        /* Success */
                        if (target_dungeon)
                        {
-#ifdef JP
-                               msg_format("%s¤ØÆþ¤Ã¤¿¡£", d_text + d_info[dungeon_type].text);
-#else
-                               msg_format("You entered %s.", d_text + d_info[dungeon_type].text);
-#endif
+                               msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[p_ptr->dungeon_idx].text);
                        }
                        else
                        {
-#ifdef JP
                                if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-                                       msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
+                                       msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
                                else
-                                       msg_print("³¬Ãʤò²¼¤ê¤Æ¿·¤¿¤Ê¤ë̵ܤؤÈ­¤òƧ¤ßÆþ¤ì¤¿¡£");
-#else
-                               msg_print("You enter a maze of down staircases.");
-#endif
+                                       msg_print(_("階段を下りて新たなる迷宮へと足を踏み入れた。", "You enter a maze of down staircases."));
                        }
                }
 
-
-               /* Leaving */
                p_ptr->leaving = TRUE;
 
                if (fall_trap)
@@ -385,9 +464,9 @@ void do_cmd_go_down(void)
 }
 
 
-
-/*
- * Simple command to "search" for one turn
+/*!
+ * @brief 探索コマンドのメインルーチン / Simple command to "search" for one current_world_ptr->game_turn
+ * @return なし
  */
 void do_cmd_search(void)
 {
@@ -396,475 +475,70 @@ void do_cmd_search(void)
        {
                /* Set repeat count */
                command_rep = command_arg - 1;
-
-               /* Redraw the state */
                p_ptr->redraw |= (PR_STATE);
 
                /* Cancel the arg */
                command_arg = 0;
        }
-
-       /* Take a turn */
-       energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Search */
        search();
 }
 
 
-/*
- * Determine if a grid contains a chest
+/*!
+ * @brief 該当のマスに存在している箱のオブジェクトIDを返す。
+ * @param y 走査対象にしたいマスのY座標
+ * @param x 走査対象にしたいマスのX座標
+ * @param trapped TRUEならばトラップが存在する箱のみ、FALSEならば空でない箱全てを対象にする
+ * @return 箱が存在する場合そのオブジェクトID、存在しない場合0を返す。
  */
-static s16b chest_check(int y, int x)
+static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
 {
-       cave_type *c_ptr = &cave[y][x];
-
-       s16b this_o_idx, next_o_idx = 0;
-
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        /* Scan all objects in the grid */
-       for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
+       for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
 
-               /* Acquire object */
-               o_ptr = &o_list[this_o_idx];
-
-               /* Acquire next object */
+               o_ptr = &current_floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
 
                /* Skip unknown chests XXX XXX */
                /* if (!(o_ptr->marked & OM_FOUND)) continue; */
 
-               /* Check for chest */
-               if (o_ptr->tval == TV_CHEST) return (this_o_idx);
-       }
-
-       /* No chest */
-       return (0);
-}
-
-
-/*
- * Allocates objects upon opening a chest    -BEN-
- *
- * Disperse treasures from the given chest, centered at (x,y).
- *
- * Small chests often contain "gold", while Large chests always contain
- * items.  Wooden chests contain 2 items, Iron chests contain 4 items,
- * and Steel chests contain 6 items.  The "value" of the items in a
- * chest is based on the "power" of the chest, which is in turn based
- * on the level on which the chest is generated.
- */
-static void chest_death(bool scatter, int y, int x, s16b o_idx)
-{
-       int number;
-
-       bool small;
-       u32b mode = AM_GOOD;
-
-       object_type forge;
-       object_type *q_ptr;
-
-       object_type *o_ptr = &o_list[o_idx];
-
-
-       /* Small chests often hold "gold" */
-       small = (o_ptr->sval < SV_CHEST_MIN_LARGE);
-
-       /* Determine how much to drop (see above) */
-       number = (o_ptr->sval % SV_CHEST_MIN_LARGE) * 2;
-
-       if (o_ptr->sval == SV_CHEST_KANDUME)
-       {
-               number = 5;
-               small = FALSE;
-               mode |= AM_GREAT;
-               object_level = o_ptr->xtra3;
-       }
-       else
-       {
-               /* Determine the "value" of the items */
-               object_level = ABS(o_ptr->pval) + 10;
-       }
-
-       /* Zero pval means empty chest */
-       if (!o_ptr->pval) number = 0;
-
-       /* Opening a chest */
-       opening_chest = TRUE;
-
-       /* Drop some objects (non-chests) */
-       for (; number > 0; --number)
-       {
-               /* Get local object */
-               q_ptr = &forge;
-
-               /* Wipe the object */
-               object_wipe(q_ptr);
-
-               /* Small chests often drop gold */
-               if (small && (randint0(100) < 25))
-               {
-                       /* Make some gold */
-                       if (!make_gold(q_ptr)) continue;
-               }
-
-               /* Otherwise drop an item */
-               else
-               {
-                       /* Make a good object */
-                       if (!make_object(q_ptr, mode)) continue;
-               }
-
-               /* If chest scatters its contents, pick any floor square. */
-               if (scatter)
-               {
-                       int i;
-                       for (i = 0; i < 200; i++)
-                       {
-                               /* Pick a totally random spot. */
-                               y = randint0(MAX_HGT);
-                               x = randint0(MAX_WID);
-
-                               /* Must be an empty floor. */
-                               if (!cave_empty_bold(y, x)) continue;
-
-                               /* Place the object there. */
-                               drop_near(q_ptr, -1, y, x);
-
-                               /* Done. */
-                               break;
-                       }
-               }
-               /* Normally, drop object near the chest. */
-               else drop_near(q_ptr, -1, y, x);
-       }
-
-       /* Reset the object level */
-       object_level = base_level;
-
-       /* No longer opening a chest */
-       opening_chest = FALSE;
-
-       /* Empty */
-       o_ptr->pval = 0;
-
-       /* Known */
-       object_known(o_ptr);
-}
-
-
-/*
- * Chests have traps too.
- *
- * Exploding chest destroys contents (and traps).
- * Note that the chest itself is never destroyed.
- */
-static void chest_trap(int y, int x, s16b o_idx)
-{
-       int  i, trap;
-
-       object_type *o_ptr = &o_list[o_idx];
-
-       int mon_level = o_ptr->xtra3;
-
-       /* Ignore disarmed chests */
-       if (o_ptr->pval <= 0) return;
-
-       /* Obtain the traps */
-       trap = chest_traps[o_ptr->pval];
-
-       /* Lose strength */
-       if (trap & (CHEST_LOSE_STR))
-       {
-#ifdef JP
-               msg_print("»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¾®¤µ¤Ê¿Ë¤Ë»É¤µ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "ÆÇ¿Ë", -1);
-#else
-               msg_print("A small needle has pricked you!");
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1);
-#endif
-
-               (void)do_dec_stat(A_STR);
-       }
-
-       /* Lose constitution */
-       if (trap & (CHEST_LOSE_CON))
-       {
-#ifdef JP
-               msg_print("»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¾®¤µ¤Ê¿Ë¤Ë»É¤µ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "ÆÇ¿Ë", -1);
-#else
-               msg_print("A small needle has pricked you!");
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1);
-#endif
-
-               (void)do_dec_stat(A_CON);
-       }
-
-       /* Poison */
-       if (trap & (CHEST_POISON))
-       {
-#ifdef JP
-               msg_print("ÆÍÇ¡¿á¤­½Ð¤·¤¿Îп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
-               msg_print("A puff of green gas surrounds you!");
-#endif
-
-               if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
-               {
-                       (void)set_poisoned(p_ptr->poisoned + 10 + randint1(20));
-               }
-       }
-
-       /* Paralyze */
-       if (trap & (CHEST_PARALYZE))
-       {
-#ifdef JP
-               msg_print("ÆÍÇ¡¿á¤­½Ð¤·¤¿²«¿§¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
-               msg_print("A puff of yellow gas surrounds you!");
-#endif
-
-
-               if (!p_ptr->free_act)
-               {
-                       (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20));
-               }
-       }
-
-       /* Summon monsters */
-       if (trap & (CHEST_SUMMON))
-       {
-               int num = 2 + randint1(3);
-#ifdef JP
-               msg_print("ÆÍÇ¡¿á¤­½Ð¤·¤¿±ì¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
-               msg_print("You are enveloped in a cloud of smoke!");
-#endif
-
-
-               for (i = 0; i < num; i++)
-               {
-                       if (randint1(100)<dun_level)
-                               activate_hi_summon(py, px, FALSE);
-                       else
-                               (void)summon_specific(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-               }
-       }
-
-       /* Elemental summon. */
-       if (trap & (CHEST_E_SUMMON))
-       {
-#ifdef JP
-               msg_print("Êõ¤ò¼é¤ë¤¿¤á¤Ë¥¨¥ì¥á¥ó¥¿¥ë¤¬¸½¤ì¤¿¡ª");
-#else
-               msg_print("Elemental beings appear to protect their treasures!");
-#endif
-               for (i = 0; i < randint1(3) + 5; i++)
-               {
-                       (void)summon_specific(0, y, x, mon_level, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-               }
-       }
-
-       /* Force clouds, then summon birds. */
-       if (trap & (CHEST_BIRD_STORM))
-       {
-#ifdef JP
-               msg_print("Ä»¤Î·²¤ì¤¬¤¢¤Ê¤¿¤ò¼è¤ê´¬¤¤¤¿¡ª");
-#else
-               msg_print("A storm of birds swirls around you!");
-#endif
-
-               for (i = 0; i < randint1(3) + 3; i++)
-                       (void)fire_meteor(-1, GF_FORCE, y, x, o_ptr->pval / 5, 7);
-
-               for (i = 0; i < randint1(5) + o_ptr->pval / 5; i++)
-               {
-                       (void)summon_specific(0, y, x, mon_level, SUMMON_BIRD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-               }
-       }
-
-       /* Various colorful summonings. */
-       if (trap & (CHEST_H_SUMMON))
-       {
-               /* Summon demons. */
-               if (one_in_(4))
-               {
-#ifdef JP
-                       msg_print("±ê¤Èⲫ¤Î±À¤ÎÃæ¤Ë°­Ë⤬»Ñ¤ò¸½¤·¤¿¡ª");
-#else
-                       msg_print("Demons materialize in clouds of fire and brimstone!");
-#endif
-
-                       for (i = 0; i < randint1(3) + 2; i++)
-                       {
-                               (void)fire_meteor(-1, GF_FIRE, y, x, 10, 5);
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                       }
-               }
-
-               /* Summon dragons. */
-               else if (one_in_(3))
-               {
-#ifdef JP
-                       msg_print("°Å°Ç¤Ë¥É¥é¥´¥ó¤Î±Æ¤¬¤Ü¤ó¤ä¤ê¤È¸½¤ì¤¿¡ª");
-#else
-                       msg_print("Draconic forms loom out of the darkness!");
-#endif
-
-                       for (i = 0; i < randint1(3) + 2; i++)
-                       {
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                       }
-               }
-
-               /* Summon hybrids. */
-               else if (one_in_(2))
-               {
-#ifdef JP
-                       msg_print("´ñ̯¤Ê»Ñ¤Î²øʪ¤¬½±¤Ã¤ÆÍ褿¡ª");
-#else
-                       msg_print("Creatures strange and twisted assault you!");
-#endif
-
-                       for (i = 0; i < randint1(5) + 3; i++)
-                       {
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_HYBRID, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                       }
-               }
-
-               /* Summon vortices (scattered) */
-               else
-               {
-#ifdef JP
-                       msg_print("±²´¬¤«¹çÂΤ·¡¢ÇËÎö¤·¤¿¡ª");
-#else
-                       msg_print("Vortices coalesce and wreak destruction!");
-#endif
-
-                       for (i = 0; i < randint1(3) + 2; i++)
-                       {
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_VORTEX, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                       }
-               }
-       }
-
-       /* Dispel player. */
-       if ((trap & (CHEST_RUNES_OF_EVIL)) && o_ptr->k_idx)
-       {
-               /* Determine how many nasty tricks can be played. */
-               int nasty_tricks_count = 4 + randint0(3);
-
-               /* Message. */
-#ifdef JP
-               msg_print("¶²¤·¤¤À¼¤¬¶Á¤¤¤¿:  ¡Ö°Å°Ç¤¬Æò¤ò¤Ä¤Ä¤Þ¤ó¡ª¡×");
-#else
-               msg_print("Hideous voices bid:  'Let the darkness have thee!'");
-#endif
-
-               /* This is gonna hurt... */
-               for (; nasty_tricks_count > 0; nasty_tricks_count--)
+               /* Check for non empty chest */
+               if ((o_ptr->tval == TV_CHEST) &&
+                       (((!trapped) && (o_ptr->pval)) || /* non empty */
+                       ((trapped) && (o_ptr->pval > 0)))) /* trapped only */
                {
-                       /* ...but a high saving throw does help a little. */
-                       if (randint1(100+o_ptr->pval*2) > p_ptr->skill_sav)
-                       {
-#ifdef JP
-                               if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "ÇËÌǤΥȥé¥Ã¥×¤ÎÊõÈ¢", -1);
-#else
-                               if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "a chest dispel-player trap", -1);
-#endif
-                               else if (one_in_(5)) (void)set_cut(p_ptr->cut + 200);
-                               else if (one_in_(4))
-                               {
-                                       if (!p_ptr->free_act) 
-                                               (void)set_paralyzed(p_ptr->paralyzed + 2 + 
-                                               randint0(6));
-                                       else 
-                                               (void)set_stun(p_ptr->stun + 10 + 
-                                               randint0(100));
-                               }
-                               else if (one_in_(3)) apply_disenchant(0);
-                               else if (one_in_(2))
-                               {
-                                       (void)do_dec_stat(A_STR);
-                                       (void)do_dec_stat(A_DEX);
-                                       (void)do_dec_stat(A_CON);
-                                       (void)do_dec_stat(A_INT);
-                                       (void)do_dec_stat(A_WIS);
-                                       (void)do_dec_stat(A_CHR);
-                               }
-                               else (void)fire_meteor(-1, GF_NETHER, y, x, 150, 1);
-                       }
+                       return (this_o_idx);
                }
        }
-
-       /* Aggravate monsters. */
-       if (trap & (CHEST_ALARM))
-       {
-#ifdef JP
-               msg_print("¤±¤¿¤¿¤Þ¤·¤¤²»¤¬ÌĤê¶Á¤¤¤¿¡ª");
-#else
-               msg_print("An alarm sounds!");
-#endif
-               aggravate_monsters(0);
-       }
-
-       /* Explode */
-       if ((trap & (CHEST_EXPLODE)) && o_ptr->k_idx)
-       {
-#ifdef JP
-               msg_print("ÆÍÁ³¡¢È¢¤¬Çúȯ¤·¤¿¡ª");
-               msg_print("È¢¤ÎÃæ¤Îʪ¤Ï¤¹¤Ù¤ÆÊ´¡¹¤ËºÕ¤±»¶¤Ã¤¿¡ª");
-#else
-               msg_print("There is a sudden explosion!");
-               msg_print("Everything inside the chest is destroyed!");
-#endif
-
-               o_ptr->pval = 0;
-               sound(SOUND_EXPLODE);
-#ifdef JP
-               take_hit(DAMAGE_ATTACK, damroll(5, 8), "Çúȯ¤¹¤ëÈ¢", -1);
-#else
-               take_hit(DAMAGE_ATTACK, damroll(5, 8), "an exploding chest", -1);
-#endif
-
-       }
-       /* Scatter contents. */
-       if ((trap & (CHEST_SCATTER)) && o_ptr->k_idx)
-       {
-#ifdef JP
-               msg_print("ÊõÈ¢¤ÎÃæ¿È¤Ï¥À¥ó¥¸¥ç¥ó¤¸¤å¤¦¤Ë»¶Í𤷤¿¡ª");
-#else
-               msg_print("The contents of the chest scatter all over the dungeon!");
-#endif
-               chest_death(TRUE, y, x, o_idx);
-               o_ptr->pval = 0;
-       }
+       return (0);
 }
 
-
-/*
+/*!
+ * @brief 箱を開けるコマンドのメインルーチン /
  * Attempt to open the given chest at the given location
- *
+ * @param y 箱の存在するマスのY座標
+ * @param x 箱の存在するマスのX座標
+ * @param o_idx 箱のオブジェクトID
+ * @return 箱が開かなかった場合TRUE / Returns TRUE if repeated commands may continue
+ * @details
  * Assume there is no monster blocking the destination
- *
- * Returns TRUE if repeated commands may continue
  */
-static bool do_cmd_open_chest(int y, int x, s16b o_idx)
+static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 {
        int i, j;
-
        bool flag = TRUE;
-
        bool more = FALSE;
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
 
-       object_type *o_ptr = &o_list[o_idx];
-
-
-       /* Take a turn */
-       energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Attempt to unlock it */
        if (o_ptr->pval > 0)
@@ -888,12 +562,7 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx)
                /* Success -- May still have traps */
                if (randint0(100) < j)
                {
-#ifdef JP
-                       msg_print("¸°¤ò¤Ï¤º¤·¤¿¡£");
-#else
-                       msg_print("You have picked the lock.");
-#endif
-
+                       msg_print(_("鍵をはずした。", "You have picked the lock."));
                        gain_exp(1);
                        flag = TRUE;
                }
@@ -904,11 +573,7 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx)
                        /* We may continue repeating */
                        more = TRUE;
                        if (flush_failure) flush();
-#ifdef JP
-                       msg_print("¸°¤ò¤Ï¤º¤»¤Ê¤«¤Ã¤¿¡£");
-#else
-                       msg_print("You failed to pick the lock.");
-#endif
+                       msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
 
                }
        }
@@ -922,30 +587,25 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx)
                /* Let the Chest drop items */
                chest_death(FALSE, y, x, o_idx);
        }
-
-       /* Result */
        return (more);
 }
 
-
-#if defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) /* TNB */
-
-/*
- * Return TRUE if the given feature is an open door
- */
-static bool is_open(int feat)
-{
-       return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(feat, FF_CLOSE));
-}
-
-
-/*
- * Return the number of features around (or under) the character.
+/*!
+ * @brief プレイヤーの周辺9マスに該当する地形がいくつあるかを返す /
+ * Attempt to open the given chest at the given location
+ * @param y 該当する地形の中から1つのY座標を返す参照ポインタ
+ * @param x 該当する地形の中から1つのX座標を返す参照ポインタ
+ * @param test 地形条件を判定するための関数ポインタ
+ * @param under TRUEならばプレイヤーの直下の座標も走査対象にする
+ * @return 該当する地形の数
+ * @details Return the number of features around (or under) the character.
  * Usually look for doors and floor traps.
  */
-static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
+static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under)
 {
-       int d, count, xx, yy;
+       DIRECTION d;
+       int count;
+       POSITION xx, yy;
 
        /* Count how many matches */
        count = 0;
@@ -953,24 +613,24 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
        /* Check around (and under) the character */
        for (d = 0; d < 9; d++)
        {
-               cave_type *c_ptr;
-               s16b feat;
+               grid_type *g_ptr;
+               FEAT_IDX feat;
 
                /* if not searching under player continue */
                if ((d == 8) && !under) continue;
 
                /* Extract adjacent (legal) location */
-               yy = py + ddy_ddd[d];
-               xx = px + ddx_ddd[d];
+               yy = p_ptr->y + ddy_ddd[d];
+               xx = p_ptr->x + ddx_ddd[d];
 
-               /* Get the cave */
-               c_ptr = &cave[yy][xx];
+               /* Get the current_floor_ptr->grid_array */
+               g_ptr = &current_floor_ptr->grid_array[yy][xx];
 
                /* Must have knowledge */
-               if (!(c_ptr->info & (CAVE_MARK))) continue;
+               if (!(g_ptr->info & (CAVE_MARK))) continue;
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Not looking for this feature */
                if (!((*test)(feat))) continue;
@@ -988,14 +648,21 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
 }
 
 
-/*
+/*!
+ * @brief プレイヤーの周辺9マスに箱のあるマスがいくつあるかを返す /
  * Return the number of chests around (or under) the character.
+ * @param y 該当するマスの中から1つのY座標を返す参照ポインタ
+ * @param x 該当するマスの中から1つのX座標を返す参照ポインタ
+ * @param trapped TRUEならばトラップの存在が判明している箱のみ対象にする
+ * @return 該当する地形の数
+ * @details
  * If requested, count only trapped chests.
  */
-static int count_chests(int *y, int *x, bool trapped)
+static int count_chests(POSITION *y, POSITION *x, bool trapped)
 {
-       int d, count, o_idx;
-
+       DIRECTION d;
+       int count;
+       OBJECT_IDX o_idx;
        object_type *o_ptr;
 
        /* Count how many matches */
@@ -1005,14 +672,14 @@ static int count_chests(int *y, int *x, bool trapped)
        for (d = 0; d < 9; d++)
        {
                /* Extract adjacent (legal) location */
-               int yy = py + ddy_ddd[d];
-               int xx = px + ddx_ddd[d];
+               POSITION yy = p_ptr->y + ddy_ddd[d];
+               POSITION xx = p_ptr->x + ddx_ddd[d];
 
                /* No (visible) chest is there */
-               if ((o_idx = chest_check(yy, xx)) == 0) continue;
+               if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
 
                /* Grab the object */
-               o_ptr = &o_list[o_idx];
+               o_ptr = &current_floor_ptr->o_list[o_idx];
 
                /* Already open */
                if (o_ptr->pval == 0) continue;
@@ -1034,62 +701,36 @@ static int count_chests(int *y, int *x, bool trapped)
 }
 
 
-/*
- * Convert an adjacent location to a direction.
+
+/*!
+ * @brief 「開ける」動作コマンドのサブルーチン /
+ * Perform the basic "open" command on doors
+ * @param y 対象を行うマスのY座標
+ * @param x 対象を行うマスのX座標
+ * @return 実際に処理が行われた場合TRUEを返す。
+ * @details
+ * Assume destination is a closed/locked/jammed door
+ * Assume there is no monster blocking the destination
+ * Returns TRUE if repeated commands may continue
  */
-static int coords_to_dir(int y, int x)
+static bool do_cmd_open_aux(POSITION y, POSITION x)
 {
-       int d[3][3] = { {7, 4, 1}, {8, 5, 2}, {9, 6, 3} };
-       int dy, dx;
+       int i, j;
 
-       dy = y - py;
-       dx = x - px;
+       /* Get requested grid */
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
+       bool more = FALSE;
 
-       /* Paranoia */
-       if (ABS(dx) > 1 || ABS(dy) > 1) return (0);
+       take_turn(p_ptr, 100);
 
-       return d[dx + 1][dy + 1];
-}
-
-#endif /* defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) -- TNB */
-
-
-/*
- * Perform the basic "open" command on doors
- *
- * Assume destination is a closed/locked/jammed door
- *
- * Assume there is no monster blocking the destination
- *
- * Returns TRUE if repeated commands may continue
- */
-static bool do_cmd_open_aux(int y, int x)
-{
-       int i, j;
-
-       /* Get requested grid */
-       cave_type *c_ptr = &cave[y][x];
-
-       feature_type *f_ptr = &f_info[c_ptr->feat];
-
-       bool more = FALSE;
-
-
-       /* Take a turn */
-       energy_use = 100;
-
-       /* Seeing true feature code (ignore mimic) */
+       /* Seeing true feature code (ignore mimic) */
 
        /* Jammed door */
        if (!have_flag(f_ptr->flags, FF_OPEN))
        {
                /* Stuck */
-#ifdef JP
-               msg_format("%s¤Ï¤¬¤Ã¤Á¤ê¤ÈÊĤ¸¤é¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
-#else
-               msg_format("The %s appears to be stuck.", f_name + f_info[get_feat_mimic(c_ptr)].name);
-#endif
-
+               msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
        }
 
        /* Locked door */
@@ -1105,7 +746,7 @@ static bool do_cmd_open_aux(int y, int x)
                /* Extract the lock power */
                j = f_ptr->power;
 
-               /* Extract the difficulty XXX XXX XXX */
+               /* Extract the difficulty */
                j = i - (j * 4);
 
                /* Always have a small chance of success */
@@ -1114,17 +755,11 @@ static bool do_cmd_open_aux(int y, int x)
                /* Success */
                if (randint0(100) < j)
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("¸°¤ò¤Ï¤º¤·¤¿¡£");
-#else
-                       msg_print("You have picked the lock.");
-#endif
+                       msg_print(_("鍵をはずした。", "You have picked the lock."));
 
                        /* Open the door */
                        cave_alter_feat(y, x, FF_OPEN);
 
-                       /* Sound */
                        sound(SOUND_OPENDOOR);
 
                        /* Experience */
@@ -1137,13 +772,7 @@ static bool do_cmd_open_aux(int y, int x)
                        /* Failure */
                        if (flush_failure) flush();
 
-                       /* Message */
-#ifdef JP
-                       msg_print("¸°¤ò¤Ï¤º¤»¤Ê¤«¤Ã¤¿¡£");
-#else
-                       msg_print("You failed to pick the lock.");
-#endif
-
+                       msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
 
                        /* We may keep trying */
                        more = TRUE;
@@ -1156,36 +785,33 @@ static bool do_cmd_open_aux(int y, int x)
                /* Open the door */
                cave_alter_feat(y, x, FF_OPEN);
 
-               /* Sound */
                sound(SOUND_OPENDOOR);
        }
-
-       /* Result */
        return (more);
 }
 
-
-
-/*
+/*!
+ * @brief 「開ける」コマンドのメインルーチン /
  * Open a closed/locked/jammed door or a closed/locked chest.
- *
+ * @return なし
+ * @details
  * Unlocking a locked door/chest is worth one experience point.
  */
 void do_cmd_open(void)
 {
-       int y, x, dir;
-
-       s16b o_idx;
+       POSITION y, x;
+       DIRECTION dir;
+       OBJECT_IDX o_idx;
 
        bool more = FALSE;
 
+       if (p_ptr->wild_mode) return;
+
        if (p_ptr->special_defense & KATA_MUSOU)
        {
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
        /* Option: Pick a direction */
        if (easy_open)
        {
@@ -1206,15 +832,11 @@ void do_cmd_open(void)
                }
        }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
        /* Allow repeated command */
        if (command_arg)
        {
                /* Set repeat count */
                command_rep = command_arg - 1;
-
-               /* Redraw the state */
                p_ptr->redraw |= (PR_STATE);
 
                /* Cancel the arg */
@@ -1224,49 +846,33 @@ void do_cmd_open(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir, TRUE))
        {
-               s16b feat;
-               cave_type *c_ptr;
+               FEAT_IDX feat;
+               grid_type *g_ptr;
 
                /* Get requested location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
                /* Get requested grid */
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Check for chest */
-               o_idx = chest_check(y, x);
+               o_idx = chest_check(y, x, FALSE);
 
                /* Nothing useful */
                if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
                {
-                       /* Message */
-#ifdef JP
-               msg_print("¤½¤³¤Ë¤Ï³«¤±¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-                       msg_print("You see nothing there to open.");
-#endif
-
+                       msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
                }
 
                /* Monster in the way */
-               else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
+               else if (g_ptr->m_idx && p_ptr->riding != g_ptr->m_idx)
                {
-                       /* Take a turn */
-                       energy_use = 100;
-
-                       /* Message */
-#ifdef JP
-               msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
-#else
-                       msg_print("There is a monster in the way!");
-#endif
-
-
-                       /* Attack */
+                       take_turn(p_ptr, 100);
+                       msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
                        py_attack(y, x, 0);
                }
 
@@ -1286,29 +892,29 @@ void do_cmd_open(void)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
 
-/*
+/*!
+ * @brief 「閉じる」動作コマンドのサブルーチン /
  * Perform the basic "close" command
- *
+ * @param y 対象を行うマスのY座標
+ * @param x 対象を行うマスのX座標
+ * @return 実際に処理が行われた場合TRUEを返す。
+ * @details
  * Assume destination is an open/broken door
- *
  * Assume there is no monster blocking the destination
- *
  * Returns TRUE if repeated commands may continue
  */
-static bool do_cmd_close_aux(int y, int x)
+static bool do_cmd_close_aux(POSITION y, POSITION x)
 {
-       /* Get grid and contents */
-       cave_type *c_ptr = &cave[y][x];
-       s16b      old_feat = c_ptr->feat;
-       bool      more = FALSE;
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+       FEAT_IDX old_feat = g_ptr->feat;
+       bool more = FALSE;
 
-       /* Take a turn */
-       energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Seeing true feature code (ignore mimic) */
 
@@ -1318,15 +924,10 @@ static bool do_cmd_close_aux(int y, int x)
                s16b closed_feat = feat_state(old_feat, FF_CLOSE);
 
                /* Hack -- object in the way */
-               if ((c_ptr->o_idx || (c_ptr->info & CAVE_OBJECT)) &&
+               if ((g_ptr->o_idx || (g_ptr->info & CAVE_OBJECT)) &&
                    (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("²¿¤«¤¬¤Ä¤Ã¤«¤¨¤ÆÊĤޤé¤Ê¤¤¡£");
-#else
-                       msg_print("There seems stuck.");
-#endif
+                       msg_print(_("何かがつっかえて閉まらない。", "There seems stuck."));
                }
                else
                {
@@ -1334,44 +935,41 @@ static bool do_cmd_close_aux(int y, int x)
                        cave_alter_feat(y, x, FF_CLOSE);
 
                        /* Broken door */
-                       if (old_feat == c_ptr->feat)
+                       if (old_feat == g_ptr->feat)
                        {
-                               /* Message */
-#ifdef JP
-                               msg_print("¥É¥¢¤Ï²õ¤ì¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¡£");
-#else
-                               msg_print("The door appears to be broken.");
-#endif
+                               msg_print(_("ドアは壊れてしまっている。", "The door appears to be broken."));
                        }
                        else
                        {
-                               /* Sound */
                                sound(SOUND_SHUTDOOR);
                        }
                }
        }
-
-       /* Result */
        return (more);
 }
 
 
-/*
+/*!
+ * @brief 「閉じる」コマンドのメインルーチン /
  * Close an open door.
+ * @return なし
+ * @details
+ * Unlocking a locked door/chest is worth one experience point.
  */
 void do_cmd_close(void)
 {
-       int y, x, dir;
+       POSITION y, x;
+       DIRECTION dir;
 
        bool more = FALSE;
 
+       if (p_ptr->wild_mode) return;
+
        if (p_ptr->special_defense & KATA_MUSOU)
        {
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
        /* Option: Pick a direction */
        if (easy_open)
        {
@@ -1382,15 +980,11 @@ void do_cmd_close(void)
                }
        }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
        /* Allow repeated command */
        if (command_arg)
        {
                /* Set repeat count */
                command_rep = command_arg - 1;
-
-               /* Redraw the state */
                p_ptr->redraw |= (PR_STATE);
 
                /* Cancel the arg */
@@ -1398,44 +992,30 @@ void do_cmd_close(void)
        }
 
        /* Get a "repeated" direction */
-       if (get_rep_dir(&dir,FALSE))
+       if (get_rep_dir(&dir, FALSE))
        {
-               cave_type *c_ptr;
-               s16b feat;
-
-               /* Get requested location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               grid_type *g_ptr;
+               FEAT_IDX feat;
 
-               /* Get grid and contents */
-               c_ptr = &cave[y][x];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Require open/broken door */
                if (!have_flag(f_info[feat].flags, FF_CLOSE))
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("¤½¤³¤Ë¤ÏÊĤ¸¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-                       msg_print("You see nothing there to close.");
-#endif
+                       msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
                }
 
                /* Monster in the way */
-               else if (c_ptr->m_idx)
+               else if (g_ptr->m_idx)
                {
-                       /* Take a turn */
-                       energy_use = 100;
+                       take_turn(p_ptr, 100);
 
-                       /* Message */
-#ifdef JP
-                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
-#else
-                       msg_print("There is a monster in the way!");
-#endif
+                       msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
                        py_attack(y, x, 0);
@@ -1450,84 +1030,74 @@ void do_cmd_close(void)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
-/*
+/*!
+ * @brief 「掘る」コマンドを該当のマスに行えるかの判定と結果メッセージの表示 /
  * Determine if a given grid may be "tunneled"
+ * @param y 対象を行うマスのY座標
+ * @param x 対象を行うマスのX座標
+ * @return 
  */
-static bool do_cmd_tunnel_test(int y, int x)
+static bool do_cmd_tunnel_test(POSITION y, POSITION x)
 {
-       cave_type *c_ptr = &cave[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Must have knowledge */
-       if (!(c_ptr->info & CAVE_MARK))
+       if (!(g_ptr->info & CAVE_MARK))
        {
-               /* Message */
-#ifdef JP
-               msg_print("¤½¤³¤Ë¤Ï²¿¤â¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-               msg_print("You see nothing there.");
-#endif
-
-               /* Nope */
+               msg_print(_("そこには何も見当たらない。", "You see nothing there."));
+
                return (FALSE);
        }
 
        /* Must be a wall/door/etc */
-       if (!cave_have_flag_grid(c_ptr, FF_TUNNEL))
+       if (!cave_have_flag_grid(g_ptr, FF_TUNNEL))
        {
-               /* Message */
-#ifdef JP
-               msg_print("¤½¤³¤Ë¤Ï·¡¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-               msg_print("You see nothing there to tunnel.");
-#endif
-
-               /* Nope */
+               msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
+
                return (FALSE);
        }
 
-       /* Okay */
        return (TRUE);
 }
 
 
-/*
+/*!
+ * @brief 「掘る」動作コマンドのサブルーチン /
  * Perform the basic "tunnel" command
- *
+ * @param y 対象を行うマスのY座標
+ * @param x 対象を行うマスのX座標
+ * @return 実際に処理が行われた場合TRUEを返す。
+ * @details
  * Assumes that no monster is blocking the destination
- *
  * Do not use twall anymore
- *
  * Returns TRUE if repeated commands may continue
  */
-static bool do_cmd_tunnel_aux(int y, int x)
+static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
 {
-       cave_type *c_ptr;
+       grid_type *g_ptr;
        feature_type *f_ptr, *mimic_f_ptr;
        int power;
-       cptr name;
+       concptr name;
        bool more = FALSE;
 
        /* Verify legality */
        if (!do_cmd_tunnel_test(y, x)) return (FALSE);
 
-       /* Take a turn */
-       energy_use = 100;
+       take_turn(p_ptr, 100);
 
-       /* Get grid */
-       c_ptr = &cave[y][x];
-       f_ptr = &f_info[c_ptr->feat];
+       g_ptr = &current_floor_ptr->grid_array[y][x];
+       f_ptr = &f_info[g_ptr->feat];
        power = f_ptr->power;
 
        /* Feature code (applying "mimic" field) */
-       mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
+       mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
 
        name = f_name + mimic_f_ptr->name;
 
-       /* Sound */
        sound(SOUND_DIG);
 
        if (have_flag(f_ptr->flags, FF_PERMANENT))
@@ -1535,21 +1105,13 @@ static bool do_cmd_tunnel_aux(int y, int x)
                /* Titanium */
                if (have_flag(mimic_f_ptr->flags, FF_PERMANENT))
                {
-#ifdef JP
-                       msg_print("¤³¤Î´ä¤Ï¹Å¤¹¤®¤Æ·¡¤ì¤Ê¤¤¤è¤¦¤À¡£");
-#else
-                       msg_print("This seems to be permanent rock.");
-#endif
+                       msg_print(_("この岩は硬すぎて掘れないようだ。", "This seems to be permanent rock."));
                }
 
                /* Map border (mimiccing Permanent wall) */
                else
                {
-#ifdef JP
-                       msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤!");
-#else
-                       msg_print("You can't tunnel through that!");
-#endif
+                       msg_print(_("そこは掘れない!", "You can't tunnel through that!"));
                }
        }
 
@@ -1559,28 +1121,17 @@ static bool do_cmd_tunnel_aux(int y, int x)
                /* Dig */
                if (p_ptr->skill_dig > randint0(20 * power))
                {
-                       /* Message */
-#ifdef JP
-                       msg_format("%s¤ò¤¯¤º¤·¤¿¡£", name);
-#else
-                       msg_format("You have removed the %s.", name);
-#endif
+                       msg_format(_("%sをくずした。", "You have removed the %s."), name);
 
                        /* Remove the feature */
                        cave_alter_feat(y, x, FF_TUNNEL);
-
-                       /* Update some things */
                        p_ptr->update |= (PU_FLOW);
                }
                else
                {
                        /* Message, keep digging */
-#ifdef JP
-                       msg_format("%s¤ò¤¯¤º¤·¤Æ¤¤¤ë¡£", name);
-#else
-                       msg_format("You dig into the %s.", name);
-#endif
-
+                       msg_format(_("%sをくずしている。", "You dig into the %s."), name);
+                       
                        more = TRUE;
                }
        }
@@ -1592,21 +1143,14 @@ static bool do_cmd_tunnel_aux(int y, int x)
                /* Tunnel */
                if (p_ptr->skill_dig > power + randint0(40 * power))
                {
-#ifdef JP
-                       if (tree) msg_format("%s¤òÀÚ¤êʧ¤Ã¤¿¡£", name);
-                       else
-                       {
-                               msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
-                               p_ptr->update |= (PU_FLOW);
-                       }
-#else
-                       if (tree) msg_format("You have cleared away the %s.", name);
+                       if (tree) msg_format(_("%sを切り払った。", "You have cleared away the %s."), name);
                        else
                        {
-                               msg_print("You have finished the tunnel.");
+                               msg_print(_("穴を掘り終えた。", "You have finished the tunnel."));
                                p_ptr->update |= (PU_FLOW);
                        }
-#endif
+                       
+                       if (have_flag(f_ptr->flags, FF_GLASS)) sound(SOUND_GLASS);
 
                        /* Remove the feature */
                        cave_alter_feat(y, x, FF_TUNNEL);
@@ -1621,57 +1165,50 @@ static bool do_cmd_tunnel_aux(int y, int x)
                        if (tree)
                        {
                                /* We may continue chopping */
-#ifdef JP
-                               msg_format("%s¤òÀڤäƤ¤¤ë¡£", name);
-#else
-                               msg_format("You chop away at the %s.", name);
-#endif
+                               msg_format(_("%sを切っている。", "You chop away at the %s."), name);
                                /* Occasional Search XXX XXX */
                                if (randint0(100) < 25) search();
                        }
                        else
                        {
                                /* We may continue tunelling */
-#ifdef JP
-                               msg_format("%s¤Ë·ê¤ò·¡¤Ã¤Æ¤¤¤ë¡£", name);
-#else
-                               msg_format("You tunnel into the %s.", name);
-#endif
+                               msg_format(_("%sに穴を掘っている。", "You tunnel into the %s."), name);
                        }
 
                        more = TRUE;
                }
        }
 
-       if (is_hidden_door(c_ptr))
+       if (is_hidden_door(g_ptr))
        {
                /* Occasional Search XXX XXX */
                if (randint0(100) < 25) search();
        }
-
-       /* Result */
        return more;
 }
 
 
-/*
+/*!
+ * @brief 「掘る」動作コマンドのメインルーチン /
  * Tunnels through "walls" (including rubble and closed doors)
- *
+ * @return なし
+ * @details
+ * <pre>
  * Note that you must tunnel in order to hit invisible monsters
- * in walls, though moving into walls still takes a turn anyway.
+ * in walls, though moving into walls still takes a current_world_ptr->game_turn anyway.
  *
  * Digging is very difficult without a "digger" weapon, but can be
  * accomplished by strong players using heavy weapons.
+ * </pre>
  */
 void do_cmd_tunnel(void)
 {
-       int                     y, x, dir;
-
-       cave_type       *c_ptr;
-       s16b feat;
-
-       bool            more = FALSE;
+       POSITION y, x;
+       DIRECTION dir;
+       grid_type *g_ptr;
+       FEAT_IDX feat;
 
+       bool more = FALSE;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
@@ -1683,8 +1220,6 @@ void do_cmd_tunnel(void)
        {
                /* Set repeat count */
                command_rep = command_arg - 1;
-
-               /* Redraw the state */
                p_ptr->redraw |= (PR_STATE);
 
                /* Cancel the arg */
@@ -1695,48 +1230,32 @@ void do_cmd_tunnel(void)
        if (get_rep_dir(&dir,FALSE))
        {
                /* Get location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
-               /* Get grid */
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* No tunnelling through doors */
                if (have_flag(f_info[feat].flags, FF_DOOR))
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("¥É¥¢¤Ï·¡¤ì¤Ê¤¤¡£");
-#else
-                       msg_print("You cannot tunnel through doors.");
-#endif
+                       msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
                }
 
                /* No tunnelling through most features */
                else if (!have_flag(f_info[feat].flags, FF_TUNNEL))
                {
-#ifdef JP
-                       msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤¡£");
-#else
-                       msg_print("You can't tunnel through that.");
-#endif
+                       msg_print(_("そこは掘れない。", "You can't tunnel through that."));
                }
 
                /* A monster is in the way */
-               else if (c_ptr->m_idx)
+               else if (g_ptr->m_idx)
                {
-                       /* Take a turn */
-                       energy_use = 100;
+                       take_turn(p_ptr, 100);
 
-                       /* Message */
-#ifdef JP
-                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
-#else
-                       msg_print("There is a monster in the way!");
-#endif
+                       msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
                        py_attack(y, x, 0);
@@ -1751,33 +1270,33 @@ void do_cmd_tunnel(void)
        }
 
        /* Cancel repetition unless we can continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
-
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
-/*
+/*!
+ * @brief 移動処理による簡易な「開く」処理 /
  * easy_open_door --
- *
+ * @return 開く処理が実際に試みられた場合TRUEを返す
+ * @details
+ * <pre>
  *     If there is a jammed/closed/locked door at the given location,
  *     then attempt to unlock/open it. Return TRUE if an attempt was
  *     made (successful or not), otherwise return FALSE.
  *
  *     The code here should be nearly identical to that in
  *     do_cmd_open_test() and do_cmd_open_aux().
+ * </pre>
  */
-bool easy_open_door(int y, int x)
+bool easy_open_door(POSITION y, POSITION x)
 {
        int i, j;
 
-       cave_type *c_ptr = &cave[y][x];
-       feature_type *f_ptr = &f_info[c_ptr->feat];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        /* Must be a closed door */
-       if (!is_closed_door(c_ptr->feat))
+       if (!is_closed_door(g_ptr->feat))
        {
-               /* Nope */
                return (FALSE);
        }
 
@@ -1785,11 +1304,7 @@ bool easy_open_door(int y, int x)
        if (!have_flag(f_ptr->flags, FF_OPEN))
        {
                /* Stuck */
-#ifdef JP
-               msg_format("%s¤Ï¤¬¤Ã¤Á¤ê¤ÈÊĤ¸¤é¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£", f_name + f_info[get_feat_mimic(c_ptr)].name);
-#else
-               msg_format("The %s appears to be stuck.", f_name + f_info[get_feat_mimic(c_ptr)].name);
-#endif
+               msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
 
        }
 
@@ -1806,7 +1321,7 @@ bool easy_open_door(int y, int x)
                /* Extract the lock power */
                j = f_ptr->power;
 
-               /* Extract the difficulty XXX XXX XXX */
+               /* Extract the difficulty */
                j = i - (j * 4);
 
                /* Always have a small chance of success */
@@ -1815,17 +1330,11 @@ bool easy_open_door(int y, int x)
                /* Success */
                if (randint0(100) < j)
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("¸°¤ò¤Ï¤º¤·¤¿¡£");
-#else
-                       msg_print("You have picked the lock.");
-#endif
+                       msg_print(_("鍵をはずした。", "You have picked the lock."));
 
                        /* Open the door */
                        cave_alter_feat(y, x, FF_OPEN);
 
-                       /* Sound */
                        sound(SOUND_OPENDOOR);
 
                        /* Experience */
@@ -1838,12 +1347,7 @@ bool easy_open_door(int y, int x)
                        /* Failure */
                        if (flush_failure) flush();
 
-                       /* Message */
-#ifdef JP
-                       msg_print("¸°¤ò¤Ï¤º¤»¤Ê¤«¤Ã¤¿¡£");
-#else
-                       msg_print("You failed to pick the lock.");
-#endif
+                       msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
 
                }
        }
@@ -1854,37 +1358,32 @@ bool easy_open_door(int y, int x)
                /* Open the door */
                cave_alter_feat(y, x, FF_OPEN);
 
-               /* Sound */
                sound(SOUND_OPENDOOR);
        }
-
-       /* Result */
        return (TRUE);
 }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
-
-/*
+/*!
+ * @brief 箱のトラップを解除するコマンドのメインルーチン /
  * Perform the basic "disarm" command
- *
+ * @param y 解除を行うマスのY座標
+ * @param x 解除を行うマスのX座標
+ * @param o_idx 箱のオブジェクトID
+ * @return ターンを消費する処理が行われた場合TRUEを返す
+ * @details
+ * <pre>
  * Assume destination is a visible trap
- *
  * Assume there is no monster blocking the destination
- *
  * Returns TRUE if repeated commands may continue
+ * </pre>
  */
-static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
+static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 {
        int i, j;
-
        bool more = FALSE;
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
 
-       object_type *o_ptr = &o_list[o_idx];
-
-
-       /* Take a turn */
-       energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Get the "disarm" factor */
        i = p_ptr->skill_dis;
@@ -1902,45 +1401,26 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
        /* Must find the trap first. */
        if (!object_is_known(o_ptr))
        {
-#ifdef JP
-               msg_print("¥È¥é¥Ã¥×¤¬¸«¤¢¤¿¤é¤Ê¤¤¡£");
-#else
-               msg_print("I don't see any traps.");
-#endif
+               msg_print(_("トラップが見あたらない。", "I don't see any traps."));
 
        }
 
        /* Already disarmed/unlocked */
        else if (o_ptr->pval <= 0)
        {
-#ifdef JP
-               msg_print("È¢¤Ë¤Ï¥È¥é¥Ã¥×¤¬»Å³Ý¤±¤é¤ì¤Æ¤¤¤Ê¤¤¡£");
-#else
-               msg_print("The chest is not trapped.");
-#endif
-
+               msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
        }
 
        /* No traps to find. */
        else if (!chest_traps[o_ptr->pval])
        {
-#ifdef JP
-               msg_print("È¢¤Ë¤Ï¥È¥é¥Ã¥×¤¬»Å³Ý¤±¤é¤ì¤Æ¤¤¤Ê¤¤¡£");
-#else
-               msg_print("The chest is not trapped.");
-#endif
-
+               msg_print(_("箱にはトラップが仕掛けられていない。", "The chest is not trapped."));
        }
 
        /* Success (get a lot of experience) */
        else if (randint0(100) < j)
        {
-#ifdef JP
-               msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¥È¥é¥Ã¥×¤ò²ò½ü¤·¤¿¡£");
-#else
-               msg_print("You have disarmed the chest.");
-#endif
-
+               msg_print(_("箱に仕掛けられていたトラップを解除した。", "You have disarmed the chest."));
                gain_exp(o_ptr->pval);
                o_ptr->pval = (0 - o_ptr->pval);
        }
@@ -1951,72 +1431,54 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
                /* We may keep trying */
                more = TRUE;
                if (flush_failure) flush();
-#ifdef JP
-               msg_print("È¢¤Î¥È¥é¥Ã¥×²ò½ü¤Ë¼ºÇÔ¤·¤¿¡£");
-#else
-               msg_print("You failed to disarm the chest.");
-#endif
-
+               msg_print(_("箱のトラップ解除に失敗した。", "You failed to disarm the chest."));
        }
 
        /* Failure -- Set off the trap */
        else
        {
-#ifdef JP
-               msg_print("¥È¥é¥Ã¥×¤òºîÆ°¤µ¤»¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
-               msg_print("You set off a trap!");
-#endif
-
+               msg_print(_("トラップを作動させてしまった!", "You set off a trap!"));
                sound(SOUND_FAIL);
                chest_trap(y, x, o_idx);
        }
-
-       /* Result */
        return (more);
 }
 
 
-/*
+/*!
+ * @brief 箱のトラップを解除するコマンドのサブルーチン /
  * Perform the basic "disarm" command
- *
+ * @param y 解除を行うマスのY座標
+ * @param x 解除を行うマスのX座標
+ * @param dir プレイヤーからみた方向ID
+ * @return ターンを消費する処理が行われた場合TRUEを返す
+ * @details
+ * <pre>
  * Assume destination is a visible trap
- *
  * Assume there is no monster blocking the destination
- *
  * Returns TRUE if repeated commands may continue
+ * </pre>
  */
-#ifdef ALLOW_EASY_DISARM /* TNB */
 
-bool do_cmd_disarm_aux(int y, int x, int dir)
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-static bool do_cmd_disarm_aux(int y, int x, int dir)
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
+bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
 {
-       /* Get grid and contents */
-       cave_type *c_ptr = &cave[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Get feature */
-       feature_type *f_ptr = &f_info[c_ptr->feat];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        /* Access trap name */
-       cptr name = (f_name + f_ptr->name);
+       concptr name = (f_name + f_ptr->name);
 
        /* Extract trap "power" */
        int power = f_ptr->power;
-
        bool more = FALSE;
 
        /* Get the "disarm" factor */
        int i = p_ptr->skill_dis;
-
        int j;
 
-       /* Take a turn */
-       energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Penalize some conditions */
        if (p_ptr->blind || no_lite()) i = i / 10;
@@ -2031,30 +1493,16 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
        /* Success */
        if (randint0(100) < j)
        {
-               /* Message */
-#ifdef JP
-               msg_format("%s¤ò²ò½ü¤·¤¿¡£", name);
-#else
-               msg_format("You have disarmed the %s.", name);
-#endif
-
+               msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
+               
                /* Reward */
                gain_exp(power);
 
                /* Remove the trap */
                cave_alter_feat(y, x, FF_DISARM);
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
                /* Move the player onto the trap */
                move_player(dir, easy_disarm, FALSE);
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               /* move the player onto the trap grid */
-               move_player(dir, FALSE, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
        }
 
        /* Failure -- Keep trying */
@@ -2063,12 +1511,7 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
                /* Failure */
                if (flush_failure) flush();
 
-               /* Message */
-#ifdef JP
-               msg_format("%s¤Î²ò½ü¤Ë¼ºÇÔ¤·¤¿¡£", name);
-#else
-               msg_format("You failed to disarm the %s.", name);
-#endif
+               msg_format(_("%sの解除に失敗した。", "You failed to disarm the %s."), name);
 
                /* We may keep trying */
                more = TRUE;
@@ -2077,49 +1520,34 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
        /* Failure -- Set off the trap */
        else
        {
-               /* Message */
-#ifdef JP
-               msg_format("%s¤òºîÆ°¤µ¤»¤Æ¤·¤Þ¤Ã¤¿¡ª", name);
-#else
-               msg_format("You set off the %s!", name);
-#endif
-
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
+               msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
                /* Move the player onto the trap */
                move_player(dir, easy_disarm, FALSE);
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               /* Move the player onto the trap */
-               move_player(dir, FALSE, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
        }
-
-       /* Result */
        return (more);
 }
 
 
-/*
+/*!
+ * @brief 箱、床のトラップ解除処理双方の統合メインルーチン /
  * Disarms a trap, or chest
+ * @return なし
  */
 void do_cmd_disarm(void)
 {
-       int y, x, dir;
-
-       s16b o_idx;
+       POSITION y, x;
+       DIRECTION dir;
+       OBJECT_IDX o_idx;
 
        bool more = FALSE;
 
+       if (p_ptr->wild_mode) return;
+
        if (p_ptr->special_defense & KATA_MUSOU)
        {
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
        /* Option: Pick a direction */
        if (easy_disarm)
        {
@@ -2134,21 +1562,17 @@ void do_cmd_disarm(void)
                /* See if only one target */
                if (num_traps || num_chests)
                {
-                       bool too_many = (num_traps && num_chests) || (num_traps > 1) ||
-                           (num_chests > 1);
+                       bool too_many = (num_traps && num_chests) || (num_traps > 1) || (num_chests > 1);
                        if (!too_many) command_dir = coords_to_dir(y, x);
                }
        }
 
-#endif /* ALLOW_EASY_DISARM -- TNB */
 
        /* Allow repeated command */
        if (command_arg)
        {
                /* Set repeat count */
                command_rep = command_arg - 1;
-
-               /* Redraw the state */
                p_ptr->redraw |= (PR_STATE);
 
                /* Cancel the arg */
@@ -2158,44 +1582,29 @@ void do_cmd_disarm(void)
        /* Get a direction (or abort) */
        if (get_rep_dir(&dir,TRUE))
        {
-               cave_type *c_ptr;
-               s16b feat;
+               grid_type *g_ptr;
+               FEAT_IDX feat;
 
-               /* Get location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
-
-               /* Get grid and contents */
-               c_ptr = &cave[y][x];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Check for chests */
-               o_idx = chest_check(y, x);
+               o_idx = chest_check(y, x, TRUE);
 
                /* Disarm a trap */
                if (!is_trap(feat) && !o_idx)
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("¤½¤³¤Ë¤Ï²ò½ü¤¹¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-                       msg_print("You see nothing there to disarm.");
-#endif
-
+                       msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm."));
                }
 
                /* Monster in the way */
-               else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
+               else if (g_ptr->m_idx && p_ptr->riding != g_ptr->m_idx)
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
-#else
-                       msg_print("There is a monster in the way!");
-#endif
-
+                       msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
                        py_attack(y, x, 0);
@@ -2204,59 +1613,58 @@ void do_cmd_disarm(void)
                /* Disarm chest */
                else if (o_idx)
                {
-                       /* Disarm the chest */
                        more = do_cmd_disarm_chest(y, x, o_idx);
                }
 
                /* Disarm trap */
                else
                {
-                       /* Disarm the trap */
                        more = do_cmd_disarm_aux(y, x, dir);
                }
        }
 
        /* Cancel repeat unless told not to */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
-/*
+/*!
+ * @brief 「打ち破る」動作コマンドのサブルーチン /
  * Perform the basic "bash" command
- *
+ * @param y 対象を行うマスのY座標
+ * @param x 対象を行うマスのX座標
+ * @param dir プレイヤーから見たターゲットの方角ID
+ * @return 実際に処理が行われた場合TRUEを返す。
+ * @details
+ * <pre>
  * Assume destination is a closed/locked/jammed door
- *
  * Assume there is no monster blocking the destination
- *
  * Returns TRUE if repeated commands may continue
+ * </pre>
  */
-static bool do_cmd_bash_aux(int y, int x, int dir)
+static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
 {
-       /* Get grid */
-       cave_type       *c_ptr = &cave[y][x];
+       grid_type       *g_ptr = &current_floor_ptr->grid_array[y][x];
+
+       /* Get feature */
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        /* Hack -- Bash power based on strength */
        /* (Ranges from 3 to 20 to 100 to 200) */
        int bash = adj_str_blow[p_ptr->stat_ind[A_STR]];
 
        /* Extract door power */
-       int temp = f_info[c_ptr->feat].power;
+       int temp = f_ptr->power;
 
        bool            more = FALSE;
 
-       cptr name = f_name + f_info[get_feat_mimic(c_ptr)].name;
+       concptr name = f_name + f_info[get_feat_mimic(g_ptr)].name;
 
-       /* Take a turn */
-       energy_use = 100;
+       take_turn(p_ptr, 100);
 
-       /* Message */
-#ifdef JP
-       msg_format("%s¤ËÂÎÅö¤¿¤ê¤ò¤·¤¿¡ª", name);
-#else
-       msg_format("You smash into the %s!", name);
-#endif
+       msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
 
-       /* Compare bash power to door power XXX XXX XXX */
+       /* Compare bash power to door power */
        temp = (bash - (temp * 10));
 
        if (p_ptr->pclass == CLASS_BERSERKER) temp *= 2;
@@ -2267,16 +1675,12 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        /* Hack -- attempt to bash down the door */
        if (randint0(100) < temp)
        {
-               /* Message */
-#ifdef JP
-               msg_format("%s¤ò²õ¤·¤¿¡ª", name);
-#else
-               msg_format("The %s crashes open!", name);
-#endif
+               msg_format(_("%sを壊した!", "The %s crashes open!"), name);
 
+               sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
 
                /* Break down the door */
-               if ((randint0(100) < 50) || (feat_state(c_ptr->feat, FF_OPEN) == c_ptr->feat))
+               if ((randint0(100) < 50) || (feat_state(g_ptr->feat, FF_OPEN) == g_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))
                {
                        cave_alter_feat(y, x, FF_BASH);
                }
@@ -2287,9 +1691,6 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
                        cave_alter_feat(y, x, FF_OPEN);
                }
 
-               /* Sound */
-               sound(SOUND_OPENDOOR);
-
                /* Hack -- Fall through the door */
                move_player(dir, FALSE, FALSE);
        }
@@ -2298,13 +1699,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
                 p_ptr->lev)
        {
-               /* Message */
-#ifdef JP
-               msg_format("¤³¤Î%s¤Ï´è¾æ¤À¡£", name);
-#else
-               msg_format("The %s holds firm.", name);
-#endif
-
+               msg_format(_("この%sは頑丈だ。", "The %s holds firm."), name);
 
                /* Allow repeated bashing */
                more = TRUE;
@@ -2313,26 +1708,21 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        /* High dexterity yields coolness */
        else
        {
-               /* Message */
-#ifdef JP
-               msg_print("ÂΤΥХé¥ó¥¹¤ò¤¯¤º¤·¤Æ¤·¤Þ¤Ã¤¿¡£");
-#else
-               msg_print("You are off-balance.");
-#endif
-
+               msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
 
                /* Hack -- Lose balance ala paralysis */
                (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
        }
-
-       /* Result */
        return (more);
 }
 
 
-/*
+/*!
+ * @brief 「打ち破る」動作コマンドのメインルーチン /
  * Bash open a door, success based on character strength
- *
+ * @return なし
+ * @details
+ * <pre>
  * For a closed door, pval is positive if locked; negative if stuck.
  *
  * For an open door, pval is positive for a broken door.
@@ -2343,15 +1733,15 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
  * be bashed. A closed door can be jammed (see do_cmd_spike()).
  *
  * Creatures can also open or bash doors, see elsewhere.
+ * </pre>
  */
 void do_cmd_bash(void)
 {
-       int                     y, x, dir;
-
-       cave_type       *c_ptr;
-
+       int     y, x, dir;
+       grid_type       *g_ptr;
        bool            more = FALSE;
 
+       if (p_ptr->wild_mode) return;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
@@ -2363,8 +1753,6 @@ void do_cmd_bash(void)
        {
                /* Set repeat count */
                command_rep = command_arg - 1;
-
-               /* Redraw the state */
                p_ptr->redraw |= (PR_STATE);
 
                /* Cancel the arg */
@@ -2374,43 +1762,29 @@ void do_cmd_bash(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir,FALSE))
        {
-               s16b feat;
+               FEAT_IDX feat;
 
                /* Bash location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
-               /* Get grid */
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Nothing useful */
                if (!have_flag(f_info[feat].flags, FF_BASH))
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("¤½¤³¤Ë¤ÏÂÎÅö¤¿¤ê¤¹¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-                       msg_print("You see nothing there to bash.");
-#endif
-
+                       msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
                }
 
                /* Monster in the way */
-               else if (c_ptr->m_idx)
+               else if (g_ptr->m_idx)
                {
-                       /* Take a turn */
-                       energy_use = 100;
-
-                       /* Message */
-#ifdef JP
-                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
-#else
-                       msg_print("There is a monster in the way!");
-#endif
+                       take_turn(p_ptr, 100);
 
+                       msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
                        py_attack(y, x, 0);
@@ -2425,28 +1799,31 @@ void do_cmd_bash(void)
        }
 
        /* Unless valid action taken, cancel bash */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
-/*
+/*!
+ * @brief 特定のマスに影響を及ぼすための汎用的コマンド
+ * @return なし
+ * @details
+ * <pre>
  * Manipulate an adjacent grid in some way
  *
  * Attack monsters, tunnel through walls, disarm traps, open doors.
  *
- * Consider confusion XXX XXX XXX
+ * Consider confusion 
  *
- * This command must always take a turn, to prevent free detection
+ * This command must always take a current_world_ptr->game_turn, to prevent free detection
  * of invisible monsters.
+ * </pre>
  */
 void do_cmd_alter(void)
 {
-       int                     y, x, dir;
-
-       cave_type       *c_ptr;
-
-       bool            more = FALSE;
-
+       POSITION y, x;
+       DIRECTION dir;
+       grid_type *g_ptr;
+       bool more = FALSE;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
@@ -2458,8 +1835,6 @@ void do_cmd_alter(void)
        {
                /* Set repeat count */
                command_rep = command_arg - 1;
-
-               /* Redraw the state */
                p_ptr->redraw |= (PR_STATE);
 
                /* Cancel the arg */
@@ -2469,27 +1844,22 @@ void do_cmd_alter(void)
        /* Get a direction */
        if (get_rep_dir(&dir,TRUE))
        {
-               s16b feat;
+               FEAT_IDX feat;
                feature_type *f_ptr;
 
-               /* Get location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
-               /* Get grid */
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
                f_ptr = &f_info[feat];
 
-               /* Take a turn */
-               energy_use = 100;
+               take_turn(p_ptr, 100);
 
-               /* Attack monsters */
-               if (c_ptr->m_idx)
+               if (g_ptr->m_idx)
                {
-                       /* Attack */
                        py_attack(y, x, 0);
                }
 
@@ -2523,32 +1893,31 @@ void do_cmd_alter(void)
                        more = do_cmd_disarm_aux(y, x, dir);
                }
 
-               /* Oops */
                else
                {
-                       /* Oops */
-#ifdef JP
-                       msg_print("²¿¤â¤Ê¤¤¶õÃæ¤ò¹¶·â¤·¤¿¡£");
-#else
-                       msg_print("You attack the empty air.");
-#endif
-
+                       msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
                }
        }
 
        /* Cancel repetition unless we can continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
-/*
+
+/*!
+ * @brief 「くさびを打つ」ために必要なオブジェクトがあるかどうかの判定を返す /
  * Find the index of some "spikes", if possible.
- *
- * XXX XXX XXX Let user choose a pile of spikes, perhaps?
+ * @param ip くさびとして打てるオブジェクトのID
+ * @return オブジェクトがある場合TRUEを返す
+ * @details
+ * <pre>
+ * Let user choose a pile of spikes, perhaps?
+ * </pre>
  */
-static bool get_spike(int *ip)
+static bool get_spike(INVENTORY_IDX *ip)
 {
-       int i;
+       INVENTORY_IDX i;
 
        /* Check every item in the pack */
        for (i = 0; i < INVEN_PACK; i++)
@@ -2569,19 +1938,24 @@ static bool get_spike(int *ip)
                }
        }
 
-       /* Oops */
        return (FALSE);
 }
 
 
-/*
+/*!
+ * @brief 「くさびを打つ」動作コマンドのメインルーチン /
  * Jam a closed door with a spike
- *
+ * @return なし
+ * @details
+ * <pre>
  * This command may NOT be repeated
+ * </pre>
  */
 void do_cmd_spike(void)
 {
-       int dir;
+       DIRECTION dir;
+
+       if (p_ptr->wild_mode) return;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
@@ -2589,57 +1963,38 @@ void do_cmd_spike(void)
        }
 
        /* Get a "repeated" direction */
-       if (get_rep_dir(&dir,FALSE))
+       if (get_rep_dir(&dir, FALSE))
        {
-               int y, x, item;
-               cave_type *c_ptr;
-               s16b feat;
-
-               /* Get location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               POSITION y, x;
+               INVENTORY_IDX item;
+               grid_type *g_ptr;
+               FEAT_IDX feat;
 
-               /* Get grid and contents */
-               c_ptr = &cave[y][x];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Require closed door */
                if (!have_flag(f_info[feat].flags, FF_SPIKE))
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("¤½¤³¤Ë¤Ï¤¯¤µ¤Ó¤òÂǤƤë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-                       msg_print("You see nothing there to spike.");
-#endif
-
+                       msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
                }
 
                /* Get a spike */
                else if (!get_spike(&item))
                {
-                       /* Message */
-#ifdef JP
-                       msg_print("¤¯¤µ¤Ó¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡ª");
-#else
-                       msg_print("You have no spikes!");
-#endif
+                       msg_print(_("くさびを持っていない!", "You have no spikes!"));
                }
 
                /* Is a monster in the way? */
-               else if (c_ptr->m_idx)
+               else if (g_ptr->m_idx)
                {
-                       /* Take a turn */
-                       energy_use = 100;
+                       take_turn(p_ptr, 100);
 
-                       /* Message */
-#ifdef JP
-                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
-#else
-                       msg_print("There is a monster in the way!");
-#endif
+                       msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
                        py_attack(y, x, 0);
@@ -2648,16 +2003,10 @@ void do_cmd_spike(void)
                /* Go for it */
                else
                {
-                       /* Take a turn */
-                       energy_use = 100;
+                       take_turn(p_ptr, 100);
 
                        /* Successful jamming */
-#ifdef JP
-                       msg_format("%s¤Ë¤¯¤µ¤Ó¤òÂǤÁ¹þ¤ó¤À¡£", f_name + f_info[feat].name);
-#else
-                       msg_format("You jam the %s with a spike.", f_name + f_info[feat].name);
-#endif
-
+                       msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
                        cave_alter_feat(y, x, FF_SPIKE);
 
                        /* Use up, and describe, a single spike, from the bottom */
@@ -2670,12 +2019,15 @@ void do_cmd_spike(void)
 
 
 
-/*
+/*!
+ * @brief 「歩く」動作コマンドのメインルーチン /
  * Support code for the "Walk" and "Jump" commands
+ * @param pickup アイテムの自動拾いを行うならTRUE
+ * @return なし
  */
 void do_cmd_walk(bool pickup)
 {
-       int dir;
+       DIRECTION dir;
 
        bool more = FALSE;
 
@@ -2685,8 +2037,6 @@ void do_cmd_walk(bool pickup)
        {
                /* Set repeat count */
                command_rep = command_arg - 1;
-
-               /* Redraw the state */
                p_ptr->redraw |= (PR_STATE);
 
                /* Cancel the arg */
@@ -2694,10 +2044,9 @@ void do_cmd_walk(bool pickup)
        }
 
        /* Get a "repeated" direction */
-       if (get_rep_dir(&dir,FALSE))
+       if (get_rep_dir(&dir, FALSE))
        {
-               /* Take a turn */
-               energy_use = 100;
+               take_turn(p_ptr, 100);
 
                if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
                {
@@ -2705,1072 +2054,202 @@ void do_cmd_walk(bool pickup)
                }
 
                /* Hack -- In small scale wilderness it takes MUCH more time to move */
-               if (p_ptr->wild_mode) energy_use *= ((MAX_HGT + MAX_WID) / 2);
-               if (p_ptr->action == ACTION_HAYAGAKE) energy_use = energy_use * (45-(p_ptr->lev/2)) / 100;
+               if (p_ptr->wild_mode) p_ptr->energy_use *= ((MAX_HGT + MAX_WID) / 2);
+               if (p_ptr->action == ACTION_HAYAGAKE) p_ptr->energy_use = p_ptr->energy_use * (45-(p_ptr->lev/2)) / 100;
 
                /* Actually move the character */
                move_player(dir, pickup, FALSE);
 
-               /* Allow more walking */
-               more = TRUE;
-       }
-
-       /* Hack again -- Is there a special encounter ??? */
-       if (p_ptr->wild_mode && !cave_have_flag_bold(py, px, FF_TOWN))
-       {
-               int tmp = 120 + p_ptr->lev*10 - wilderness[py][px].level + 5;
-               if (tmp < 1) 
-                       tmp = 1;
-               if (((wilderness[py][px].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl))
-               {
-                       /* Inform the player of his horrible fate :=) */
-#ifdef JP
-                       msg_print("½±·â¤À¡ª");
-#else
-                       msg_print("You are ambushed !");
-#endif
-
-                       /* Go into large wilderness view */
-                       p_ptr->oldpy = randint1(MAX_HGT-2);
-                       p_ptr->oldpx = randint1(MAX_WID-2);
-                       change_wild_mode();
-
-                       /* Give first move to monsters */
-                       energy_use = 100;
-
-                       /* HACk -- set the encouter flag for the wilderness generation */
-                       generate_encounter = TRUE;
-               }
-       }
-
-       /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
-}
-
-
-
-/*
- * Start running.
- */
-void do_cmd_run(void)
-{
-       int dir;
-
-       /* Hack -- no running when confused */
-       if (p_ptr->confused)
-       {
-#ifdef JP
-               msg_print("º®Í𤷤Ƥ¤¤ÆÁö¤ì¤Ê¤¤¡ª");
-#else
-               msg_print("You are too confused!");
-#endif
-
-               return;
-       }
-
-       if (p_ptr->special_defense & KATA_MUSOU)
-       {
-               set_action(ACTION_NONE);
-       }
-
-       /* Get a "repeated" direction */
-       if (get_rep_dir(&dir,FALSE))
-       {
-               /* Hack -- Set the run counter */
-               running = (command_arg ? command_arg : 1000);
-
-               /* First step */
-               run_step(dir);
-       }
-}
-
-
-
-/*
- * Stay still.  Search.  Enter stores.
- * Pick up treasure if "pickup" is true.
- */
-void do_cmd_stay(bool pickup)
-{
-       u32b mpe_mode = MPE_STAYING | MPE_ENERGY_USE;
-
-       /* Allow repeated command */
-       if (command_arg)
-       {
-               /* Set repeat count */
-               command_rep = command_arg - 1;
-
-               /* Redraw the state */
-               p_ptr->redraw |= (PR_STATE);
-
-               /* Cancel the arg */
-               command_arg = 0;
-       }
-
-       /* Take a turn */
-       energy_use = 100;
-
-       if (pickup) mpe_mode |= MPE_DO_PICKUP;
-       (void)move_player_effect(py, px, mpe_mode);
-}
-
-
-
-/*
- * Resting allows a player to safely restore his hp    -RAK-
- */
-void do_cmd_rest(void)
-{
-
-       set_action(ACTION_NONE);
-
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] || p_ptr->magic_num1[1]))
-       {
-               stop_singing();
-       }
-
-       /* Prompt for time if needed */
-       if (command_arg <= 0)
-       {
-#ifdef JP
-               cptr p = "µÙ·Æ (0-9999, '*' ¤Ç HP/MPÁ´²÷, '&' ¤ÇɬÍפʤÀ¤±): ";
-#else
-               cptr p = "Rest (0-9999, '*' for HP/SP, '&' as needed): ";
-#endif
-
-
-               char out_val[80];
-
-               /* Default */
-               strcpy(out_val, "&");
-
-               /* Ask for duration */
-               if (!get_string(p, out_val, 4)) return;
-
-               /* Rest until done */
-               if (out_val[0] == '&')
-               {
-                       command_arg = (-2);
-               }
-
-               /* Rest a lot */
-               else if (out_val[0] == '*')
-               {
-                       command_arg = (-1);
-               }
-
-               /* Rest some */
-               else
-               {
-                       command_arg = atoi(out_val);
-                       if (command_arg <= 0) return;
-               }
-       }
-
-
-       /* Paranoia */
-       if (command_arg > 9999) command_arg = 9999;
-
-       if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
-
-       /* Take a turn XXX XXX XXX (?) */
-       energy_use = 100;
-
-       /* The sin of sloth */
-       if (command_arg > 100)
-               chg_virtue(V_DILIGENCE, -1);
-       
-       /* Why are you sleeping when there's no need?  WAKE UP!*/
-       if ((p_ptr->chp == p_ptr->mhp) &&
-           (p_ptr->csp == p_ptr->msp) &&
-           !p_ptr->blind && !p_ptr->confused &&
-           !p_ptr->poisoned && !p_ptr->afraid &&
-           !p_ptr->stun && !p_ptr->cut &&
-           !p_ptr->slow && !p_ptr->paralyzed &&
-           !p_ptr->image && !p_ptr->word_recall &&
-           !p_ptr->alter_reality)
-                       chg_virtue(V_DILIGENCE, -1);
-
-       /* Save the rest code */
-       resting = command_arg;
-       p_ptr->action = ACTION_REST;
-
-       /* Recalculate bonuses */
-       p_ptr->update |= (PU_BONUS);
-
-       /* Redraw the state */
-       p_ptr->redraw |= (PR_STATE);
-
-       /* Handle stuff */
-       handle_stuff();
-
-       /* Refresh */
-       Term_fresh();
-}
-
-
-/*
- * Determines the odds of an object breaking when thrown at a monster
- *
- * Note that artifacts never break, see the "drop_near()" function.
- */
-static int breakage_chance(object_type *o_ptr)
-{
-       int archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (p_ptr->lev-1)/7 + 4: 0);
-
-       /* Examine the item type */
-       switch (o_ptr->tval)
-       {
-               /* Always break */
-               case TV_FLASK:
-               case TV_POTION:
-               case TV_BOTTLE:
-               case TV_FOOD:
-               case TV_JUNK:
-                       return (100);
-
-               /* Often break */
-               case TV_LITE:
-               case TV_SCROLL:
-               case TV_SKELETON:
-                       return (50);
-
-               /* Sometimes break */
-               case TV_WAND:
-               case TV_SPIKE:
-                       return (25);
-               case TV_ARROW:
-                       return (20 - archer_bonus * 2);
-
-               /* Rarely break */
-               case TV_SHOT:
-               case TV_BOLT:
-                       return (10 - archer_bonus);
-               default:
-                       return (10);
-       }
-}
-
-
-static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
-{
-       int mult = 10;
-
-       monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-       u32b flgs[TR_FLAG_SIZE];
-
-       /* Extract the flags */
-       object_flags(o_ptr, flgs);
-
-       /* Some "weapons" and "ammo" do extra damage */
-       switch (o_ptr->tval)
-       {
-               case TV_SHOT:
-               case TV_ARROW:
-               case TV_BOLT:
-               {
-                       /* Slay Animal */
-                       if ((have_flag(flgs, TR_SLAY_ANIMAL)) &&
-                           (r_ptr->flags3 & RF3_ANIMAL))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_ANIMAL;
-                               }
-
-                               if (mult < 17) mult = 17;
-                       }
-
-                       /* Kill Animal */
-                       if ((have_flag(flgs, TR_KILL_ANIMAL)) &&
-                           (r_ptr->flags3 & RF3_ANIMAL))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_ANIMAL;
-                               }
-
-                               if (mult < 27) mult = 27;
-                       }
-
-                       /* Slay Evil */
-                       if ((have_flag(flgs, TR_SLAY_EVIL)) &&
-                           (r_ptr->flags3 & RF3_EVIL))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_EVIL;
-                               }
-
-                               if (mult < 15) mult = 15;
-                       }
-
-                       /* Kill Evil */
-                       if ((have_flag(flgs, TR_KILL_EVIL)) &&
-                           (r_ptr->flags3 & RF3_EVIL))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_EVIL;
-                               }
-
-                               if (mult < 25) mult = 25;
-                       }
-
-                       /* Slay Human */
-                       if ((have_flag(flgs, TR_SLAY_HUMAN)) &&
-                           (r_ptr->flags2 & RF2_HUMAN))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags2 |= RF2_HUMAN;
-                               }
-
-                               if (mult < 17) mult = 17;
-                       }
-
-                       /* Kill Human */
-                       if ((have_flag(flgs, TR_KILL_HUMAN)) &&
-                           (r_ptr->flags2 & RF2_HUMAN))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags2 |= RF2_HUMAN;
-                               }
-
-                               if (mult < 27) mult = 27;
-                       }
-
-                       /* Slay Undead */
-                       if ((have_flag(flgs, TR_SLAY_UNDEAD)) &&
-                           (r_ptr->flags3 & RF3_UNDEAD))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_UNDEAD;
-                               }
-
-                               if (mult < 20) mult = 20;
-                       }
-
-                       /* Kill Undead */
-                       if ((have_flag(flgs, TR_KILL_UNDEAD)) &&
-                           (r_ptr->flags3 & RF3_UNDEAD))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_UNDEAD;
-                               }
-
-                               if (mult < 30) mult = 30;
-                       }
-
-                       /* Slay Demon */
-                       if ((have_flag(flgs, TR_SLAY_DEMON)) &&
-                           (r_ptr->flags3 & RF3_DEMON))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_DEMON;
-                               }
-
-                               if (mult < 20) mult = 20;
-                       }
-
-                       /* Kill Demon */
-                       if ((have_flag(flgs, TR_KILL_DEMON)) &&
-                           (r_ptr->flags3 & RF3_DEMON))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_DEMON;
-                               }
-
-                               if (mult < 30) mult = 30;
-                       }
-
-                       /* Slay Orc */
-                       if ((have_flag(flgs, TR_SLAY_ORC)) &&
-                           (r_ptr->flags3 & RF3_ORC))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_ORC;
-                               }
-
-                               if (mult < 20) mult = 20;
-                       }
-
-                       /* Kill Orc */
-                       if ((have_flag(flgs, TR_KILL_ORC)) &&
-                           (r_ptr->flags3 & RF3_ORC))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_ORC;
-                               }
-
-                               if (mult < 30) mult = 30;
-                       }
-
-                       /* Slay Troll */
-                       if ((have_flag(flgs, TR_SLAY_TROLL)) &&
-                           (r_ptr->flags3 & RF3_TROLL))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_TROLL;
-                               }
-
-                               if (mult < 20) mult = 20;
-                       }
-
-                       /* Kill Troll */
-                       if ((have_flag(flgs, TR_KILL_TROLL)) &&
-                           (r_ptr->flags3 & RF3_TROLL))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_TROLL;
-                               }
-
-                               if (mult < 30) mult = 30;
-                       }
-
-                       /* Slay Giant */
-                       if ((have_flag(flgs, TR_SLAY_GIANT)) &&
-                           (r_ptr->flags3 & RF3_GIANT))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_GIANT;
-                               }
-
-                               if (mult < 20) mult = 20;
-                       }
-
-                       /* Kill Giant */
-                       if ((have_flag(flgs, TR_KILL_GIANT)) &&
-                           (r_ptr->flags3 & RF3_GIANT))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_GIANT;
-                               }
-
-                               if (mult < 30) mult = 30;
-                       }
-
-                       /* Slay Dragon  */
-                       if ((have_flag(flgs, TR_SLAY_DRAGON)) &&
-                           (r_ptr->flags3 & RF3_DRAGON))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_DRAGON;
-                               }
-
-                               if (mult < 20) mult = 20;
-                       }
-
-                       /* Execute Dragon */
-                       if ((have_flag(flgs, TR_KILL_DRAGON)) &&
-                           (r_ptr->flags3 & RF3_DRAGON))
-                       {
-                               if (is_original_ap_and_seen(m_ptr))
-                               {
-                                       r_ptr->r_flags3 |= RF3_DRAGON;
-                               }
-
-                               if (mult < 30) mult = 30;
-
-                               if ((o_ptr->name1 == ART_BARD_ARROW) &&
-                                   (m_ptr->r_idx == MON_SMAUG) &&
-                                   (inventory[INVEN_BOW].name1 == ART_BARD))
-                                       mult *= 5;
-                       }
-
-                       /* Brand (Acid) */
-                       if (have_flag(flgs, TR_BRAND_ACID))
-                       {
-                               /* Notice immunity */
-                               if (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)
-                               {
-                                       if (is_original_ap_and_seen(m_ptr))
-                                       {
-                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ACID_MASK);
-                                       }
-                               }
-
-                               /* Otherwise, take the damage */
-                               else
-                               {
-                                       if (mult < 17) mult = 17;
-                               }
-                       }
-
-                       /* Brand (Elec) */
-                       if (have_flag(flgs, TR_BRAND_ELEC))
-                       {
-                               /* Notice immunity */
-                               if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
-                               {
-                                       if (is_original_ap_and_seen(m_ptr))
-                                       {
-                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
-                                       }
-                               }
-
-                               /* Otherwise, take the damage */
-                               else
-                               {
-                                       if (mult < 17) mult = 17;
-                               }
-                       }
-
-                       /* Brand (Fire) */
-                       if (have_flag(flgs, TR_BRAND_FIRE))
-                       {
-                               /* Notice immunity */
-                               if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
-                               {
-                                       if (is_original_ap_and_seen(m_ptr))
-                                       {
-                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
-                                       }
-                               }
-
-                               /* Otherwise, take the damage */
-                               else
-                               {
-                                       if (r_ptr->flags3 & RF3_HURT_FIRE)
-                                       {
-                                               if (mult < 25) mult = 25;
-                                               if (is_original_ap_and_seen(m_ptr))
-                                               {
-                                                       r_ptr->r_flags3 |= RF3_HURT_FIRE;
-                                               }
-                                       }
-                                       else if (mult < 17) mult = 17;
-                               }
-                       }
-
-                       /* Brand (Cold) */
-                       if (have_flag(flgs, TR_BRAND_COLD))
-                       {
-                               /* Notice immunity */
-                               if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
-                               {
-                                       if (is_original_ap_and_seen(m_ptr))
-                                       {
-                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
-                                       }
-                               }
-                               /* Otherwise, take the damage */
-                               else
-                               {
-                                       if (r_ptr->flags3 & RF3_HURT_COLD)
-                                       {
-                                               if (mult < 25) mult = 25;
-                                               if (is_original_ap_and_seen(m_ptr))
-                                               {
-                                                       r_ptr->r_flags3 |= RF3_HURT_COLD;
-                                               }
-                                       }
-                                       else if (mult < 17) mult = 17;
-                               }
-                       }
-
-                       /* Brand (Poison) */
-                       if (have_flag(flgs, TR_BRAND_POIS))
-                       {
-                               /* Notice immunity */
-                               if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
-                               {
-                                       if (is_original_ap_and_seen(m_ptr))
-                                       {
-                                               r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
-                                       }
-                               }
-
-                               /* Otherwise, take the damage */
-                               else
-                               {
-                                       if (mult < 17) mult = 17;
-                               }
-                       }
-
-                       if ((have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (p_ptr->msp / 30)))
-                       {
-                               p_ptr->csp -= (1+(p_ptr->msp / 30));
-                               p_ptr->redraw |= (PR_MANA);
-                               mult = mult * 5 / 2;
-                       }
-                       break;
-               }
-       }
-
-       /* Return the total damage */
-       return (tdam * mult / 10);
-}
-
-
-/*
- * Fire an object from the pack or floor.
- *
- * You may only fire items that "match" your missile launcher.
- *
- * You must use slings + pebbles/shots, bows + arrows, xbows + bolts.
- *
- * See "calc_bonuses()" for more calculations and such.
- *
- * Note that "firing" a missile is MUCH better than "throwing" it.
- *
- * Note: "unseen" monsters are very hard to hit.
- *
- * Objects are more likely to break if they "attempt" to hit a monster.
- *
- * Rangers (with Bows) and Anyone (with "Extra Shots") get extra shots.
- *
- * The "extra shot" code works by decreasing the amount of energy
- * required to make each shot, spreading the shots out over time.
- *
- * Note that when firing missiles, the launcher multiplier is applied
- * after all the bonuses are added in, making multipliers very useful.
- *
- * Note that Bows of "Extra Might" get extra range and an extra bonus
- * for the damage multiplier.
- *
- * Note that Bows of "Extra Shots" give an extra shot.
- */
-void do_cmd_fire_aux(int item, object_type *j_ptr)
-{
-       int dir;
-       int j, y, x, ny, nx, ty, tx, prev_y, prev_x;
-       int tdam, tdis, thits, tmul;
-       int bonus, chance;
-       int cur_dis, visible;
-
-       object_type forge;
-       object_type *q_ptr;
-
-       object_type *o_ptr;
-
-       bool hit_body = FALSE;
-
-       char o_name[MAX_NLEN];
-
-       int msec = delay_factor * delay_factor * delay_factor;
-
-       /* STICK TO */
-       bool stick_to = FALSE;
-
-       /* Access the item (if in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
-
-       /* Describe the object */
-       object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
-
-
-       /* Use the proper number of shots */
-       thits = p_ptr->num_fire;
-
-       /* Use a base distance */
-       tdis = 10;
-
-       /* Base damage from thrown object plus launcher bonus */
-       tdam = damroll(o_ptr->dd, o_ptr->ds) + o_ptr->to_d + j_ptr->to_d;
-
-       /* Actually "fire" the object */
-       bonus = (p_ptr->to_h_b + o_ptr->to_h + j_ptr->to_h);
-       if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW))
-               chance = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + bonus) * BTH_PLUS_ADJ);
-       else
-               chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + bonus) * BTH_PLUS_ADJ);
-
-       energy_use = bow_energy(j_ptr->sval);
-       tmul = bow_tmul(j_ptr->sval);
-
-       /* Get extra "power" from "extra might" */
-       if (p_ptr->xtra_might) tmul++;
-
-       tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
-
-       /* Boost the damage */
-       tdam *= tmul;
-       tdam /= 100;
-
-       /* Base range */
-       tdis = 10 + tmul/40;
-       if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW))
-               tdis -= 5;
-
-       project_length = tdis + 1;
-
-       /* Get a direction (or cancel) */
-       if (!get_aim_dir(&dir))
-       {
-               energy_use = 0;
-
-               /* need not to reset project_length (already did)*/
-
-               return;
-       }
-
-       /* Start at the player */
-       y = py;
-       x = px;
-
-       /* Predict the "target" location */
-       tx = px + 99 * ddx[dir];
-       ty = py + 99 * ddy[dir];
-
-       /* Check for "target request" */
-       if ((dir == 5) && target_okay())
-       {
-               tx = target_col;
-               ty = target_row;
-       }
-
-       project_length = 0; /* reset to default */
-
-       /* Don't shoot at my feet */
-       if (tx == px && ty == py)
-       {
-               energy_use = 0;
-
-               /* project_length is already reset to 0 */
-
-               return;
-       }
-
-
-       /* Get local object */
-       q_ptr = &forge;
-
-       /* Obtain a local object */
-       object_copy(q_ptr, o_ptr);
-
-       /* Single object */
-       q_ptr->number = 1;
-
-       /* Reduce and describe inventory */
-       if (item >= 0)
-       {
-               inven_item_increase(item, -1);
-               inven_item_describe(item);
-               inven_item_optimize(item);
-       }
-
-       /* Reduce and describe floor item */
-       else
-       {
-               floor_item_increase(0 - item, -1);
-               floor_item_optimize(0 - item);
-       }
-
-
-       /* Sound */
-       sound(SOUND_SHOOT);
-
-
-       /* Take a (partial) turn */
-       energy_use = (energy_use / thits);
-
-
-       /* Hack -- Handle stuff */
-       handle_stuff();
-
-       /* Save the old location */
-       prev_y = y;
-       prev_x = x;
-
-       /* Travel until stopped */
-       for (cur_dis = 0; cur_dis <= tdis; )
-       {
-               /* Hack -- Stop at the target */
-               if ((y == ty) && (x == tx)) break;
-
-               /* Calculate the new location (see "project()") */
-               ny = y;
-               nx = x;
-               mmove2(&ny, &nx, py, px, ty, tx);
-
-               /* Stopped by walls/doors */
-               if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && !cave[ny][nx].m_idx) break;
-
-               /* Advance the distance */
-               cur_dis++;
-
-
-               /* The player can see the (on screen) missile */
-               if (panel_contains(ny, nx) && player_can_see_bold(ny, nx))
-               {
-                       char c = object_char(q_ptr);
-                       byte a = object_attr(q_ptr);
-
-                       /* Draw, Hilite, Fresh, Pause, Erase */
-                       print_rel(c, a, ny, nx);
-                       move_cursor_relative(ny, nx);
-                       Term_fresh();
-                       Term_xtra(TERM_XTRA_DELAY, msec);
-                       lite_spot(ny, nx);
-                       Term_fresh();
-               }
-
-               /* The player cannot see the missile */
-               else
-               {
-                       /* Pause anyway, for consistancy */
-                       Term_xtra(TERM_XTRA_DELAY, msec);
-               }
-
-               /* Save the old location */
-               prev_y = y;
-               prev_x = x;
-
-               /* Save the new location */
-               x = nx;
-               y = ny;
-
-
-               /* Monster here, Try to hit it */
-               if (cave[y][x].m_idx)
-               {
-                       cave_type *c_ptr = &cave[y][x];
-
-                       monster_type *m_ptr = &m_list[c_ptr->m_idx];
-                       monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-                       /* Check the visibility */
-                       visible = m_ptr->ml;
-
-                       /* Note the collision */
-                       hit_body = TRUE;
-
-                       if (MON_CSLEEP(m_ptr))
-                       {
-                               if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
-                               if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
-                       }
-
-                       if ((r_ptr->level + 10) > p_ptr->lev)
-                       {
-                               int now_exp = p_ptr->weapon_exp[0][j_ptr->sval];
-                               if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval])
-                               {
-                                       int amount = 0;
-                                       if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
-                                       else if (now_exp < WEAPON_EXP_SKILLED) amount = 25;
-                                       else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 10;
-                                       else if (p_ptr->lev > 34) amount = 2;
-                                       p_ptr->weapon_exp[0][j_ptr->sval] += amount;
-                                       p_ptr->update |= (PU_BONUS);
-                               }
-                       }
+               /* Allow more walking */
+               more = TRUE;
+       }
 
-                       if (p_ptr->riding)
-                       {
-                               if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING])
-                                       && ((p_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < r_info[m_list[p_ptr->riding].r_idx].level)
-                                       && one_in_(2))
-                               {
-                                       p_ptr->skill_exp[GINOU_RIDING] += 1;
-                                       p_ptr->update |= (PU_BONUS);
-                               }
-                       }
+       /* Hack again -- Is there a special encounter ??? */
+       if (p_ptr->wild_mode && !cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_TOWN))
+       {
+               int tmp = 120 + p_ptr->lev*10 - wilderness[p_ptr->y][p_ptr->x].level + 5;
+               if (tmp < 1) 
+                       tmp = 1;
+               if (((wilderness[p_ptr->y][p_ptr->x].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl))
+               {
+                       /* Inform the player of his horrible fate :=) */
+                       msg_print(_("襲撃だ!", "You are ambushed !"));
 
-                       /* Did we hit it (penalize range) */
-                       if (test_hit_fire(chance - cur_dis, r_ptr->ac, m_ptr->ml))
-                       {
-                               bool fear = FALSE;
+                       /* Go into large wilderness view */
+                       p_ptr->oldpy = randint1(MAX_HGT-2);
+                       p_ptr->oldpx = randint1(MAX_WID-2);
+                       change_wild_mode();
 
-                               /* Handle unseen monster */
-                               if (!visible)
-                               {
-                                       /* Invisible monster */
-#ifdef JP
-                                       msg_format("%s¤¬Å¨¤òÊ᪤·¤¿¡£", o_name);
-#else
-                                       msg_format("The %s finds a mark.", o_name);
-#endif
+                       /* Give first move to monsters */
+                       take_turn(p_ptr, 100);
 
-                               }
+                       /* HACk -- set the encouter flag for the wilderness generation */
+                       generate_encounter = TRUE;
+               }
+       }
 
-                               /* Handle visible monster */
-                               else
-                               {
-                                       char m_name[80];
+       /* Cancel repeat unless we may continue */
+       if (!more) disturb(FALSE, FALSE);
+}
 
-                                       /* Get "the monster" or "it" */
-                                       monster_desc(m_name, m_ptr, 0);
 
-                                       /* Message */
-#ifdef JP
-                                       msg_format("%s¤¬%s¤ËÌ¿Ã椷¤¿¡£", o_name, m_name);
-#else
-                                       msg_format("The %s hits %s.", o_name, m_name);
-#endif
+/*!
+ * @brief 「走る」動作コマンドのメインルーチン /
+ * Start running.
+ * @return なし
+ */
+void do_cmd_run(void)
+{
+       DIRECTION dir;
+       if (cmd_limit_confused(p_ptr)) return;
 
+       if (p_ptr->special_defense & KATA_MUSOU)
+       {
+               set_action(ACTION_NONE);
+       }
 
-                                       /* Hack -- Track this monster race */
-                                       if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
+       /* Get a "repeated" direction */
+       if (get_rep_dir(&dir,FALSE))
+       {
+               /* Hack -- Set the run counter */
+               running = (command_arg ? command_arg : 1000);
 
-                                       /* Hack -- Track this monster */
-                                       if (m_ptr->ml) health_track(c_ptr->m_idx);
-                               }
+               /* First step */
+               run_step(dir);
+       }
+}
 
-                               /* Apply special damage XXX XXX XXX */
-                               tdam = tot_dam_aux_shot(q_ptr, tdam, m_ptr);
-                               tdam = critical_shot(q_ptr->weight, q_ptr->to_h, tdam);
 
-                               /* No negative damage */
-                               if (tdam < 0) tdam = 0;
+/*!
+ * @brief 「留まる」動作コマンドのメインルーチン /
+ * Stay still.  Search.  Enter stores.
+ * Pick up treasure if "pickup" is true.
+ * @param pickup アイテムの自動拾いを行うならTRUE
+ * @return なし
+ */
+void do_cmd_stay(bool pickup)
+{
+       u32b mpe_mode = MPE_STAYING | MPE_ENERGY_USE;
 
-                               /* Modify the damage */
-                               tdam = mon_damage_mod(m_ptr, tdam, FALSE);
+       /* Allow repeated command */
+       if (command_arg)
+       {
+               /* Set repeat count */
+               command_rep = command_arg - 1;
+               p_ptr->redraw |= (PR_STATE);
 
-                               /* Complex message */
-                               if (p_ptr->wizard || cheat_xtra)
-                               {
-#ifdef JP
-                                       msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£",
-                                                  tdam, m_ptr->hp);
-#else
-                                       msg_format("You do %d (out of %d) damage.",
-                                                  tdam, m_ptr->hp);
-#endif
+               /* Cancel the arg */
+               command_arg = 0;
+       }
 
-                               }
+       take_turn(p_ptr, 100);
 
-                               /* Hit the monster, check for death */
-                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
-                               {
-                                       /* Dead monster */
-                               }
+       if (pickup) mpe_mode |= MPE_DO_PICKUP;
+       (void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode);
+}
 
-                               /* No death */
-                               else
-                               {
-                                       /* STICK TO */
-                                       if (object_is_fixed_artifact(q_ptr))
-                                       {
-                                               char m_name[80];
 
-                                               monster_desc(m_name, m_ptr, 0);
+/*!
+ * @brief 「休む」動作コマンドのメインルーチン /
+ * Resting allows a player to safely restore his hp    -RAK-
+ * @return なし
+ */
+void do_cmd_rest(void)
+{
 
-                                               stick_to = TRUE;
-#ifdef JP
-                                               msg_format("%s¤Ï%s¤ËÆͤ­»É¤µ¤Ã¤¿¡ª",o_name, m_name);
-#else
-                                               msg_format("%^s have stuck into %s!",o_name, m_name);
-#endif
-                                       }
+       set_action(ACTION_NONE);
 
-                                       /* Message */
-                                       message_pain(c_ptr->m_idx, tdam);
+       if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) || INTERUPTING_SONG_EFFECT(p_ptr)))
+       {
+               stop_singing(p_ptr);
+       }
 
-                                       /* Anger the monster */
-                                       if (tdam > 0) anger_monster(m_ptr);
+       /* Hex */
+       if (hex_spelling_any()) stop_hex_spell_all();
 
-                                       /* Take note */
-                                       if (fear && m_ptr->ml)
-                                       {
-                                               char m_name[80];
+       /* Prompt for time if needed */
+       if (command_arg <= 0)
+       {
+               concptr p = _("休憩 (0-9999, '*' で HP/MP全快, '&' で必要なだけ): ", 
+                                  "Rest (0-9999, '*' for HP/SP, '&' as needed): ");
 
-                                               /* Sound */
-                                               sound(SOUND_FLEE);
 
-                                               /* Get the monster name (or "it") */
-                                               monster_desc(m_name, m_ptr, 0);
+               char out_val[80];
 
-                                               /* Message */
-#ifdef JP
-                                               msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
-#else
-                                               msg_format("%^s flees in terror!", m_name);
-#endif
+               /* Default */
+               strcpy(out_val, "&");
 
-                                       }
-                                       if (!projectable(m_ptr->fy, m_ptr->fx, py, px))
-                                       {
-                                               set_target(m_ptr, py, px);
-                                       }
-                               }
-                       }
+               /* Ask for duration */
+               if (!get_string(p, out_val, 4)) return;
 
-                       /* Stop looking */
-                       break;
+               /* Rest until done */
+               if (out_val[0] == '&')
+               {
+                       command_arg = COMMAND_ARG_REST_UNTIL_DONE;
                }
-       }
-
-       /* Chance of breakage (during attacks) */
-       j = (hit_body ? breakage_chance(q_ptr) : 0);
 
-       if (stick_to)
-       {
-               int m_idx = cave[y][x].m_idx;
-               monster_type *m_ptr = &m_list[m_idx];
-               int o_idx = o_pop();
+               /* Rest a lot */
+               else if (out_val[0] == '*')
+               {
+                       command_arg = COMMAND_ARG_REST_FULL_HEALING;
+               }
 
-               if (!o_idx)
+               /* Rest some */
+               else
                {
-#ifdef JP
-                       msg_format("%s¤Ï¤É¤³¤«¤Ø¹Ô¤Ã¤¿¡£", o_name);
-#else
-                       msg_format("The %s have gone to somewhere.", o_name);
-#endif
-                       if (object_is_fixed_artifact(q_ptr))
-                       {
-                               a_info[j_ptr->name1].cur_num = 0;
-                       }
-                       return;
+                       command_arg = (COMMAND_ARG)atoi(out_val);
+                       if (command_arg <= 0) return;
                }
+       }
+
+       if (command_arg > 9999) command_arg = 9999;
 
-               o_ptr = &o_list[o_idx];
-               object_copy(o_ptr, q_ptr);
+       if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
 
-               /* Forget mark */
-               o_ptr->marked = 0;
+       /* Take a current_world_ptr->game_turn (?) */
+       take_turn(p_ptr, 100);
 
-               /* Forget location */
-               o_ptr->iy = o_ptr->ix = 0;
+       /* The sin of sloth */
+       if (command_arg > 100) chg_virtue(V_DILIGENCE, -1);
+       
+       /* Why are you sleeping when there's no need?  WAKE UP!*/
+       if ((p_ptr->chp == p_ptr->mhp) &&
+           (p_ptr->csp == p_ptr->msp) &&
+           !p_ptr->blind && !p_ptr->confused &&
+           !p_ptr->poisoned && !p_ptr->afraid &&
+           !p_ptr->stun && !p_ptr->cut &&
+           !p_ptr->slow && !p_ptr->paralyzed &&
+           !p_ptr->image && !p_ptr->word_recall &&
+           !p_ptr->alter_reality)
+                       chg_virtue(V_DILIGENCE, -1);
 
-               /* Memorize monster */
-               o_ptr->held_m_idx = m_idx;
+       /* Save the rest code */
+       p_ptr->resting = command_arg;
+       p_ptr->action = ACTION_REST;
+       p_ptr->update |= (PU_BONUS);
+       update_creature(p_ptr);
 
-               /* Build a stack */
-               o_ptr->next_o_idx = m_ptr->hold_o_idx;
+       p_ptr->redraw |= (PR_STATE);
+       update_output();
 
-               /* Carry object */
-               m_ptr->hold_o_idx = o_idx;
-       }
-       else if (cave_have_flag_bold(y, x, FF_PROJECT))
-       {
-               /* Drop (or break) near that location */
-               (void)drop_near(q_ptr, j, y, x);
-       }
-       else
-       {
-               /* Drop (or break) near that location */
-               (void)drop_near(q_ptr, j, prev_y, prev_x);
-       }
+       Term_fresh();
 }
 
 
-void do_cmd_fire(void)
+
+/*!
+ * @brief 射撃処理のメインルーチン
+ * @return なし
+ */
+void do_cmd_fire(SPELL_IDX snipe_type)
 {
-       int item;
-       object_type *j_ptr;
-       cptr q, s;
+       OBJECT_IDX item;
+       object_type *j_ptr, *ammo_ptr;
+       concptr q, s;
+
+       if(p_ptr->wild_mode) return;
+
+       is_fired = FALSE;       /* not fired yet */
 
        /* Get the "bow" (if any) */
        j_ptr = &inventory[INVEN_BOW];
@@ -3778,22 +2257,21 @@ void do_cmd_fire(void)
        /* Require a launcher */
        if (!j_ptr->tval)
        {
-#ifdef JP
-               msg_print("¼Í·âÍѤÎÉð´ï¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£");
-#else
-               msg_print("You have nothing to fire with.");
-#endif
+               msg_print(_("射撃用の武器を持っていない。", "You have nothing to fire with."));
                flush();
                return;
        }
 
        if (j_ptr->sval == SV_CRIMSON)
        {
-#ifdef JP
-               msg_print("¤³¤ÎÉð´ï¤Ïȯư¤·¤Æ»È¤¦¤â¤Î¤Î¤è¤¦¤À¡£");
-#else
-               msg_print("Do activate.");
-#endif
+               msg_print(_("この武器は発動して使うもののようだ。", "Do activate."));
+               flush();
+               return;
+       }
+
+       if (j_ptr->sval == SV_HARP)
+       {
+               msg_print(_("この武器で射撃はできない。", "It's not for firing."));
                flush();
                return;
        }
@@ -3807,56 +2285,66 @@ void do_cmd_fire(void)
        /* Require proper missile */
        item_tester_tval = p_ptr->tval_ammo;
 
-       /* Get an item */
-#ifdef JP
-       q = "¤É¤ì¤ò·â¤Á¤Þ¤¹¤«? ";
-       s = "ȯ¼Í¤µ¤ì¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
-#else
-       q = "Fire which item? ";
-       s = "You have nothing to fire.";
-#endif
+       q = _("どれを撃ちますか? ", "Fire which item? ");
+       s = _("発射されるアイテムがありません。", "You have nothing to fire.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
+
+       ammo_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+       if (!ammo_ptr)
        {
                flush();
                return;
        }
 
        /* Fire the item */
-       do_cmd_fire_aux(item, j_ptr);
-}
+       exe_fire(item, j_ptr, snipe_type);
 
+       if (!is_fired || p_ptr->pclass != CLASS_SNIPER) return;
 
-static bool item_tester_hook_boomerang(object_type *o_ptr)
-{
-       if ((o_ptr->tval==TV_DIGGING) || (o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM) || (o_ptr->tval == TV_HAFTED)) return (TRUE);
-
-       /* Assume not */
-       return (FALSE);
+       /* Sniper actions after some shootings */
+       if (snipe_type == SP_AWAY)
+       {
+               teleport_player(10 + (p_ptr->concent * 2), 0L);
+       }
+       if (snipe_type == SP_FINAL)
+       {
+               msg_print(_("射撃の反動が体を襲った。", "A reactionary of shooting attacked you. "));
+               (void)set_slow(p_ptr->slow + randint0(7) + 7, FALSE);
+               (void)set_stun(p_ptr->stun + randint1(25));
+       }
 }
 
 
-/*
+/*!
+ * @brief 投射処理メインルーチン /
  * Throw an object from the pack or floor.
- *
+ * @param mult 威力の倍率
+ * @param boomerang ブーメラン処理ならばTRUE
+ * @param shuriken 忍者の手裏剣処理ならばTRUE
+ * @return ターンを消費した場合TRUEを返す
+ * @details
+ * <pre>
  * Note: "unseen" monsters are very hard to hit.
  *
  * Should throwing a weapon do full damage?  Should it allow the magic
  * to hit bonus of the weapon to have an effect?  Should it ever cause
  * the item to be destroyed?  Should it do any damage at all?
+ * </pre>
  */
-bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
+bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
 {
-       int dir, item;
-       int i, j, y, x, ty, tx, prev_y, prev_x;
-       int ny[19], nx[19];
+       DIRECTION dir;
+       OBJECT_IDX item;
+       int i;
+       POSITION y, x, ty, tx, prev_y, prev_x;
+       POSITION ny[19], nx[19];
        int chance, tdam, tdis;
-       int mul, div;
+       int mul, div, dd, ds;
        int cur_dis, visible;
+       PERCENTAGE j;
 
        object_type forge;
        object_type *q_ptr;
-
        object_type *o_ptr;
 
        bool hit_body = FALSE;
@@ -3864,87 +2352,68 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
        bool equiped_item = FALSE;
        bool return_when_thrown = FALSE;
 
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        int msec = delay_factor * delay_factor * delay_factor;
 
-       u32b flgs[TR_FLAG_SIZE];
-       cptr q, s;
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
+       concptr q, s;
        bool come_back = FALSE;
        bool do_drop = TRUE;
 
+       if (p_ptr->wild_mode) return FALSE;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
                set_action(ACTION_NONE);
        }
 
-       if (shuriken)
+       if (shuriken >= 0)
        {
                item = shuriken;
+               o_ptr = &inventory[item];
        }
        else if (boomerang)
        {
-               if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
+               if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
                {
                        item_tester_hook = item_tester_hook_boomerang;
-#ifdef JP
-                       q = "¤É¤ÎÉð´ï¤òÅꤲ¤Þ¤¹¤«? ";
-                       s = "Åꤲ¤ëÉð´ï¤¬¤Ê¤¤¡£";
-#else
-                       q = "Throw which item? ";
-                       s = "You have nothing to throw.";
-#endif
-
-                       if (!get_item(&item, q, s, (USE_EQUIP)))
+                       q = _("どの武器を投げますか? ", "Throw which item? ");
+                       s = _("投げる武器がない。", "You have nothing to throw.");
+                       o_ptr = choose_object(&item, q, s, (USE_EQUIP));
+                       if (!o_ptr)
                        {
                                flush();
                                return FALSE;
                        }
                }
-               else if (buki_motteruka(INVEN_LARM)) item = INVEN_LARM;
-               else item = INVEN_RARM;
+               else if (has_melee_weapon(INVEN_LARM))
+               {
+                       item = INVEN_LARM;
+                       o_ptr = &inventory[item];
+               }
+               else
+               {
+                       item = INVEN_RARM;
+                       o_ptr = &inventory[item];
+               }
        }
        else
        {
-               /* Get an item */
-#ifdef JP
-               q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÅꤲ¤Þ¤¹¤«? ";
-               s = "Åꤲ¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
-#else
-               q = "Throw which item? ";
-               s = "You have nothing to throw.";
-#endif
-
-               if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP)))
+               q = _("どのアイテムを投げますか? ", "Throw which item? ");
+               s = _("投げるアイテムがない。", "You have nothing to throw.");
+               o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP));
+               if (!o_ptr)
                {
                        flush();
                        return FALSE;
                }
        }
 
-       /* Access the item (if in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
-
-
        /* Item is cursed */
        if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
        {
-               /* Oops */
-#ifdef JP
-               msg_print("¤Õ¡¼¤à¡¢¤É¤¦¤ä¤é¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£");
-#else
-               msg_print("Hmmm, it seems to be cursed.");
-#endif
-
-               /* Nope */
+               msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
                return FALSE;
        }
 
@@ -3952,19 +2421,13 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
        {
                if (o_ptr->tval != TV_SPIKE)
                {
-#ifdef JP
-                       msg_print("¥¢¥ê¡¼¥Ê¤Ç¤Ï¥¢¥¤¥Æ¥à¤ò»È¤¨¤Ê¤¤¡ª");
-#else
-                       msg_print("You're in the arena now. This is hand-to-hand!");
-#endif
+                       msg_print(_("アリーナではアイテムを使えない!", "You're in the arena now. This is hand-to-hand!"));
                        msg_print(NULL);
 
-                       /* Nope */
                        return FALSE;
                }
-       }
 
-       /* Get local object */
+       }
        q_ptr = &forge;
 
        /* Obtain a local object */
@@ -3972,6 +2435,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 
        /* Extract the thrown object's flags. */
        object_flags(q_ptr, flgs);
+       torch_flags(q_ptr, flgs);
 
        /* Distribute the charges of rods/wands between the stacks */
        distribute_charges(o_ptr, q_ptr, 1);
@@ -3979,7 +2443,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
        /* Single object */
        q_ptr->number = 1;
 
-       /* Description */
        object_desc(o_name, q_ptr, OD_OMIT_PREFIX);
 
        if (p_ptr->mighty_throw) mult += 3;
@@ -3998,10 +2461,10 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
        /* Max distance of 10-18 */
        if (tdis > mul) tdis = mul;
 
-       if (shuriken)
+       if (shuriken >= 0)
        {
-               ty = randint0(101)-50+py;
-               tx = randint0(101)-50+px;
+               ty = randint0(101) - 50 + p_ptr->y;
+               tx = randint0(101) - 50 + p_ptr->x;
        }
        else
        {
@@ -4011,8 +2474,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                if (!get_aim_dir(&dir)) return FALSE;
 
                /* Predict the "target" location */
-               tx = px + 99 * ddx[dir];
-               ty = py + 99 * ddy[dir];
+               tx = p_ptr->x + 99 * ddx[dir];
+               ty = p_ptr->y + 99 * ddy[dir];
 
                /* Check for "target request" */
                if ((dir == 5) && target_okay())
@@ -4049,19 +2512,16 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                p_ptr->redraw |= (PR_EQUIPPY);
        }
 
-       /* Take a turn */
-       energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Rogue and Ninja gets bonus */
        if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA))
-               energy_use -= p_ptr->lev;
+               p_ptr->energy_use -= p_ptr->lev;
 
        /* Start at the player */
-       y = py;
-       x = px;
-
+       y = p_ptr->y;
+       x = p_ptr->x;
 
-       /* Hack -- Handle stuff */
        handle_stuff();
 
        if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
@@ -4074,7 +2534,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 
        if (shuriken) chance *= 2;
 
-       /* Save the old location */
        prev_y = y;
        prev_x = x;
 
@@ -4087,20 +2546,20 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                /* Calculate the new location (see "project()") */
                ny[cur_dis] = y;
                nx[cur_dis] = x;
-               mmove2(&ny[cur_dis], &nx[cur_dis], py, px, ty, tx);
+               mmove2(&ny[cur_dis], &nx[cur_dis], p_ptr->y, p_ptr->x, ty, tx);
 
                /* Stopped by walls/doors */
                if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
                {
                        hit_wall = TRUE;
-                       if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !cave[ny[cur_dis]][nx[cur_dis]].m_idx) break;
+                       if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !current_floor_ptr->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break;
                }
 
                /* The player can see the (on screen) missile */
                if (panel_contains(ny[cur_dis], nx[cur_dis]) && player_can_see_bold(ny[cur_dis], nx[cur_dis]))
                {
-                       char c = object_char(q_ptr);
-                       byte a = object_attr(q_ptr);
+                       SYMBOL_CODE c = object_char(q_ptr);
+                       TERM_COLOR a = object_attr(q_ptr);
 
                        /* Draw, Hilite, Fresh, Pause, Erase */
                        print_rel(c, a, ny[cur_dis], nx[cur_dis]);
@@ -4118,7 +2577,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                        Term_xtra(TERM_XTRA_DELAY, msec);
                }
 
-               /* Save the old location */
                prev_y = y;
                prev_x = x;
 
@@ -4130,12 +2588,10 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                cur_dis++;
 
                /* Monster here, Try to hit it */
-               if (cave[y][x].m_idx)
+               if (current_floor_ptr->grid_array[y][x].m_idx)
                {
-                       cave_type *c_ptr = &cave[y][x];
-
-                       monster_type *m_ptr = &m_list[c_ptr->m_idx];
-                       monster_race *r_ptr = &r_info[m_ptr->r_idx];
+                       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+                       monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
 
                        /* Check the visibility */
                        visible = m_ptr->ml;
@@ -4144,7 +2600,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                        hit_body = TRUE;
 
                        /* Did we hit it (penalize range) */
-                       if (test_hit_fire(chance - cur_dis, r_ptr->ac, m_ptr->ml))
+                       if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name))
                        {
                                bool fear = FALSE;
 
@@ -4152,42 +2608,31 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                                if (!visible)
                                {
                                        /* Invisible monster */
-#ifdef JP
-                                       msg_format("%s¤¬Å¨¤òÊ᪤·¤¿¡£", o_name);
-#else
-                                       msg_format("The %s finds a mark.", o_name);
-#endif
-
+                                       msg_format(_("%sが敵を捕捉した。", "The %s finds a mark."), o_name);
                                }
 
                                /* Handle visible monster */
                                else
                                {
-                                       char m_name[80];
-
-                                       /* Get "the monster" or "it" */
+                                       GAME_TEXT m_name[MAX_NLEN];
                                        monster_desc(m_name, m_ptr, 0);
+                                       msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
 
-                                       /* Message */
-#ifdef JP
-                                       msg_format("%s¤¬%s¤ËÌ¿Ã椷¤¿¡£", o_name, m_name);
-#else
-                                       msg_format("The %s hits %s.", o_name, m_name);
-#endif
-
-
-                                       /* Hack -- Track this monster race */
-                                       if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
-
-                                       /* Hack -- Track this monster */
-                                       if (m_ptr->ml) health_track(c_ptr->m_idx);
+                                       if (m_ptr->ml)
+                                       {
+                                               if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
+                                               health_track(g_ptr->m_idx);
+                                       }
                                }
 
                                /* Hack -- Base damage from thrown object */
-                               tdam = damroll(q_ptr->dd, q_ptr->ds);
-                               /* Apply special damage XXX XXX XXX */
+                               dd = q_ptr->dd;
+                               ds = q_ptr->ds;
+                               torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
+                               tdam = damroll(dd, ds);
+                               /* Apply special damage */
                                tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE);
-                               tdam = critical_shot(q_ptr->weight, q_ptr->to_h, tdam);
+                               tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam);
                                if (q_ptr->to_d > 0)
                                        tdam += q_ptr->to_d;
                                else
@@ -4218,21 +2663,11 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                                /* Modify the damage */
                                tdam = mon_damage_mod(m_ptr, tdam, FALSE);
 
-                               /* Complex message */
-                               if (p_ptr->wizard)
-                               {
-#ifdef JP
-                                       msg_format("%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£",
-                                                  tdam, m_ptr->hp);
-#else
-                                       msg_format("You do %d (out of %d) damage.",
-                                                  tdam, m_ptr->hp);
-#endif
-
-                               }
+                               msg_format_wizard(CHEAT_MONSTER, _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
+                                       tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
 
                                /* Hit the monster, check for death */
-                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
+                               if (mon_take_hit(g_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
                                {
                                        /* Dead monster */
                                }
@@ -4240,31 +2675,18 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                                /* No death */
                                else
                                {
-                                       /* Message */
-                                       message_pain(c_ptr->m_idx, tdam);
+                                       message_pain(g_ptr->m_idx, tdam);
 
                                        /* Anger the monster */
                                        if ((tdam > 0) && !object_is_potion(q_ptr))
                                                anger_monster(m_ptr);
 
-                                       /* Take note */
                                        if (fear && m_ptr->ml)
                                        {
-                                               char m_name[80];
-
-                                               /* Sound */
                                                sound(SOUND_FLEE);
-
-                                               /* Get the monster name (or "it") */
+                                               GAME_TEXT m_name[MAX_NLEN];
                                                monster_desc(m_name, m_ptr, 0);
-
-                                               /* Message */
-#ifdef JP
-                                               msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
-#else
-                                               msg_format("%^s flees in terror!", m_name);
-#endif
-
+                                               msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
                                        }
                                }
                        }
@@ -4274,28 +2696,21 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                }
        }
 
+       /* decrease toach's fuel */
+       if (hit_body) torch_lost_fuel(q_ptr);
+
        /* Chance of breakage (during attacks) */
-       j = (hit_body ? breakage_chance(q_ptr) : 0);
+       j = (hit_body ? breakage_chance(q_ptr, 0) : 0);
 
        /* Figurines transform */
        if ((q_ptr->tval == TV_FIGURINE) && !(p_ptr->inside_arena))
        {
                j = 100;
 
-               if (!(summon_named_creature(0, y, x, q_ptr->pval,
-                                           !(object_is_cursed(q_ptr)) ? PM_FORCE_PET : 0L)))
-#ifdef JP
-msg_print("¿Í·Á¤ÏDZ¤¸¶Ê¤¬¤êºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
-                       msg_print("The Figurine writhes and then shatters.");
-#endif
-
+               if (!(summon_named_creature(0, y, x, q_ptr->pval, !(object_is_cursed(q_ptr)) ? PM_FORCE_PET : 0L)))
+                       msg_print(_("人形は捻じ曲がり砕け散ってしまった!", "The Figurine writhes and then shatters."));
                else if (object_is_cursed(q_ptr))
-#ifdef JP
-msg_print("¤³¤ì¤Ï¤¢¤Þ¤êÎɤ¯¤Ê¤¤µ¤¤¬¤¹¤ë¡£");
-#else
-                       msg_print("You have a bad feeling about this.");
-#endif
+                       msg_print(_("これはあまり良くない気がする。", "You have a bad feeling about this."));
 
        }
 
@@ -4305,32 +2720,21 @@ msg_print("
        {
                if (hit_body || hit_wall || (randint1(100) < j))
                {
-                       /* Message */
-#ifdef JP
-                       msg_format("%s¤ÏºÕ¤±»¶¤Ã¤¿¡ª", o_name);
-#else
-                       msg_format("The %s shatters!", o_name);
-#endif
-
+                       msg_format(_("%sは砕け散った!", "The %s shatters!"), o_name);
 
                        if (potion_smash_effect(0, y, x, q_ptr->k_idx))
                        {
-                               monster_type *m_ptr = &m_list[cave[y][x].m_idx];
+                               monster_type *m_ptr = &current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
 
                                /* ToDo (Robert): fix the invulnerability */
-                               if (cave[y][x].m_idx &&
-                                   is_friendly(&m_list[cave[y][x].m_idx]) &&
+                               if (current_floor_ptr->grid_array[y][x].m_idx &&
+                                   is_friendly(&current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]) &&
                                    !MON_INVULNER(m_ptr))
                                {
-                                       char m_name[80];
-                                       monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
-#ifdef JP
-                                       msg_format("%s¤ÏÅܤä¿¡ª", m_name);
-#else
-                                       msg_format("%^s gets angry!", m_name);
-#endif
-
-                                       set_hostile(&m_list[cave[y][x].m_idx]);
+                                       GAME_TEXT m_name[MAX_NLEN];
+                                       monster_desc(m_name, &current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
+                                       msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
+                                       set_hostile(&current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]);
                                }
                        }
                        do_drop = FALSE;
@@ -4377,42 +2781,26 @@ msg_print("
                        }
                        if((back_chance > 37) && !p_ptr->blind && (item >= 0))
                        {
-#ifdef JP
-                               msg_format("%s¤¬¼ê¸µ¤ËÊ֤äƤ­¤¿¡£", o2_name);
-#else
-                               msg_format("%s comes back to you.", o2_name);
-#endif
+                               msg_format(_("%sが手元に返ってきた。", "%s comes back to you."), o2_name);
                                come_back = TRUE;
                        }
                        else
                        {
                                if (item >= 0)
                                {
-#ifdef JP
-                                       msg_format("%s¤ò¼õ¤±Â»¤Í¤¿¡ª", o2_name);
-#else
-                                       msg_format("%s backs, but you can't catch!", o2_name);
-#endif
+                                       msg_format(_("%sを受け損ねた!", "%s backs, but you can't catch!"), o2_name);
                                }
                                else
                                {
-#ifdef JP
-                                       msg_format("%s¤¬Ê֤äƤ­¤¿¡£", o2_name);
-#else
-                                       msg_format("%s comes back.", o2_name);
-#endif
+                                       msg_format(_("%sが返ってきた。", "%s comes back."), o2_name);
                                }
-                               y = py;
-                               x = px;
+                               y = p_ptr->y;
+                               x = p_ptr->x;
                        }
                }
                else
                {
-#ifdef JP
-                       msg_format("%s¤¬Ê֤äƤ³¤Ê¤«¤Ã¤¿¡ª", o2_name);
-#else
-                       msg_format("%s doesn't back!", o2_name);
-#endif
+                       msg_format(_("%sが返ってこなかった!", "%s doesn't back!"), o2_name);
                }
        }
 
@@ -4426,22 +2814,12 @@ msg_print("
                        /* Wear the new stuff */
                        object_copy(o_ptr, q_ptr);
 
-                       /* Increase the weight */
                        p_ptr->total_weight += q_ptr->weight;
 
                        /* Increment the equip counter by hand */
                        equip_cnt++;
 
-                       /* Recalculate bonuses */
-                       p_ptr->update |= (PU_BONUS);
-
-                       /* Recalculate torch */
-                       p_ptr->update |= (PU_TORCH);
-
-                       /* Recalculate mana XXX */
-                       p_ptr->update |= (PU_MANA);
-
-                       /* Window stuff */
+                       p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
                        p_ptr->window |= (PW_EQUIP);
                }
                else
@@ -4456,17 +2834,14 @@ msg_print("
                calc_android_exp();
        }
 
-       /* Drop (or break) near that location */
        if (do_drop)
        {
                if (cave_have_flag_bold(y, x, FF_PROJECT))
                {
-                       /* Drop (or break) near that location */
                        (void)drop_near(q_ptr, j, y, x);
                }
                else
                {
-                       /* Drop (or break) near that location */
                        (void)drop_near(q_ptr, j, prev_y, prev_x);
                }
        }
@@ -4474,11 +2849,82 @@ msg_print("
        return TRUE;
 }
 
-
-/*
- * Throw an object from the pack or floor.
+/*!
+ * @brief 自殺するコマンドのメインルーチン
+ * Hack -- commit suicide
+ * @return なし
+ * @details
  */
-void do_cmd_throw(void)
+void do_cmd_suicide(void)
 {
-       do_cmd_throw_aux(1, FALSE, 0);
+       int i;
+
+       /* Flush input */
+       flush();
+
+       /* Verify Retirement */
+       if (p_ptr->total_winner)
+       {
+               /* Verify */
+               if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
+       }
+
+       /* Verify Suicide */
+       else
+       {
+               /* Verify */
+               if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return;
+       }
+
+
+       if (!p_ptr->noscore)
+       {
+               /* Special Verification for suicide */
+               prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
+
+               flush();
+               i = inkey();
+               prt("", 0, 0);
+               if (i != '@') return;
+
+               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
+       }
+
+       /* Initialize "last message" buffer */
+       if (p_ptr->last_message) string_free(p_ptr->last_message);
+       p_ptr->last_message = NULL;
+
+       /* Hack -- Note *winning* message */
+       if (p_ptr->total_winner && last_words)
+       {
+               char buf[1024] = "";
+               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
+               do
+               {
+                       while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf));
+               } while (!get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
+
+               if (buf[0])
+               {
+                       p_ptr->last_message = string_make(buf);
+                       msg_print(p_ptr->last_message);
+               }
+       }
+
+       /* Stop playing */
+       p_ptr->playing = FALSE;
+
+       /* Kill the player */
+       p_ptr->is_dead = TRUE;
+       p_ptr->leaving = TRUE;
+
+       if (!p_ptr->total_winner)
+       {
+               do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ダンジョンの探索に絶望して自殺した。", "give up all hope to commit suicide."));
+               do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
+               do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
+       }
+
+       /* Cause of death */
+       (void)strcpy(p_ptr->died_from, _("途中終了", "Quitting"));
 }