OSDN Git Service

Fix select_floor_music().
[hengband/hengband.git] / src / cmd1.c
index ae05fa4..4e26bbe 100644 (file)
-/* File: cmd1.c */
-
-/*
+/*!
+ *  @file cmd1.c
+ *  @brief ¥×¥ì¥¤¥ä¡¼¤Î¥³¥Þ¥ó¥É½èÍý1 / Movement commands (part 1)
+ *  @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,
  * and not for profit purposes provided that this copyright and statement
  * are included in all such copies.  Other copyrights may also apply.
+ * @note
+ * <pre>
+ * The running algorithm:                       -CJS-
+ *
+ * In the diagrams below, the player has just arrived in the
+ * grid marked as '@', and he has just come from a grid marked
+ * as 'o', and he is about to enter the grid marked as 'x'.
+ *
+ * Of course, if the "requested" move was impossible, then you
+ * will of course be blocked, and will stop.
+ *
+ * Overview: You keep moving until something interesting happens.
+ * If you are in an enclosed space, you follow corners. This is
+ * the usual corridor scheme. If you are in an open space, you go
+ * straight, but stop before entering enclosed space. This is
+ * analogous to reaching doorways. If you have enclosed space on
+ * one side only (that is, running along side a wall) stop if
+ * your wall opens out, or your open space closes in. Either case
+ * corresponds to a doorway.
+ *
+ * What happens depends on what you can really SEE. (i.e. if you
+ * have no light, then running along a dark corridor is JUST like
+ * running in a dark room.) The algorithm works equally well in
+ * corridors, rooms, mine tailings, earthquake rubble, etc, etc.
+ *
+ * These conditions are kept in static memory:
+ * find_openarea         You are in the open on at least one
+ * side.
+ * find_breakleft        You have a wall on the left, and will
+ * stop if it opens
+ * find_breakright       You have a wall on the right, and will
+ * stop if it opens
+ *
+ * To initialize these conditions, we examine the grids adjacent
+ * to the grid marked 'x', two on each side (marked 'L' and 'R').
+ * If either one of the two grids on a given side is seen to be
+ * closed, then that side is considered to be closed. If both
+ * sides are closed, then it is an enclosed (corridor) run.
+ *
+ * LL           L
+ * @@x          LxR
+ * RR          @@R
+ *
+ * Looking at more than just the immediate squares is
+ * significant. Consider the following case. A run along the
+ * corridor will stop just before entering the center point,
+ * because a choice is clearly established. Running in any of
+ * three available directions will be defined as a corridor run.
+ * Note that a minor hack is inserted to make the angled corridor
+ * entry (with one side blocked near and the other side blocked
+ * further away from the runner) work correctly. The runner moves
+ * diagonally, but then saves the previous direction as being
+ * straight into the gap. Otherwise, the tail end of the other
+ * entry would be perceived as an alternative on the next move.
+ *
+ * \#.\#
+ * \#\#.\#\#
+ * \.\@x..
+ * \#\#.\#\#
+ * \#.\#
+ *
+ * Likewise, a run along a wall, and then into a doorway (two
+ * runs) will work correctly. A single run rightwards from \@ will
+ * stop at 1. Another run right and down will enter the corridor
+ * and make the corner, stopping at the 2.
+ *
+ * \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+ * o@@x       1
+ * \#\#\#\#\#\#\#\#\#\#\# \#\#\#\#\#\#
+ * \#2          \#
+ * \#\#\#\#\#\#\#\#\#\#\#\#\#
+ *
+ * After any move, the function area_affect is called to
+ * determine the new surroundings, and the direction of
+ * subsequent moves. It examines the current player location
+ * (at which the runner has just arrived) and the previous
+ * direction (from which the runner is considered to have come).
+ *
+ * Moving one square in some direction places you adjacent to
+ * three or five new squares (for straight and diagonal moves
+ * respectively) to which you were not previously adjacent,
+ * marked as '!' in the diagrams below.
+ *
+ *   ...!              ...
+ *   .o@@!  (normal)    .o.!  (diagonal)
+ *   ...!  (east)      ..@@!  (south east)
+ *                      !!!
+ *
+ * You STOP if any of the new squares are interesting in any way:
+ * for example, if they contain visible monsters or treasure.
+ *
+ * You STOP if any of the newly adjacent squares seem to be open,
+ * and you are also looking for a break on that side. (that is,
+ * find_openarea AND find_break).
+ *
+ * You STOP if any of the newly adjacent squares do NOT seem to be
+ * open and you are in an open area, and that side was previously
+ * entirely open.
+ *
+ * Corners: If you are not in the open (i.e. you are in a corridor)
+ * and there is only one way to go in the new squares, then turn in
+ * that direction. If there are more than two new ways to go, STOP.
+ * If there are two ways to go, and those ways are separated by a
+ * square which does not seem to be open, then STOP.
+ *
+ * Otherwise, we have a potential corner. There are two new open
+ * squares, which are also adjacent. One of the new squares is
+ * diagonally located, the other is straight on (as in the diagram).
+ * We consider two more squares further out (marked below as ?).
+ *
+ * We assign "option" to the straight-on grid, and "option2" to the
+ * diagonal grid, and "check_dir" to the grid marked 's'.
+ *
+ * \#\#s
+ * @@x?
+ * \#.?
+ *
+ * If they are both seen to be closed, then it is seen that no benefit
+ * is gained from moving straight. It is a known corner.  To cut the
+ * corner, go diagonally, otherwise go straight, but pretend you
+ * stepped diagonally into that next location for a full view next
+ * time. Conversely, if one of the ? squares is not seen to be closed,
+ * then there is a potential choice. We check to see whether it is a
+ * potential corner or an intersection/room entrance.  If the square
+ * two spaces straight ahead, and the space marked with 's' are both
+ * unknown space, then it is a potential corner and enter if
+ * find_examine is set, otherwise must stop because it is not a
+ * corner. (find_examine option is removed and always is TRUE.)
+ * </pre>
  */
 
-/* Purpose: Movement commands (part 1) */
 
 #include "angband.h"
-#define MAX_VAMPIRIC_DRAIN 50
+#define MAX_VAMPIRIC_DRAIN 50 /*!< µÛ·ì½èÍý¤ÎºÇÂç²óÉüHP */
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤Î¼Í·âÌ¿ÃæȽÄê /
  * Determine if the player "hits" a monster (normal combat).
- * Note -- Always miss 5%, always hit 5%, otherwise random.
+ * @param chance ´ðËÜÌ¿ÃæÃÍ
+ * @param m_ptr ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param vis ÌÜɸ¤ò»ë³¦¤ËÊá¤é¤¨¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE¤ò»ØÄê
+ * @param o_name ¥á¥Ã¥»¡¼¥¸É½¼¨»þ¤Î¥â¥ó¥¹¥¿¡¼Ì¾
+ * @return Ì¿Ãæ¤ÈȽÄꤵ¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
+ * @note Always miss 5%, always hit 5%, otherwise random.
  */
-bool test_hit_fire(int chance, int ac, int vis)
+bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
 {
-       int k;
+       int k, ac;
+       monster_race *r_ptr = &r_info[m_ptr->r_idx];
+       
+       ac = r_ptr->ac;
+       if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
 
        /* Percentile dice */
        k = randint0(100);
-
+       
+       /* Snipers with high-concentration reduce instant miss percentage.*/
+       k += p_ptr->concent;
+       
        /* Hack -- Instant miss or hit */
        if (k < 10) return (k < 5);
 
@@ -38,7 +181,18 @@ bool test_hit_fire(int chance, int ac, int vis)
        if (!vis) chance = (chance + 1) / 2;
 
        /* Power competes against armor */
-       if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
+       if (randint0(chance) < (ac * 3 / 4))
+       {
+               if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
+               {
+                       char m_name[80];
+                       
+                       /* Extract monster name */
+                       monster_desc(m_name, m_ptr, 0);
+                       msg_format(_("%s¤Ï%s¤ò»Â¤ê¼Î¤Æ¤¿¡ª", "%s cuts down %s!"), m_name, o_name);
+               }
+               return (FALSE);
+       }
 
        /* Assume hit */
        return (TRUE);
@@ -46,10 +200,14 @@ bool test_hit_fire(int chance, int ac, int vis)
 
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤ÎÂÇ·âÌ¿ÃæȽÄê /
  * Determine if the player "hits" a monster (normal combat).
- *
- * Note -- Always miss 5%, always hit 5%, otherwise random.
+ * @param chance ´ðËÜÌ¿ÃæÃÍ
+ * @param ac ¥â¥ó¥¹¥¿¡¼¤ÎAC
+ * @param vis ÌÜɸ¤ò»ë³¦¤ËÊá¤é¤¨¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE¤ò»ØÄê
+ * @return Ì¿Ãæ¤ÈȽÄꤵ¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹
+ * @note Always miss 5%, always hit 5%, otherwise random.
  */
 bool test_hit_norm(int chance, int ac, int vis)
 {
@@ -79,23 +237,38 @@ bool test_hit_norm(int chance, int ac, int vis)
 
 
 
-/*
- * Critical hits (from objects thrown by player)
- * Factor in item weight, total plusses, and player level.
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤Î¼Í·â¥¯¥ê¥Æ¥£¥«¥ëȽÄê /
+ * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level.
+ * @param weight ÌðÃƤνÅÎÌ
+ * @param plus_ammo ÌðÃƤÎÌ¿Ã潤Àµ
+ * @param plus_bow µÝ¤ÎÌ¿Ã潤Àµ
+ * @param dam ¸½ºß»»½ÐÃæ¤Î¥À¥á¡¼¥¸ÃÍ
+ * @return ¥¯¥ê¥Æ¥£¥«¥ë½¤Àµ¤¬Æþ¤Ã¤¿¥À¥á¡¼¥¸ÃÍ
  */
-s16b critical_shot(int weight, int plus, int dam)
+s16b critical_shot(int weight, int plus_ammo, int plus_bow, int dam)
 {
        int i, k;
-
+       object_type *j_ptr =  &inventory[INVEN_BOW];
+       
        /* Extract "shot" power */
-       i = ((p_ptr->to_h_b + plus) * 4) + (p_ptr->lev * 2);
+       i = p_ptr->to_h_b + plus_ammo;
+       
+       if (p_ptr->tval_ammo == TV_BOLT)
+               i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
+       else
+               i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
 
+       
        /* Snipers can shot more critically with crossbows */
        if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
        if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
-
+       
+       /* Good bow makes more critical */
+       i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
+       
        /* Critical hit */
-       if (randint1(5000) <= i)
+       if (randint1(10000) <= i)
        {
                k = weight * randint1(500);
 
@@ -136,17 +309,22 @@ s16b critical_shot(int weight, int plus, int dam)
 
 
 
-/*
- * Critical hits (by player)
- *
- * Factor in weapon weight, total plusses, player level.
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤«¤é¥â¥ó¥¹¥¿¡¼¤Ø¤ÎÂǷ⥯¥ê¥Æ¥£¥«¥ëȽÄê /
+ * Critical hits (by player) Factor in weapon weight, total plusses, player melee bonus
+ * @param weight ÌðÃƤνÅÎÌ
+ * @param plus Éð´ï¤ÎÌ¿Ã潤Àµ
+ * @param dam ¸½ºß»»½ÐÃæ¤Î¥À¥á¡¼¥¸ÃÍ
+ * @param meichuu ÂÇ·â¤Î´ðËÜÌ¿ÃæÎÏ
+ * @param mode ¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
+ * @return ¥¯¥ê¥Æ¥£¥«¥ë½¤Àµ¤¬Æþ¤Ã¤¿¥À¥á¡¼¥¸ÃÍ
  */
 s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
 {
        int i, k;
-
+       
        /* Extract "blow" power */
-       i = (weight + (meichuu * 3 + plus * 5) + (p_ptr->lev * 3));
+       i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
 
        /* Chance */
        if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
@@ -211,6 +389,13 @@ s16b critical_norm(int weight, int plus, int dam, s16b meichuu, int mode)
 
 
 
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¹¶·â¤Î¼ï²¥¹¥ì¥¤¥ó¥°ÇÜΨ·×»»
+ * @param mult »»½ÐÁ°¤Î´ðËÜÇÜΨ(/10ÇÜ)
+ * @param flgs ¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
+ * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¥¹¥ì¥¤¥ó¥°²ÃÌ£¸å¤ÎÇÜΨ(/10ÇÜ)
+ */
 static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
 {
        static const struct slay_table_t {
@@ -251,11 +436,11 @@ static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
                const struct slay_table_t* p = &slay_table[i];
 
                if ((have_flag(flgs, p->slay_flag)) &&
-                   (*(u32b*)(((char*)r_ptr) + p->flag_offset) & p->affect_race_flag))
+                   (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag))
                {
                        if (is_original_ap_and_seen(m_ptr))
                        {
-                               *(u32b*)(((char*)r_ptr) + p->r_flag_offset) |= p->affect_race_flag;
+                               atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
                        }
 
                        mult = MAX(mult, p->slay_mult);
@@ -265,6 +450,13 @@ static int mult_slaying(int mult, const u32b* flgs, const monster_type* m_ptr)
        return mult;
 }
 
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¹¶·â¤Î°À­¥¹¥ì¥¤¥ó¥°ÇÜΨ·×»»
+ * @param mult »»½ÐÁ°¤Î´ðËÜÇÜΨ(/10ÇÜ)
+ * @param flgs ¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
+ * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¥¹¥ì¥¤¥ó¥°²ÃÌ£¸å¤ÎÇÜΨ(/10ÇÜ)
+ */
 static int mult_brand(int mult, const u32b* flgs, const monster_type* m_ptr)
 {
        static const struct brand_table_t {
@@ -315,14 +507,22 @@ static int mult_brand(int mult, const u32b* flgs, const monster_type* m_ptr)
 
        return mult;
 }
-/*
+
+/*!
+ * @brief ¥À¥á¡¼¥¸¤Ë¥¹¥ì¥¤Í×ÁǤò²Ã¤¨¤ëÁí¹ç½èÍý¥ë¡¼¥Á¥ó /
  * Extract the "total damage" from a given object hitting a given monster.
- *
- * Note that "flasks of oil" do NOT do fire damage, although they
- * certainly could be made to do so.  XXX XXX
- *
- * Note that most brands and slays are x3, except Slay Animal (x2),
- * Slay Evil (x2), and Kill dragon (x5).
+ * @param o_ptr »ÈÍÑÉð´ï¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param tdam ¸½ºß»»½ÐÅÓÃæ¤Î¥À¥á¡¼¥¸ÃÍ
+ * @param m_ptr ÌÜɸ¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param mode ·õ½Ñ¤ÎID
+ * @param thrown ¼Í·â½èÍý¤Ê¤é¤ÐTRUE¤ò»ØÄꤹ¤ë
+ * @return Áí¹çŪ¤Ê¥¹¥ì¥¤¤ò²ÃÌ£¤·¤¿¥À¥á¡¼¥¸ÃÍ
+ * @note
+ * Note that "flasks of oil" do NOT do fire damage, although they\n
+ * certainly could be made to do so.  XXX XXX\n
+ *\n
+ * Note that most brands and slays are x3, except Slay Animal (x2),\n
+ * Slay Evil (x2), and Kill dragon (x5).\n
  */
 s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown)
 {
@@ -392,8 +592,12 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bo
 }
 
 
-/*
+/*!
+ * @brief ÃÏ·Á¤ä¤½¤Î¾å¤Î¥¢¥¤¥Æ¥à¤Î±£¤µ¤ì¤¿Í×ÁǤòÌÀ¤«¤¹ /
  * Search for hidden things
+ * @param y ÂоݤȤʤë¥Þ¥¹¤ÎYºÂɸ
+ * @param x ÂоݤȤʤë¥Þ¥¹¤ÎXºÂɸ
+ * @return ¤Ê¤·
  */
 static void discover_hidden_things(int y, int x)
 {
@@ -462,6 +666,10 @@ static void discover_hidden_things(int y, int x)
        }
 }
 
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Îõº÷½èÍýȽÄê
+ * @return ¤Ê¤·
+ */
 void search(void)
 {
        int i, chance;
@@ -485,25 +693,25 @@ void search(void)
 }
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥ª¥Ö¥¸¥§¥¯¥È¤ò½¦¤Ã¤¿ºÝ¤Î¥á¥Ã¥»¡¼¥¸É½¼¨½èÍý /
  * Helper routine for py_pickup() and py_pickup_floor().
- *
- * Add the given dungeon object to the character's inventory.
- *
- * Delete the object afterwards.
+ * @param o_idx ¼èÆÀ¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾ÈID
+ * @return ¤Ê¤·
+ * @details
+ * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥­¤ò»ý¤Ã¤Æ¤¤¤ë¡×\n
+ * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë\n
+ * ¤À¤¬¡¢°ãÏ´¶¤¬\n
+ * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨\n
+ * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£\n
+ * Add the given dungeon object to the character's inventory.\n
+ * Delete the object afterwards.\n
  */
 void py_pickup_aux(int o_idx)
 {
-       int slot, i;
+       int slot;
 
 #ifdef JP
-/*
- * ¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿ºÝ¤Ë¡Ö£²¤Ä¤Î¥±¡¼¥­¤ò»ý¤Ã¤Æ¤¤¤ë¡×
- * "You have two cakes." ¤È¥¢¥¤¥Æ¥à¤ò½¦¤Ã¤¿¸å¤Î¹ç·×¤Î¤ß¤Îɽ¼¨¤¬¥ª¥ê¥¸¥Ê¥ë
- * ¤À¤¬¡¢°ãÏ´¶¤¬
- * ¤¢¤ë¤È¤¤¤¦»ØŦ¤ò¤¦¤±¤¿¤Î¤Ç¡¢¡Ö¡Á¤ò½¦¤Ã¤¿¡¢¡Á¤ò»ý¤Ã¤Æ¤¤¤ë¡×¤È¤¤¤¦É½¼¨
- * ¤Ë¤«¤¨¤Æ¤¢¤ë¡£¤½¤Î¤¿¤á¤ÎÇÛÎó¡£
- */
        char o_name[MAX_NLEN];
        char old_name[MAX_NLEN];
        char kazu_str[80];
@@ -581,7 +789,11 @@ void py_pickup_aux(int o_idx)
 }
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥ª¥Ö¥¸¥§¥¯¥È¾å¤Ë¾è¤Ã¤¿ºÝ¤Îɽ¼¨½èÍý
+ * @param pickup ¼«Æ°½¦¤¤½èÍý¤ò¹Ô¤¦¤Ê¤é¤ÐTRUE¤È¤¹¤ë
+ * @return ¤Ê¤·
+ * @details
  * Player "wants" to pick up an object or gold.
  * Note that we ONLY handle things that can be picked up.
  * See "move_player()" for handling of other things.
@@ -742,8 +954,12 @@ void carry(bool pickup)
 }
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Ø¤Î¥È¥é¥Ã¥×Ì¿ÃæȽÄê /
  * Determine if a trap affects the player.
+ * @param power ´ðËܲóÈòÆñÅÙ
+ * @return ¥È¥é¥Ã¥×¤¬Ì¿Ã椷¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
+ * @details
  * Always miss 5% of the time, Always hit 5% of the time.
  * Otherwise, match trap power against player armor.
  */
@@ -774,9 +990,143 @@ static int check_hit(int power)
 }
 
 
+/*!
+ * @brief Íî¤È¤··ê·Ï¥È¥é¥Ã¥×¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @param trap_feat_type ¥È¥é¥Ã¥×¤Î¼ïÊÌID
+ * @return ¤Ê¤·
+ */
+static void hit_trap_pit(int trap_feat_type)
+{
+       int dam;
+       cptr trap_name = "";
+       cptr spike_name = "";
 
-/*
+       switch (trap_feat_type)
+       {
+       case TRAP_PIT:
+               trap_name = _("Íî¤È¤··ê", "a pit trap");
+               break;
+       case TRAP_SPIKED_PIT:
+               trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
+               spike_name = _("¥¹¥Ñ¥¤¥¯", "spikes");
+               break;
+       case TRAP_POISON_PIT:
+               trap_name = _("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê", "a spiked pit");
+               spike_name = _("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯", "poisonous spikes");
+               break;
+       default:
+               return;
+       }
+
+       if (p_ptr->levitation)
+       {
+               msg_format(_("%s¤òÈô¤Ó±Û¤¨¤¿¡£", "You fly over %s."), trap_name);
+               return;
+       }
+
+       msg_format(_("%s¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", "You have fallen into %s!"), trap_name);
+
+       /* Base damage */
+       dam = damroll(2, 6);
+
+       /* Extra spike damage */
+       if ((trap_feat_type == TRAP_SPIKED_PIT || trap_feat_type == TRAP_POISON_PIT) &&
+           one_in_(2))
+       {
+               msg_format(_("%s¤¬»É¤µ¤Ã¤¿¡ª", "You are impaled on %s!"), spike_name);
+
+               dam = dam * 2;
+               (void)set_cut(p_ptr->cut + randint1(dam));
+
+               if (trap_feat_type == TRAP_POISON_PIT) {
+                       if (p_ptr->resist_pois || IS_OPPOSE_POIS())
+                       {
+                               msg_print(_("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª", "The poison does not affect you!"));
+                       }
+                       else
+                       {
+                               dam = dam * 2;
+                               (void)set_poisoned(p_ptr->poisoned + randint1(dam));
+                       }
+               }
+       }
+
+       /* Take the damage */
+       take_hit(DAMAGE_NOESCAPE, dam, trap_name, -1);
+}
+
+/*!
+ * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @return ¥À¡¼¥Ä¤¬Ì¿Ã椷¤¿¾ì¹çTRUE¤òÊÖ¤¹
+ */
+static bool hit_trap_dart(void)
+{
+       bool hit = FALSE;
+
+       if (check_hit(125))
+       {
+               msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª", "A small dart hits you!"));
+
+               take_hit(DAMAGE_ATTACK, damroll(1, 4), _("¥À¡¼¥Ä¤Îæ«", "a dart trap"), -1);
+
+               if (!CHECK_MULTISHADOW()) hit = TRUE;
+       }
+       else
+       {
+               msg_print(_("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£", "A small dart barely misses you."));
+       }
+
+       return hit;
+}
+
+/*!
+ * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡ÜǽÎÏÃ͸º¾¯¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @param stat Äã²¼¤¹¤ëǽÎÏÃÍID
+ * @return ¤Ê¤·
+ */
+static void hit_trap_lose_stat(int stat)
+{
+       if (hit_trap_dart())
+       {
+               do_dec_stat(stat);
+       }
+}
+
+/*!
+ * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ü¸ºÂ®¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @return ¤Ê¤·
+ */
+static void hit_trap_slow(void)
+{
+       if (hit_trap_dart())
+       {
+               set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
+       }
+}
+
+/*!
+ * @brief ¥À¡¼¥Ä·Ï¥È¥é¥Ã¥×¡ÊÄ̾ï¥À¥á¡¼¥¸¡Ü¾õÂÖ°Û¾ï¡Ë¤ÎȽÄê¤È¥×¥ì¥¤¥ä¡¼¤ÎÈï³²½èÍý
+ * @param trap_message ¥á¥Ã¥»¡¼¥¸¤ÎÊ䴰ʸ»úÎó
+ * @param resist ¾õÂÖ°Û¾ï¤ËÄñ¹³¤¹¤ëȽÄ꤬½Ð¤¿¤Ê¤éTRUE
+ * @param set_status ¾õÂÖ°Û¾ï¤ò»ØÄꤹ¤ë´Ø¿ô¥Ý¥¤¥ó¥¿
+ * @param turn ¾õÂÖ°Û¾ï¤ÎÄɲå¿¡¼¥óÎÌ
+ * @return ¤Ê¤·
+ */
+static void hit_trap_set_abnormal_status(cptr trap_message, bool resist, bool (*set_status)(int turn), int turn)
+{
+       msg_print(trap_message);
+
+       if (!resist)
+       {
+               set_status(turn);
+       }
+}
+
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Ø¤Î¥È¥é¥Ã¥×ºîÆ°½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Handle player hitting a real trap
+ * @param break_trap ºîÆ°¸å¤Î¥È¥é¥Ã¥×Ç˲õ¤¬³ÎÄꤷ¤Æ¤¤¤ë¤Ê¤é¤ÐTRUE
+ * @return ¤Ê¤·
  */
 static void hit_trap(bool break_trap)
 {
@@ -851,162 +1201,10 @@ static void hit_trap(bool break_trap)
                }
 
                case TRAP_PIT:
-               {
-                       if (p_ptr->levitation)
-                       {
-#ifdef JP
-                               msg_print("Íî¤È¤··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
-#else
-                               msg_print("You fly over a pit trap.");
-#endif
-
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
-                               msg_print("You have fallen into a pit!");
-#endif
-
-                               dam = damroll(2, 6);
-#ifdef JP
-                               name = "Íî¤È¤··ê";
-#else
-                               name = "a pit trap";
-#endif
-
-                               take_hit(DAMAGE_NOESCAPE, dam, name, -1);
-                       }
-                       break;
-               }
-
                case TRAP_SPIKED_PIT:
-               {
-                       if (p_ptr->levitation)
-                       {
-#ifdef JP
-                               msg_print("¥È¥²¤Î¤¢¤ëÍî¤È¤··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
-#else
-                               msg_print("You fly over a spiked pit.");
-#endif
-
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
-                               msg_print("You fall into a spiked pit!");
-#endif
-
-
-                               /* Base damage */
-#ifdef JP
-                               name = "Íî¤È¤··ê";
-#else
-                               name = "a pit trap";
-#endif
-
-                               dam = damroll(2, 6);
-
-                               /* Extra spike damage */
-                               if (randint0(100) < 50)
-                               {
-#ifdef JP
-                                       msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
-#else
-                                       msg_print("You are impaled!");
-#endif
-
-
-#ifdef JP
-                                       name = "¥È¥²¤Î¤¢¤ëÍî¤È¤··ê";
-#else
-                                       name = "a spiked pit";
-#endif
-
-                                       dam = dam * 2;
-                                       (void)set_cut(p_ptr->cut + randint1(dam));
-                               }
-
-                               /* Take the damage */
-                               take_hit(DAMAGE_NOESCAPE, dam, name, -1);
-                       }
-                       break;
-               }
-
                case TRAP_POISON_PIT:
                {
-                       if (p_ptr->levitation)
-                       {
-#ifdef JP
-                               msg_print("¥È¥²¤Î¤¢¤ëÍî¤È¤··ê¤òÈô¤Ó±Û¤¨¤¿¡£");
-#else
-                               msg_print("You fly over a spiked pit.");
-#endif
-
-                       }
-                       else
-                       {
-#ifdef JP
-                       msg_print("¥¹¥Ñ¥¤¥¯¤¬Éߤ«¤ì¤¿Íî¤È¤··ê¤ËÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª");
-#else
-                               msg_print("You fall into a spiked pit!");
-#endif
-
-
-                               /* Base damage */
-                               dam = damroll(2, 6);
-
-#ifdef JP
-                               name = "Íî¤È¤··ê";
-#else
-                               name = "a pit trap";
-#endif
-
-
-                               /* Extra spike damage */
-                               if (randint0(100) < 50)
-                               {
-#ifdef JP
-                                       msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
-#else
-                                       msg_print("You are impaled on poisonous spikes!");
-#endif
-
-
-#ifdef JP
-                                       name = "¥È¥²¤Î¤¢¤ëÍî¤È¤··ê";
-#else
-                                       name = "a spiked pit";
-#endif
-
-
-                                       dam = dam * 2;
-                                       (void)set_cut(p_ptr->cut + randint1(dam));
-
-                                       if (p_ptr->resist_pois || IS_OPPOSE_POIS())
-                                       {
-#ifdef JP
-                                               msg_print("¤·¤«¤·ÆǤαƶÁ¤Ï¤Ê¤«¤Ã¤¿¡ª");
-#else
-                                               msg_print("The poison does not affect you!");
-#endif
-
-                                       }
-
-                                       else
-                                       {
-                                               dam = dam * 2;
-                                               (void)set_poisoned(p_ptr->poisoned + randint1(dam));
-                                       }
-                               }
-
-                               /* Take the damage */
-                               take_hit(DAMAGE_NOESCAPE, dam, name, -1);
-                       }
-
+                       hit_trap_pit(trap_feat_type);
                        break;
                }
 
@@ -1038,220 +1236,102 @@ static void hit_trap(bool break_trap)
                        break;
                }
 
-               case TRAP_TELEPORT:
-               {
-#ifdef JP
-                       msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª");
-#else
-                       msg_print("You hit a teleport trap!");
-#endif
-
-                       teleport_player(100, TELEPORT_PASSIVE);
-                       break;
-               }
-
-               case TRAP_FIRE:
-               {
-#ifdef JP
-                       msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
-#else
-                       msg_print("You are enveloped in flames!");
-#endif
-
-                       dam = damroll(4, 6);
-#ifdef JP
-                       (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
-#else
-                       (void)fire_dam(dam, "a fire trap", -1);
-#endif
-
-                       break;
-               }
-
-               case TRAP_ACID:
-               {
-#ifdef JP
-                       msg_print("»À¤¬¿á¤­¤«¤±¤é¤ì¤¿¡ª");
-#else
-                       msg_print("You are splashed with acid!");
-#endif
-
-                       dam = damroll(4, 6);
-#ifdef JP
-                       (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
-#else
-                       (void)acid_dam(dam, "an acid trap", -1);
-#endif
-
-                       break;
-               }
-
-               case TRAP_SLOW:
-               {
-                       if (check_hit(125))
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
-                               msg_print("A small dart hits you!");
-#endif
-
-                               dam = damroll(1, 4);
-#ifdef JP
-                               take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
-                               take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
-
-                               if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("A small dart barely misses you.");
-#endif
-
-                       }
-                       break;
-               }
-
-               case TRAP_LOSE_STR:
+               case TRAP_TELEPORT:
                {
-                       if (check_hit(125))
-                       {
 #ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª");
+                       msg_print("¥Æ¥ì¥Ý¡¼¥È¡¦¥È¥é¥Ã¥×¤Ë¤Ò¤Ã¤«¤«¤Ã¤¿¡ª");
 #else
-                               msg_print("A small dart hits you!");
+                       msg_print("You hit a teleport trap!");
 #endif
 
-                               dam = damroll(1, 4);
+                       teleport_player(100, TELEPORT_PASSIVE);
+                       break;
+               }
+
+               case TRAP_FIRE:
+               {
 #ifdef JP
-                               take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
+                       msg_print("±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
 #else
-                               take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
+                       msg_print("You are enveloped in flames!");
 #endif
 
-                               if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_STR);
-                       }
-                       else
-                       {
+                       dam = damroll(4, 6);
 #ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
+                       (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1, FALSE);
 #else
-                               msg_print("A small dart barely misses you.");
+                       (void)fire_dam(dam, "a fire trap", -1, FALSE);
 #endif
 
-                       }
                        break;
                }
 
-               case TRAP_LOSE_DEX:
+               case TRAP_ACID:
                {
-                       if (check_hit(125))
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
-                               msg_print("A small dart hits you!");
-#endif
-
-                               dam = damroll(1, 4);
 #ifdef JP
-                               take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
+                       msg_print("»À¤¬¿á¤­¤«¤±¤é¤ì¤¿¡ª");
 #else
-                               take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
+                       msg_print("You are splashed with acid!");
 #endif
 
-                               if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_DEX);
-                       }
-                       else
-                       {
+                       dam = damroll(4, 6);
 #ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
+                       (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1, FALSE);
 #else
-                               msg_print("A small dart barely misses you.");
+                       (void)acid_dam(dam, "an acid trap", -1, FALSE);
 #endif
 
-                       }
                        break;
                }
 
-               case TRAP_LOSE_CON:
+               case TRAP_SLOW:
                {
-                       if (check_hit(125))
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤Æ»É¤µ¤Ã¤¿¡ª");
-#else
-                               msg_print("A small dart hits you!");
-#endif
+                       hit_trap_slow();
+                       break;
+               }
 
-                               dam = damroll(1, 4);
-#ifdef JP
-                               take_hit(DAMAGE_ATTACK, dam, "¥À¡¼¥Ä¤Îæ«", -1);
-#else
-                               take_hit(DAMAGE_ATTACK, dam, "a dart trap", -1);
-#endif
+               case TRAP_LOSE_STR:
+               {
+                       hit_trap_lose_stat(A_STR);
+                       break;
+               }
 
-                               if (!CHECK_MULTISHADOW()) (void)do_dec_stat(A_CON);
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("A small dart barely misses you.");
-#endif
+               case TRAP_LOSE_DEX:
+               {
+                       hit_trap_lose_stat(A_DEX);
+                       break;
+               }
 
-                       }
+               case TRAP_LOSE_CON:
+               {
+                       hit_trap_lose_stat(A_CON);
                        break;
                }
 
                case TRAP_BLIND:
                {
-#ifdef JP
-                       msg_print("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
-                       msg_print("A black gas surrounds you!");
-#endif
-
-                       if (!p_ptr->resist_blind)
-                       {
-                               (void)set_blind(p_ptr->blind + randint0(50) + 25);
-                       }
+                       hit_trap_set_abnormal_status(
+                               _("¹õ¤¤¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A black gas surrounds you!"),
+                               p_ptr->resist_blind,
+                               set_blind, p_ptr->blind + randint0(50) + 25);
                        break;
                }
 
                case TRAP_CONFUSE:
                {
-#ifdef JP
-                       msg_print("¤­¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
-                       msg_print("A gas of scintillating colors surrounds you!");
-#endif
-
-                       if (!p_ptr->resist_conf)
-                       {
-                               (void)set_confused(p_ptr->confused + randint0(20) + 10);
-                       }
+                       hit_trap_set_abnormal_status(
+                               _("¤­¤é¤á¤¯¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A gas of scintillating colors surrounds you!"),
+                               p_ptr->resist_conf,
+                               set_confused, p_ptr->confused + randint0(20) + 10);
                        break;
                }
 
                case TRAP_POISON:
                {
-#ifdef JP
-                       msg_print("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
-#else
-                       msg_print("A pungent green gas surrounds you!");
-#endif
-
-                       if (!p_ptr->resist_pois && !IS_OPPOSE_POIS())
-                       {
-                               (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
-                       }
+                       hit_trap_set_abnormal_status(
+                               _("»É·ãŪ¤ÊÎп§¤Î¥¬¥¹¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª", "A pungent green gas surrounds you!"),
+                               p_ptr->resist_pois || IS_OPPOSE_POIS(),
+                               set_poisoned, p_ptr->poisoned + randint0(20) + 10);
                        break;
                }
 
@@ -1420,93 +1500,67 @@ msg_print("
 }
 
 
-static void touch_zap_player(monster_type *m_ptr)
+/*!
+ * @brief Å¨¥ª¡¼¥é¤Ë¤è¤ë¥×¥ì¥¤¥ä¡¼¤Î¥À¥á¡¼¥¸½èÍý¡ÊÊä½õ¡Ë
+ * @param m_ptr ¥ª¡¼¥é¤ò»ý¤Ä¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param immune ¥À¥á¡¼¥¸¤ò²óÈò¤Ç¤­¤ëÌȱ֥ե饰
+ * @param flags_offset ¥ª¡¼¥é¥Õ¥é¥°ÇÛÎó¤Î»²¾È¥ª¥Õ¥»¥Ã¥È
+ * @param r_flags_offset ¥â¥ó¥¹¥¿¡¼¤ÎÂÑÀ­ÇÛÎó¤Î»²¾È¥ª¥Õ¥»¥Ã¥È
+ * @param aura_flag ¥ª¡¼¥é¥Õ¥é¥°ÇÛÎó
+ * @param dam_func ¥À¥á¡¼¥¸½èÍý¤ò¹Ô¤¦´Ø¿ô¤Î»²¾È¥Ý¥¤¥ó¥¿
+ * @param message ¥ª¡¼¥é¥À¥á¡¼¥¸¤ò¼õ¤±¤¿ºÝ¤Î¥á¥Ã¥»¡¼¥¸
+ * @return ¤Ê¤·
+ */
+static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
+                                int (*dam_func)(int dam, cptr kb_str, int monspell, bool aura), cptr message)
 {
-       int aura_damage = 0;
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-       if (r_ptr->flags2 & RF2_AURA_FIRE)
+       if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune)
        {
-               if (!p_ptr->immune_fire)
-               {
-                       char aura_dam[80];
-
-                       aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
+               char mon_name[80];
+               int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
 
-                       /* Hack -- Get the "died from" name */
-                       monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
-#ifdef JP
-                       msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
-#else
-                       msg_print("You are suddenly very hot!");
-#endif
+               /* Hack -- Get the "died from" name */
+               monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
 
-                       if (prace_is_(RACE_ENT)) aura_damage += aura_damage / 3;
-                       if (IS_OPPOSE_FIRE()) aura_damage = (aura_damage + 2) / 3;
-                       if (p_ptr->resist_fire) aura_damage = (aura_damage + 2) / 3;
+               msg_print(message);
 
-                       take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
-                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_FIRE;
-                       handle_stuff();
-               }
-       }
+               dam_func(aura_damage, mon_name, -1, TRUE);
 
-       if (r_ptr->flags3 & RF3_AURA_COLD)
-       {
-               if (!p_ptr->immune_cold)
+               if (is_original_ap_and_seen(m_ptr))
                {
-                       char aura_dam[80];
-
-                       aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
-
-                       /* Hack -- Get the "died from" name */
-                       monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
-#ifdef JP
-                       msg_print("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª");
-#else
-                       msg_print("You are suddenly very cold!");
-#endif
-
-                       if (IS_OPPOSE_COLD()) aura_damage = (aura_damage + 2) / 3;
-                       if (p_ptr->resist_cold) aura_damage = (aura_damage + 2) / 3;
-
-                       take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
-                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_AURA_COLD;
-                       handle_stuff();
+                       atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag;
                }
-       }
-
-       if (r_ptr->flags2 & RF2_AURA_ELEC)
-       {
-               if (!p_ptr->immune_elec)
-               {
-                       char aura_dam[80];
-
-                       aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
-
-                       /* Hack -- Get the "died from" name */
-                       monster_desc(aura_dam, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
-                       if (prace_is_(RACE_ANDROID)) aura_damage += aura_damage / 3;
-                       if (IS_OPPOSE_ELEC()) aura_damage = (aura_damage + 2) / 3;
-                       if (p_ptr->resist_elec) aura_damage = (aura_damage + 2) / 3;
 
-#ifdef JP
-                       msg_print("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª");
-#else
-                       msg_print("You get zapped!");
-#endif
-
-                       take_hit(DAMAGE_NOESCAPE, aura_damage, aura_dam, -1);
-                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= RF2_AURA_ELEC;
-                       handle_stuff();
-               }
+               handle_stuff();
        }
 }
 
+/*!
+ * @brief Å¨¥ª¡¼¥é¤Ë¤è¤ë¥×¥ì¥¤¥ä¡¼¤Î¥À¥á¡¼¥¸½èÍý¡Ê¥á¥¤¥ó¡Ë
+ * @param m_ptr ¥ª¡¼¥é¤ò»ý¤Ä¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
+ */
+static void touch_zap_player(monster_type *m_ptr)
+{
+       touch_zap_player_aux(m_ptr, p_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
+                            fire_dam, _("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very hot!"));
+       touch_zap_player_aux(m_ptr, p_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
+                            cold_dam, _("ÆÍÁ³¤È¤Æ¤â´¨¤¯¤Ê¤Ã¤¿¡ª", "You are suddenly very cold!"));
+       touch_zap_player_aux(m_ptr, p_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
+                            elec_dam, _("ÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª", "You get zapped!"));
+}
+
 
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÊÑ°ÛÍ×ÁǤˤè¤ëÂÇ·â½èÍý
+ * @param m_idx ¹¶·âÌÜɸ¤È¤Ê¤Ã¤¿¥â¥ó¥¹¥¿¡¼¤Î»²¾ÈID
+ * @param attack ÊÑ°ÛÍ×ÁǤˤè¤ë¹¶·âÍ×ÁǤμïÎà
+ * @param fear ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @param mdeath ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
+ */
 static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
 {
        int             k, bonus, chance;
@@ -1676,10 +1730,17 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
 }
 
 
-
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÂÇ·â½èÍý¥µ¥Ö¥ë¡¼¥Á¥ó /
  * Player attacks a (poor, defenseless) creature        -RAK-
- *
+ * @param y ¹¶·âÌÜɸ¤ÎYºÂɸ
+ * @param x ¹¶·âÌÜɸ¤ÎXºÂɸ
+ * @param fear ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @param mdeath ¹¶·â¤ò¼õ¤±¤¿¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿¤«¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @param hand ¹¶·â¤ò¹Ô¤¦¤¿¤á¤ÎÉð´ï¤ò»ý¤Ä¼ê
+ * @param mode È¯Æ°Ãæ¤Î·õ½ÑID
+ * @return ¤Ê¤·
+ * @details
  * If no "weapon" is available, then "punch" the monster one time.
  */
 static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int mode)
@@ -2772,6 +2833,15 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
        }
 }
 
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÂÇ·â½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó
+ * @param y ¹¶·âÌÜɸ¤ÎYºÂɸ
+ * @param x ¹¶·âÌÜɸ¤ÎXºÂɸ
+ * @param mode È¯Æ°Ãæ¤Î·õ½ÑID
+ * @return ¼ÂºÝ¤Ë¹¶·â½èÍý¤¬¹Ô¤ï¤ì¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
+ * @details
+ * If no "weapon" is available, then "punch" the monster one time.
+ */
 bool py_attack(int y, int x, int mode)
 {
        bool            fear = FALSE;
@@ -3000,6 +3070,14 @@ bool py_attack(int y, int x, int mode)
 }
 
 
+/*!
+ * @brief ¥Ñ¥¿¡¼¥ó¤Ë¤è¤ë°ÜÆ°À©¸Â½èÍý
+ * @param c_y ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°¸µYºÂɸ
+ * @param c_x ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°¸µXºÂɸ
+ * @param n_y ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°ÀèYºÂɸ
+ * @param n_x ¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°ÀèXºÂɸ
+ * @return °ÜÆ°½èÍý¤¬²Äǽ¤Ç¤¢¤ë¾ì¹ç¡Ê²Äǽ¤Ê¾ì¹ç¤ËÁªÂò¤·¤¿¾ì¹ç¡ËTRUE¤òÊÖ¤¹¡£
+ */
 bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
 {
        feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat];
@@ -3152,6 +3230,12 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
 }
 
 
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤¬ÃÏ·ÁƧÇ˲Äǽ¤«¤òÊÖ¤¹
+ * @param feature È½Äꤷ¤¿¤¤ÃÏ·ÁID
+ * @param mode °ÜÆ°¤Ë´Ø¤¹¤ë¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
+ * @return °ÜÆ°²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
+ */
 bool player_can_enter(s16b feature, u16b mode)
 {
        feature_type *f_ptr = &f_info[feature];
@@ -3175,8 +3259,12 @@ bool player_can_enter(s16b feature, u16b mode)
 }
 
 
-/*
- * Move the player
+/*!
+ * @brief °ÜÆ°¤Ëȼ¤¦¥×¥ì¥¤¥ä¡¼¤Î¥¹¥Æ¡¼¥¿¥¹ÊѲ½½èÍý
+ * @param ny °ÜÆ°ÀèYºÂɸ
+ * @param nx °ÜÆ°ÀèXºÂɸ
+ * @param mpe_mode °ÜÆ°¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
+ * @return ¥×¥ì¥¤¥ä¡¼¤¬»àË´¤ä¥Õ¥í¥¢Î¥Ã¦¤ò¹Ô¤ï¤º¡¢¼ÂºÝ¤Ë°ÜÆ°¤¬²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
  */
 bool move_player_effect(int ny, int nx, u32b mpe_mode)
 {
@@ -3404,7 +3492,11 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode)
        return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving;
 }
 
-
+/*!
+ * @brief ³ºÅöÃÏ·Á¤Î¥È¥é¥Ã¥×¤¬¥×¥ì¥¤¥ä¡¼¤Ë¤È¤Ã¤Æ̵¸ú¤«¤É¤¦¤«¤òȽÄꤷ¤ÆÊÖ¤¹
+ * @param feat ÃÏ·ÁID
+ * @return ¥È¥é¥Ã¥×¤¬¼«Æ°Åª¤Ë̵¸ú¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
+ */
 bool trap_can_be_ignored(int feat)
 {
        feature_type *f_ptr = &f_info[feat];
@@ -3455,14 +3547,20 @@ bool trap_can_be_ignored(int feat)
         have_flag((MF)->flags, FF_PROJECT) && \
         !have_flag((MF)->flags, FF_OPEN))
 
-/*
+
+/*!
+ * @brief ³ºÅöÃÏ·Á¤Î¥È¥é¥Ã¥×¤¬¥×¥ì¥¤¥ä¡¼¤Ë¤È¤Ã¤Æ̵¸ú¤«¤É¤¦¤«¤òȽÄꤷ¤ÆÊÖ¤¹ /
  * Move player in the given direction, with the given "pickup" flag.
- *
- * This routine should (probably) always induce energy expenditure.
- *
- * Note that moving will *always* take a turn, and will *always* hit
- * any monster which might be in the destination grid.  Previously,
- * moving into walls was "free" and did NOT hit invisible monsters.
+ * @param dir °ÜÆ°Êý¸þID
+ * @param do_pickup æ«²ò½ü¤ò»î¤ß¤Ê¤¬¤é¤Î°ÜÆ°¤Ê¤é¤ÐTRUE
+ * @param break_trap ¥È¥é¥Ã¥×Ê´ºÕ½èÍý¤ò¹Ô¤¦¤Ê¤é¤ÐTRUE
+ * @return ¼ÂºÝ¤Ë°ÜÆ°¤¬¹Ô¤ï¤ì¤¿¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
+ * @note
+ * This routine should (probably) always induce energy expenditure.\n
+ * @details
+ * Note that moving will *always* take a turn, and will *always* hit\n
+ * any monster which might be in the destination grid.  Previously,\n
+ * moving into walls was "free" and did NOT hit invisible monsters.\n
  */
 void move_player(int dir, bool do_pickup, bool break_trap)
 {
@@ -3945,8 +4043,13 @@ void move_player(int dir, bool do_pickup, bool break_trap)
 
 static bool ignore_avoid_run;
 
-/*
+/*!
+ * @brief ¥À¥Ã¥·¥å°ÜÆ°½èÍýÃæ¡¢°ÜÆ°Àè¤Î¥Þ¥¹¤¬´ûÃΤÎÊɤ«¤É¤¦¤«¤òȽÄꤹ¤ë /
  * Hack -- Check for a "known wall" (see below)
+ * @param dir ÁÛÄꤹ¤ë°ÜÆ°Êý¸þID
+ * @param y °ÜÆ°¸µ¤ÎYºÂɸ
+ * @param x °ÜÆ°¸µ¤ÎXºÂɸ
+ * @return °ÜÆ°À褬´ûÃΤÎÊɤʤé¤ÐTRUE
  */
 static int see_wall(int dir, int y, int x)
 {
@@ -3985,8 +4088,13 @@ static int see_wall(int dir, int y, int x)
 }
 
 
-/*
+/*!
+ * @brief ¥À¥Ã¥·¥å°ÜÆ°½èÍýÃæ¡¢°ÜÆ°Àè¤Î¥Þ¥¹¤«Ì¤ÃΤÎÃÏ·Á¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
  * Hack -- Check for an "unknown corner" (see below)
+ * @param dir ÁÛÄꤹ¤ë°ÜÆ°Êý¸þID
+ * @param y °ÜÆ°¸µ¤ÎYºÂɸ
+ * @param x °ÜÆ°¸µ¤ÎXºÂɸ
+ * @return °ÜÆ°À褬̤ÃΤÎÃÏ·Á¤Ê¤é¤ÐTRUE
  */
 static int see_nothing(int dir, int y, int x)
 {
@@ -4011,137 +4119,6 @@ static int see_nothing(int dir, int y, int x)
 
 
 
-/*
- * The running algorithm:                       -CJS-
- *
- * In the diagrams below, the player has just arrived in the
- * grid marked as '@', and he has just come from a grid marked
- * as 'o', and he is about to enter the grid marked as 'x'.
- *
- * Of course, if the "requested" move was impossible, then you
- * will of course be blocked, and will stop.
- *
- * Overview: You keep moving until something interesting happens.
- * If you are in an enclosed space, you follow corners. This is
- * the usual corridor scheme. If you are in an open space, you go
- * straight, but stop before entering enclosed space. This is
- * analogous to reaching doorways. If you have enclosed space on
- * one side only (that is, running along side a wall) stop if
- * your wall opens out, or your open space closes in. Either case
- * corresponds to a doorway.
- *
- * What happens depends on what you can really SEE. (i.e. if you
- * have no light, then running along a dark corridor is JUST like
- * running in a dark room.) The algorithm works equally well in
- * corridors, rooms, mine tailings, earthquake rubble, etc, etc.
- *
- * These conditions are kept in static memory:
- * find_openarea         You are in the open on at least one
- * side.
- * find_breakleft        You have a wall on the left, and will
- * stop if it opens
- * find_breakright       You have a wall on the right, and will
- * stop if it opens
- *
- * To initialize these conditions, we examine the grids adjacent
- * to the grid marked 'x', two on each side (marked 'L' and 'R').
- * If either one of the two grids on a given side is seen to be
- * closed, then that side is considered to be closed. If both
- * sides are closed, then it is an enclosed (corridor) run.
- *
- * LL           L
- * @x          LxR
- * RR          @R
- *
- * Looking at more than just the immediate squares is
- * significant. Consider the following case. A run along the
- * corridor will stop just before entering the center point,
- * because a choice is clearly established. Running in any of
- * three available directions will be defined as a corridor run.
- * Note that a minor hack is inserted to make the angled corridor
- * entry (with one side blocked near and the other side blocked
- * further away from the runner) work correctly. The runner moves
- * diagonally, but then saves the previous direction as being
- * straight into the gap. Otherwise, the tail end of the other
- * entry would be perceived as an alternative on the next move.
- *
- * #.#
- * ##.##
- * .@x..
- * ##.##
- * #.#
- *
- * Likewise, a run along a wall, and then into a doorway (two
- * runs) will work correctly. A single run rightwards from @ will
- * stop at 1. Another run right and down will enter the corridor
- * and make the corner, stopping at the 2.
- *
- * ##################
- * o@x       1
- * ########### ######
- * #2          #
- * #############
- *
- * After any move, the function area_affect is called to
- * determine the new surroundings, and the direction of
- * subsequent moves. It examines the current player location
- * (at which the runner has just arrived) and the previous
- * direction (from which the runner is considered to have come).
- *
- * Moving one square in some direction places you adjacent to
- * three or five new squares (for straight and diagonal moves
- * respectively) to which you were not previously adjacent,
- * marked as '!' in the diagrams below.
- *
- *   ...!              ...
- *   .o@!  (normal)    .o.!  (diagonal)
- *   ...!  (east)      ..@!  (south east)
- *                      !!!
- *
- * You STOP if any of the new squares are interesting in any way:
- * for example, if they contain visible monsters or treasure.
- *
- * You STOP if any of the newly adjacent squares seem to be open,
- * and you are also looking for a break on that side. (that is,
- * find_openarea AND find_break).
- *
- * You STOP if any of the newly adjacent squares do NOT seem to be
- * open and you are in an open area, and that side was previously
- * entirely open.
- *
- * Corners: If you are not in the open (i.e. you are in a corridor)
- * and there is only one way to go in the new squares, then turn in
- * that direction. If there are more than two new ways to go, STOP.
- * If there are two ways to go, and those ways are separated by a
- * square which does not seem to be open, then STOP.
- *
- * Otherwise, we have a potential corner. There are two new open
- * squares, which are also adjacent. One of the new squares is
- * diagonally located, the other is straight on (as in the diagram).
- * We consider two more squares further out (marked below as ?).
- *
- * We assign "option" to the straight-on grid, and "option2" to the
- * diagonal grid, and "check_dir" to the grid marked 's'.
- *
- * ##s
- * @x?
- * #.?
- *
- * If they are both seen to be closed, then it is seen that no benefit
- * is gained from moving straight. It is a known corner.  To cut the
- * corner, go diagonally, otherwise go straight, but pretend you
- * stepped diagonally into that next location for a full view next
- * time. Conversely, if one of the ? squares is not seen to be closed,
- * then there is a potential choice. We check to see whether it is a
- * potential corner or an intersection/room entrance.  If the square
- * two spaces straight ahead, and the space marked with 's' are both
- * unknown space, then it is a potential corner and enter if
- * find_examine is set, otherwise must stop because it is not a
- * corner. (find_examine option is removed and always is TRUE.)
- */
-
-
-
 
 /*
  * Hack -- allow quick "cycling" through the legal directions
@@ -4178,19 +4155,21 @@ static bool find_breakleft;
 
 
 
-/*
+/*!
+ * @brief ¥À¥Ã¥·¥å½èÍý¤ÎƳÆþ /
  * Initialize the running algorithm for a new direction.
- *
- * Diagonal Corridor -- allow diaginal entry into corridors.
- *
- * Blunt Corridor -- If there is a wall two spaces ahead and
- * we seem to be in a corridor, then force a turn into the side
- * corridor, must be moving straight into a corridor here. ???
- *
- * Diagonal Corridor    Blunt Corridor (?)
- *       # #                  #
- *       #x#                 @x#
- *       @p.                  p
+ * @param dir Æ³Æþ¤Î°ÜÆ°Àè
+ * @details
+ * Diagonal Corridor -- allow diaginal entry into corridors.\n
+ *\n
+ * Blunt Corridor -- If there is a wall two spaces ahead and\n
+ * we seem to be in a corridor, then force a turn into the side\n
+ * corridor, must be moving straight into a corridor here. ???\n
+ *\n
+ * Diagonal Corridor    Blunt Corridor (?)\n
+ *       \# \#                  \#\n
+ *       \#x\#                  \@x\#\n
+ *       \@\@p.                  p\n
  */
 static void run_init(int dir)
 {
@@ -4285,9 +4264,11 @@ static void run_init(int dir)
 }
 
 
-/*
+/*!
+ * @brief ¥À¥Ã¥·¥å°ÜÆ°¤¬·Ñ³¤Ç¤­¤ë¤«¤É¤¦¤«¤ÎȽÄê /
  * Update the current "run" path
- *
+ * @return
+ * ¥À¥Ã¥·¥å°ÜÆ°¤¬·Ñ³¤Ç¤­¤ë¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
  * Return TRUE if the running should be stopped
  */
 static bool run_test(void)
@@ -4625,8 +4606,11 @@ static bool run_test(void)
 
 
 
-/*
+/*!
+ * @brief ·Ñ³Ū¤Ê¥À¥Ã¥·¥å½èÍý /
  * Take one step along the current "run" path
+ * @param dir °ÜÆ°¤ò»î¤ß¤ëÊý¸þID
+ * @return ¤Ê¤·
  */
 void run_step(int dir)
 {
@@ -4698,8 +4682,12 @@ void run_step(int dir)
 
 
 #ifdef TRAVEL
-/*
+
+/*!
+ * @brief ¥È¥é¥Ù¥ëµ¡Ç½¤ÎȽÄê½èÍý /
  * Test for traveling
+ * @param prev_dir Á°²ó°ÜÆ°¤ò¹Ô¤Ã¤¿¸µ¤ÎÊý³ÑID
+ * @return ¤Ê¤·
  */
 static int travel_test(int prev_dir)
 {
@@ -4799,8 +4787,10 @@ static int travel_test(int prev_dir)
 }
 
 
-/*
+/*!
+ * @brief ¥È¥é¥Ù¥ëµ¡Ç½¤Î¼ÂÁõ /
  * Travel command
+ * @return ¤Ê¤·
  */
 void travel_step(void)
 {
@@ -4817,6 +4807,7 @@ void travel_step(void)
 #else
                        msg_print("No route is found!");
 #endif
+                       travel.y = travel.x = 0;
                }
                disturb(0, 1);
                return;
@@ -4827,7 +4818,10 @@ void travel_step(void)
        move_player(travel.dir, always_pickup, FALSE);
 
        if ((py == travel.y) && (px == travel.x))
+       {
                travel.run = 0;
+               travel.y = travel.x = 0;
+       }
        else if (travel.run > 0)
                travel.run--;