OSDN Git Service

Add Doxygen comment to cmd1.c.
[hengband/hengband.git] / src / cmd1.c
index 65d1a69..d9d820c 100644 (file)
@@ -1,6 +1,8 @@
-/* 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,
  * are included in all such copies.  Other copyrights may also apply.
  */
 
-/* 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 +52,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 +71,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 +108,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 +180,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 +260,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 +307,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 +321,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 +378,21 @@ 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 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 +462,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 +536,10 @@ static void discover_hidden_things(int y, int x)
        }
 }
 
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Îõº÷½èÍýȽÄê
+ * @return ¤Ê¤·
+ */
 void search(void)
 {
        int i, chance;
@@ -485,25 +563,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];
@@ -577,29 +655,15 @@ void py_pickup_aux(int o_idx)
        record_turn = turn;
 
 
-       /* Check if completed a quest */
-       for (i = 0; i < max_quests; i++)
-       {
-               if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
-                   (quest[i].status == QUEST_STATUS_TAKEN) &&
-                          (quest[i].k_idx == o_ptr->name1))
-               {
-                       if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
-                       quest[i].status = QUEST_STATUS_COMPLETED;
-                       quest[i].complev = (byte)p_ptr->lev;
-#ifdef JP
-                       msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
-#else
-                       msg_print("You completed your quest!");
-#endif
-
-                       msg_print(NULL);
-               }
-       }
+       check_find_art_quest_completion(o_ptr);
 }
 
 
-/*
+/*!
+ * @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.
@@ -760,8 +824,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.
  */
@@ -792,9 +860,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_messsage ¥á¥Ã¥»¡¼¥¸¤ÎÊ䴰ʸ»úÎó
+ * @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)
 {
@@ -869,162 +1071,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;
                }
 
@@ -1078,9 +1128,9 @@ static void hit_trap(bool break_trap)
 
                        dam = damroll(4, 6);
 #ifdef JP
-                       (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1);
+                       (void)fire_dam(dam, "±ê¤Î¥È¥é¥Ã¥×", -1, FALSE);
 #else
-                       (void)fire_dam(dam, "a fire trap", -1);
+                       (void)fire_dam(dam, "a fire trap", -1, FALSE);
 #endif
 
                        break;
@@ -1096,9 +1146,9 @@ static void hit_trap(bool break_trap)
 
                        dam = damroll(4, 6);
 #ifdef JP
-                       (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1);
+                       (void)acid_dam(dam, "»À¤Î¥È¥é¥Ã¥×", -1, FALSE);
 #else
-                       (void)acid_dam(dam, "an acid trap", -1);
+                       (void)acid_dam(dam, "an acid trap", -1, FALSE);
 #endif
 
                        break;
@@ -1106,170 +1156,52 @@ static void hit_trap(bool break_trap)
 
                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
-
-                       }
+                       hit_trap_slow();
                        break;
                }
 
                case TRAP_LOSE_STR:
                {
-                       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)do_dec_stat(A_STR);
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("A small dart barely misses you.");
-#endif
-
-                       }
+                       hit_trap_lose_stat(A_STR);
                        break;
                }
 
                case TRAP_LOSE_DEX:
                {
-                       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)do_dec_stat(A_DEX);
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("A small dart barely misses you.");
-#endif
-
-                       }
+                       hit_trap_lose_stat(A_DEX);
                        break;
                }
 
                case TRAP_LOSE_CON:
                {
-                       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)do_dec_stat(A_CON);
-                       }
-                       else
-                       {
-#ifdef JP
-                               msg_print("¾®¤µ¤Ê¥À¡¼¥Ä¤¬Èô¤ó¤Ç¤­¤¿¡ª¤¬¡¢±¿Îɤ¯Åö¤¿¤é¤Ê¤«¤Ã¤¿¡£");
-#else
-                               msg_print("A small dart barely misses you.");
-#endif
-
-                       }
+                       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;
                }
 
@@ -1438,93 +1370,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);
+               /* Hack -- Get the "died from" name */
+               monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
 
-#ifdef JP
-                       msg_print("ÆÍÁ³¤È¤Æ¤âÇ®¤¯¤Ê¤Ã¤¿¡ª");
-#else
-                       msg_print("You are suddenly very hot!");
-#endif
+               msg_print(message);
 
-                       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;
-
-                       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;
@@ -1694,10 +1600,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)
@@ -2790,6 +2703,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;
@@ -3357,16 +3279,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode)
        {
                if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
                {
-                       if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, p_ptr->inside_quest, NULL);
-                       quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED;
-                       quest[p_ptr->inside_quest].complev = (byte)p_ptr->lev;
-#ifdef JP
-                       msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
-#else
-                       msg_print("You accomplished your quest!");
-#endif
-
-                       msg_print(NULL);
+                       complete_quest(p_ptr->inside_quest);
                }
 
                leave_quest_check();
@@ -4844,6 +4757,7 @@ void travel_step(void)
 #else
                        msg_print("No route is found!");
 #endif
+                       travel.y = travel.x = 0;
                }
                disturb(0, 1);
                return;
@@ -4854,7 +4768,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--;